Skip to content

Commit

Permalink
FIX HDF5 Viewer visualization
Browse files Browse the repository at this point in the history
- change schema naming to be clearer
- set y-axis title (TODO: fix x-axis title)
- use signal.long_name as plot title
- remove auxilliary_signals

- TODO: fix option to save `parameter_names`
  • Loading branch information
ndaelman committed Jan 7, 2025
1 parent 5228795 commit f2417ec
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 21 deletions.
13 changes: 4 additions & 9 deletions src/nomad_parser_plugin_boss/parsers/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,8 @@ def compute_parameters(rank: int):
# Save slices
slice_path = f'parameter_slices/{parameter_counter}'
section = archive.data.m_setdefault(slice_path)
main_data = archive.data.parameter_slices[0].m_annotations
if parameter_counter == 0:
main_data['h5web'] = H5WebAnnotation(auxiliary_signals=[])
else:
main_data['h5web'].auxiliary_signals.append('/data/' + slice_path)

section.fitted_values = np.array(mu_all_slices)
section.fitted_stddevs = np.sqrt(var_all_slices)
section.parameter_1_values = np.array(compute_parameters(main_rank))
section.parameter_2_values = np.array(compute_parameters(upper_rank))
section.fit = np.array(mu_all_slices)
section.fitting_errors = np.sqrt(var_all_slices)
section.parameters_x = np.array(compute_parameters(main_rank))
section.parameters_y = np.array(compute_parameters(upper_rank))
24 changes: 12 additions & 12 deletions src/nomad_parser_plugin_boss/schema_packages/schema_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,32 +29,32 @@ class ParameterSpaceSlice(Schema):
# ! TODO use `PhysicalProperty`
m_def = Section(
a_h5web=H5WebAnnotation(
signal='./fitted_values',
axes=['parameter_1_values', 'parameter_2_values'],
signal='fit',
axes=['parameters_x', 'parameters_y'],
)
)

fitted_values = Quantity(
fit = Quantity(
type=HDF5Dataset,
unit='eV',
a_h5web=H5WebAnnotation(long_name='PES', errors='fitted_stddevs'),
a_h5web=H5WebAnnotation(long_name='Potential Energy Surface Fit', errors='fitting_errors',),
) # ? units

fitted_stddevs = Quantity(type=HDF5Dataset, unit='eV')
fitting_errors = Quantity(type=HDF5Dataset, unit='eV')

parameter_1_values = Quantity(
type=HDF5Dataset, a_h5web=H5WebAnnotation(long_name='', indices=1)
parameters_x = Quantity(
type=HDF5Dataset, a_h5web=H5WebAnnotation(long_name='a', indices=1)
)

parameter_2_values = Quantity(
type=HDF5Dataset, a_h5web=H5WebAnnotation(long_name='', indices=2)
parameters_y = Quantity(
type=HDF5Dataset, a_h5web=H5WebAnnotation(long_name='b', indices=2)
)


class PotentialEnergySurfaceFit(Schema):
m_def = Section(
a_h5web=H5WebAnnotation(
title='Potential Energy Surface Fit', paths=['parameter_slices/0']
paths=['parameter_slices/0']
),
)

Expand All @@ -73,10 +73,10 @@ def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger'):
generate_slices(n_slices), self.parameter_slices
):
main_rank, upper_rank = slice_indices
parameter_slice.parameter_1_values.m_annotations[
parameter_slice.parameters_x.m_annotations[
'h5web'
].long_name = self.parameter_names[main_rank]
parameter_slice.parameter_2_values.m_annotations[
parameter_slice.parameters_y.m_annotations[
'h5web'
].long_name = self.parameter_names[upper_rank]
else:
Expand Down

0 comments on commit f2417ec

Please sign in to comment.