Skip to content

Commit

Permalink
Fixing
Browse files Browse the repository at this point in the history
  • Loading branch information
ka-sarthak committed Dec 5, 2024
1 parent 5f378d2 commit fdd2222
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/nomad_measurements/xrd/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -988,16 +988,15 @@ def populate_hdf5_data_dict(
return

# find the corresponding dataset for the given hdf5_path
for dataset_path in self.hdf5_dataset_paths:
if hdf5_path == dataset_path:
if isinstance(value, pint.Quantity):
self.hdf5_data_dict[dataset_path] = value.magnitude
self.hdf5_data_dict[f'{dataset_path}/@units'] = str(value.units)
else:
self.hdf5_data_dict[dataset_path] = value
if hdf5_path in self.hdf5_dataset_paths:
if isinstance(value, pint.Quantity):
self.hdf5_data_dict[hdf5_path] = value.magnitude
self.hdf5_data_dict[f'{hdf5_path}/@units'] = str(value.units)
else:
self.hdf5_data_dict[hdf5_path] = value
ref = (
f'/uploads/{self.m_parent.m_context.upload_id}/raw'
f'/{self.auxiliary_file}#{dataset_path}'
f'/{self.auxiliary_file}#{hdf5_path}'
)
self.hdf5_references[archive_path] = ref
return
Expand Down Expand Up @@ -1110,6 +1109,7 @@ def set_hdf5_reference(section: 'Section', path: str, ref: str):
path (str): The path to the quantity.
ref (str): The reference to the HDF5 dataset.
"""
# TODO handle the case when section in the path is not initialized
attr = section
path = path.split('.')
quantity_name = path.pop()
Expand Down

0 comments on commit fdd2222

Please sign in to comment.