Skip to content

Commit

Permalink
Merge pull request #437 from FAIRmat-NFDI/simplify-attr-setter
Browse files Browse the repository at this point in the history
Use quantity name directly
  • Loading branch information
lukaspie authored Oct 18, 2024
2 parents 6b62c25 + 1f27802 commit 2d2cb9e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/pynxtools/nomad/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ def _populate_data(
"setting attribute attempt before creating quantity"
)
current.m_set_quantity_attribute(
metainfo_def, attr_name, attr_value, quantity=quantity
quantity.name, attr_name, attr_value
)
except Exception as e:
self._logger.warning(
Expand Down Expand Up @@ -308,26 +308,26 @@ def _populate_data(
try:
current.m_set(metainfo_def, field)
current.m_set_quantity_attribute(
metainfo_def, "m_nx_data_path", hdf_node.name, quantity=field
data_instance_name, "m_nx_data_path", hdf_node.name
)
current.m_set_quantity_attribute(
metainfo_def, "m_nx_data_file", self.nxs_fname, quantity=field
data_instance_name, "m_nx_data_file", self.nxs_fname
)
if field_stats is not None:
# TODO _add_additional_attributes function has created these nx_data_*
# attributes speculatively already so if the field_stats is None
# this will cause unpopulated attributes in the GUI
current.m_set_quantity_attribute(
metainfo_def, "nx_data_mean", field_stats[0], quantity=field
data_instance_name, "nx_data_mean", field_stats[0]
)
current.m_set_quantity_attribute(
metainfo_def, "nx_data_var", field_stats[1], quantity=field
data_instance_name, "nx_data_var", field_stats[1]
)
current.m_set_quantity_attribute(
metainfo_def, "nx_data_min", field_stats[2], quantity=field
data_instance_name, "nx_data_min", field_stats[2]
)
current.m_set_quantity_attribute(
metainfo_def, "nx_data_max", field_stats[3], quantity=field
data_instance_name, "nx_data_max", field_stats[3]
)
except Exception as e:
self._logger.warning(
Expand Down

0 comments on commit 2d2cb9e

Please sign in to comment.