Added force option to overwrite measurements when created from Numpy array
This commit is contained in:
parent
cf0b4cf283
commit
e0f74121fe
@ -737,10 +737,12 @@ class Measurement:
|
|||||||
delimiter: Column delimiter
|
delimiter: Column delimiter
|
||||||
firstcoltime: If true, the first column is the treated as the
|
firstcoltime: If true, the first column is the treated as the
|
||||||
sample time.
|
sample time.
|
||||||
|
force: If True, overwrites existing files with specified `mfn`
|
||||||
|
name.
|
||||||
"""
|
"""
|
||||||
if os.path.splitext(mfn)[1] != '.h5':
|
if os.path.splitext(mfn)[1] != '.h5':
|
||||||
mfn += '.h5'
|
mfn += '.h5'
|
||||||
if os.path.exists(mfn):
|
if os.path.exists(mfn) and not force:
|
||||||
raise ValueError(f'File {mfn} already exist.')
|
raise ValueError(f'File {mfn} already exist.')
|
||||||
if timestamp is None:
|
if timestamp is None:
|
||||||
timestamp = int(time.time())
|
timestamp = int(time.time())
|
||||||
|
Loading…
Reference in New Issue
Block a user