From 0598075f537d19804db62799cf8ae91aa17bae25 Mon Sep 17 00:00:00 2001 From: "Eugeniy E. Mikhailov" Date: Thu, 20 Jan 2022 22:32:18 -0500 Subject: when generating file it is possible to supply date, handy for already saved files --- qolab/file_utils/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/qolab/file_utils/__init__.py b/qolab/file_utils/__init__.py index 7a435db..517a28e 100644 --- a/qolab/file_utils/__init__.py +++ b/qolab/file_utils/__init__.py @@ -60,11 +60,12 @@ def get_runnum(data_dir): f.close() return(run_number) -def get_next_data_file(prefix, savepath, run_number=None, date_format='%Y%m%d', extention='dat'): +def get_next_data_file(prefix, savepath, run_number=None, datestr=None, date_format='%Y%m%d', extention='dat'): if run_number is None: run_number = get_runnum( savepath ) today = date.today() - datestr = today.strftime(date_format) + if datestr is None: + datestr = today.strftime(date_format) fname = os.path.join(savepath, f'{prefix}_{datestr}_{run_number:05d}.{extention}') return(fname) -- cgit v1.2.3