From 303704c3577a2762041b1d4b647c8bea016536d8 Mon Sep 17 00:00:00 2001 From: rasmusvt Date: Thu, 16 Jun 2022 17:54:51 +0200 Subject: [PATCH] Add filter --- nafuma/auxillary.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nafuma/auxillary.py b/nafuma/auxillary.py index 072ee83..2b87479 100644 --- a/nafuma/auxillary.py +++ b/nafuma/auxillary.py @@ -68,7 +68,7 @@ def write_log(message, options={}): options = update_options(options=options, required_options=required_options, default_options=default_options) now = datetime.now().strftime('%Y/%m/%d %H:%M:%S') - message = f'{now} {message} \n' + message = f'[{now}] {message} \n' with open(options['logfile'], 'a') as f: @@ -76,13 +76,13 @@ def write_log(message, options={}): #Function that "collects" all the files in a folder, only accepting .dat-files from xanes-measurements -def get_filenames(path, ext): +def get_filenames(path, ext, filter=''): ''' Collects all filenames from specified path with a specificed extension Input: path: path to find all filenames (relative or absolute) ext: extension (including ".")''' - filenames = [os.path.join(path, filename) for filename in os.listdir(path) if os.path.isfile(os.path.join(path, filename)) and filename.endswith(ext)] + filenames = [os.path.join(path, filename) for filename in os.listdir(path) if os.path.isfile(os.path.join(path, filename)) and filename.endswith(ext) and filter in filename] return filenames \ No newline at end of file