From f2417ec9cbddbf0a823bdab658d73cc4462322f0 Mon Sep 17 00:00:00 2001 From: ndaelman Date: Tue, 7 Jan 2025 23:31:09 +0100 Subject: [PATCH] FIX HDF5 Viewer visualization - 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` --- .../parsers/parser.py | 13 ++++------ .../schema_packages/schema_package.py | 24 +++++++++---------- 2 files changed, 16 insertions(+), 21 deletions(-) diff --git a/src/nomad_parser_plugin_boss/parsers/parser.py b/src/nomad_parser_plugin_boss/parsers/parser.py index 17348f9..47feb3f 100644 --- a/src/nomad_parser_plugin_boss/parsers/parser.py +++ b/src/nomad_parser_plugin_boss/parsers/parser.py @@ -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)) diff --git a/src/nomad_parser_plugin_boss/schema_packages/schema_package.py b/src/nomad_parser_plugin_boss/schema_packages/schema_package.py index b70592f..1638911 100644 --- a/src/nomad_parser_plugin_boss/schema_packages/schema_package.py +++ b/src/nomad_parser_plugin_boss/schema_packages/schema_package.py @@ -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'] ), ) @@ -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: