Skip to content
Snippets Groups Projects
Commit a1af9eb1 authored by Thomas Kluyver's avatar Thomas Kluyver
Browse files

Don't write creationDate & updateDate unless specified

parent f10e8cfb
No related branches found
No related tags found
1 merge request!937DataFile: Don't write creationDate & updateDate unless specified
...@@ -310,16 +310,14 @@ class DataFile(h5py.File): ...@@ -310,16 +310,14 @@ class DataFile(h5py.File):
if sequence is None: if sequence is None:
sequence = self.__sequence sequence = self.__sequence
if creation_date is None:
creation_date = datetime.now()
if update_date is None: if update_date is None:
update_date = creation_date update_date = creation_date
md_group = self.require_group('METADATA') md_group = self.require_group('METADATA')
md_group.create_dataset( if creation_date is not None:
'creationDate', shape=(1,), md_group.create_dataset(
data=creation_date.strftime('%Y%m%dT%H%M%SZ').encode('ascii')) 'creationDate', shape=(1,),
data=creation_date.strftime('%Y%m%dT%H%M%SZ').encode('ascii'))
md_group.create_dataset('daqLibrary', shape=(1,), md_group.create_dataset('daqLibrary', shape=(1,),
data=daq_library.encode('ascii')) data=daq_library.encode('ascii'))
md_group.create_dataset('dataFormatVersion', shape=(1,), data=b'1.2') md_group.create_dataset('dataFormatVersion', shape=(1,), data=b'1.2')
...@@ -360,9 +358,10 @@ class DataFile(h5py.File): ...@@ -360,9 +358,10 @@ class DataFile(h5py.File):
'runNumber', shape=(1,), dtype=np.uint32, data=run) 'runNumber', shape=(1,), dtype=np.uint32, data=run)
md_group.create_dataset( md_group.create_dataset(
'sequenceNumber', shape=(1,), dtype=np.uint32, data=sequence) 'sequenceNumber', shape=(1,), dtype=np.uint32, data=sequence)
md_group.create_dataset( if update_date is not None:
'updateDate', shape=(1,), md_group.create_dataset(
data=update_date.strftime('%Y%m%dT%H%M%SZ').encode('ascii')) 'updateDate', shape=(1,),
data=update_date.strftime('%Y%m%dT%H%M%SZ').encode('ascii'))
class ControlSource(h5py.Group): class ControlSource(h5py.Group):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment