aboutsummaryrefslogtreecommitdiff
path: root/qolab
diff options
context:
space:
mode:
authorEugeniy E. Mikhailov <evgmik@gmail.com>2022-01-20 22:32:18 -0500
committerEugeniy E. Mikhailov <evgmik@gmail.com>2022-01-20 22:32:18 -0500
commit0598075f537d19804db62799cf8ae91aa17bae25 (patch)
treeb31db6a11c43d5a5e3341897b3968a277cdef993 /qolab
parentbc5fe26a8d17a132d85c689aacb60688ea705132 (diff)
downloadpyExpControl-0598075f537d19804db62799cf8ae91aa17bae25.tar.gz
pyExpControl-0598075f537d19804db62799cf8ae91aa17bae25.zip
when generating file it is possible to supply date, handy for already saved files
Diffstat (limited to 'qolab')
-rw-r--r--qolab/file_utils/__init__.py5
1 files 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)