diff --git a/src/nomad_measurements/utils.py b/src/nomad_measurements/utils.py index ab64610..17382fb 100644 --- a/src/nomad_measurements/utils.py +++ b/src/nomad_measurements/utils.py @@ -249,10 +249,13 @@ def add_dataset( dataset = DatasetModel( **params, ) - if validate_path and self.valid_dataset_paths: - if path not in self.valid_dataset_paths: - self.logger.warning(f'Invalid dataset path "{path}".') - return + if ( + validate_path + and self.valid_dataset_paths + and path not in self.valid_dataset_paths + ): + self.logger.warning(f'Invalid dataset path "{path}".') + return # handle the pint.Quantity and add data if isinstance(dataset.data, pint.Quantity):