diff --git a/src/nomad_unisyscat/schema_packages/mypackage.py b/src/nomad_unisyscat/schema_packages/mypackage.py index 5ad967e..2529501 100644 --- a/src/nomad_unisyscat/schema_packages/mypackage.py +++ b/src/nomad_unisyscat/schema_packages/mypackage.py @@ -1,9 +1,8 @@ +import os from typing import ( TYPE_CHECKING, ) -import os - if TYPE_CHECKING: from nomad.datamodel.datamodel import ( EntryArchive, @@ -23,6 +22,7 @@ m_package = SchemaPackage() + class NVRSpectroscopy(Measurement, PlotSection, EntryData): measurements_data_file = Quantity( type=str, @@ -30,7 +30,7 @@ class NVRSpectroscopy(Measurement, PlotSection, EntryData): experimental tab data file """, a_eln=dict(component='FileEditQuantity'), - a_browser=dict(adaptor='RawFileAdaptor') + a_browser=dict(adaptor='RawFileAdaptor'), ) # simulation_data_file = Quantity( @@ -47,33 +47,34 @@ class NVRSpectroscopy(Measurement, PlotSection, EntryData): description=""" name of the method """, - a_eln=dict(component='StringEditQuantity', - default= 'Nuclear resonance vibrational spectroscopy' - ) + a_eln=dict( + component='StringEditQuantity', + default='Nuclear resonance vibrational spectroscopy', + ), ) - def normalize(self, archive, logger): + def normalize(self, archive, logger): super(NVRSpectroscopy, self).normalize(archive, logger) if self.measurements_data_file is None: return - if (self.measurements_data_file is not None) and (os.path.splitext( - self.measurement_data_file)[-1] != ".dat"): - raise ValueError("Unsupported file format. Only .dat file") + if (self.measurements_data_file is not None) and ( + os.path.splitext(self.measurement_data_file)[-1] != '.dat' + ): + raise ValueError('Unsupported file format. Only .dat file') - if self.measurement_data_file.endswith(".dat"): + if self.measurement_data_file.endswith('.dat'): with archive.m_context.raw_file(self.measurement_data_file) as f: import pandas as pd - col_names=['wavenumber, cm-1','57Fe PVDOS'] - data = pd.read_csv(f.name, header=None, names=col_names) + col_names = ['wavenumber, cm-1', '57Fe PVDOS'] + data = pd.read_csv(f.name, header=None, names=col_names) self.figures = [] fig = px.line(x=data['wavenumber, cm-1'], y=data['57Fe PVDOS']) fig.update_xaxes(title_text=col_names[0]) fig.update_yaxes(title_text=col_names[1]) - self.figures.append(PlotlyFigure( - label='NVPS', figure=fig.to_plotly_json())) + self.figures.append(PlotlyFigure(label='NVPS', figure=fig.to_plotly_json())) class MySchema(Schema):