Skip to content
Snippets Groups Projects

DataFile: Don't write creationDate & updateDate unless specified

Merged Thomas Kluyver requested to merge fix/rm-default-timestamp into master
1 unresolved thread
1 file
+ 8
9
Compare changes
  • Side-by-side
  • Inline
+ 8
9
@@ -310,16 +310,14 @@ class DataFile(h5py.File):
if sequence is None:
sequence = self.__sequence
if creation_date is None:
creation_date = datetime.now()
if update_date is None:
update_date = creation_date
md_group = self.require_group('METADATA')
md_group.create_dataset(
'creationDate', shape=(1,),
data=creation_date.strftime('%Y%m%dT%H%M%SZ').encode('ascii'))
if creation_date is not None:
md_group.create_dataset(
'creationDate', shape=(1,),
data=creation_date.strftime('%Y%m%dT%H%M%SZ').encode('ascii'))
md_group.create_dataset('daqLibrary', shape=(1,),
data=daq_library.encode('ascii'))
md_group.create_dataset('dataFormatVersion', shape=(1,), data=b'1.2')
@@ -360,9 +358,10 @@ class DataFile(h5py.File):
'runNumber', shape=(1,), dtype=np.uint32, data=run)
md_group.create_dataset(
'sequenceNumber', shape=(1,), dtype=np.uint32, data=sequence)
md_group.create_dataset(
'updateDate', shape=(1,),
data=update_date.strftime('%Y%m%dT%H%M%SZ').encode('ascii'))
if update_date is not None:
md_group.create_dataset(
'updateDate', shape=(1,),
data=update_date.strftime('%Y%m%dT%H%M%SZ').encode('ascii'))
class ControlSource(h5py.Group):
Loading