diff --git a/src/cal_tools/files.py b/src/cal_tools/files.py index 9d18d72de4b12fc8d20a88eff7d922854c24bc88..5d19004413595fc7c86445d4770b24b366769b9e 100644 --- a/src/cal_tools/files.py +++ b/src/cal_tools/files.py @@ -259,7 +259,7 @@ class DataFile(h5py.File): def create_metadata(self, like=None, *, creation_date=None, update_date=None, proposal=0, - run=None, sequence=None, daq_library='1.x', + run=0, sequence=None, daq_library='1.x', karabo_framework='2.x', control_sources=(), instrument_channels=()): """Create METADATA datasets. @@ -297,10 +297,11 @@ class DataFile(h5py.File): if like is not None: metadata = like.run_metadata() - proposal = metadata['proposalNumber'] - run = metadata['runNumber'] - daq_library = metadata['daqLibrary'] - karabo_framework = metadata['karaboFramework'] + proposal = metadata.get('proposalNumber', proposal) + run = metadata.get('runNumber', run) + daq_library = metadata.get('daqLibrary', daq_library) + karabo_framework = metadata.get('karaboFramework', + karabo_framework) else: if run is None: