Skip to content

Commit

Permalink
34 add fixed filter to app (#35)
Browse files Browse the repository at this point in the history
* using fixed upload name as filters_locked

* clean up

* add super().normalize at beginning of nrvs normalizer

* fix ruff check
  • Loading branch information
schumannj authored Jun 24, 2024
1 parent e4b11d5 commit 4ad0a9f
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 35 deletions.
2 changes: 2 additions & 0 deletions src/nomad_unisyscat/apps/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
filter_menus=FilterMenus(
options={
'material': FilterMenu(label='Material'),
'elements': FilterMenu(label='Elements / Formula', level=1, size='xl'),
'eln': FilterMenu(label='Electronic Lab Notebook'),
'custom_quantities': FilterMenu(label='User Defined Quantities'),
'author': FilterMenu(label='Author / Origin / Dataset'),
Expand All @@ -48,6 +49,7 @@
filters=Filters(
include=['*#nomad_unisyscat.schema_packages.mypackage.*'],
),
filters_locked={'upload_name': 'UniSysCat Test Data'},
dashboard={
'widgets': [
{
Expand Down
67 changes: 32 additions & 35 deletions src/nomad_unisyscat/schema_packages/mypackage.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,13 +463,12 @@ class NRVSpectroscopy(Measurement, PlotSection, Schema):
results.section_def = NRVSResult

def normalize(self, archive, logger):

super().normalize(archive, logger)
if self.data_file is None:
return

if (self.data_file is not None) and (
os.path.splitext(self.data_file)[-1] != '.dat'
):
os.path.splitext(self.data_file)[-1] != '.dat'):
raise ValueError('Unsupported file format. Only .dat file')

if self.data_file.endswith('.dat'):
Expand All @@ -486,40 +485,38 @@ def normalize(self, archive, logger):
results.append(result)
self.results = results

if self.data_file.endswith('_NRVS_exp.dat'):
file_name = str(self.data_file)
sample_name = file_name.split('_NRVS')
if self.samples is None or self.samples == []:
sample = CompositeSystemReference()
sample.name = sample_name[0]
sample.lab_id = sample_name[0]
from nomad.datamodel.context import ClientContext
if isinstance(archive.m_context, ClientContext):
pass
else:
sample.normalize(archive, logger)
samples = []
samples.append(sample)
self.samples = samples

self.method = 'experimental nuclear resonance vibrational spectroscopy'
if self.instruments is None or self.instruments == []:
instrument = InstrumentReference()
instrument.name = 'NRVS setup'
instrument.lab_id = 'NRVS-setup'
from nomad.datamodel.context import ClientContext
if isinstance(archive.m_context, ClientContext):
pass
else:
instrument.normalize(archive, logger)
instruments = []
instruments.append(instrument)
self.instruments = instruments
elif self.data_file.endswith('_NRVS_sim.dat'):
self.method = 'simulated nuclear resonance vibrational spectroscopy'
if self.data_file.endswith('_NRVS_exp.dat'):
sample_name = str(self.data_file).split('_NRVS')
if self.samples is None or self.samples == []:
sample = CompositeSystemReference()
sample.name = sample_name[0]
sample.lab_id = sample_name[0]
from nomad.datamodel.context import ClientContext
if isinstance(archive.m_context, ClientContext):
pass
else:
sample.normalize(archive, logger)
samples = []
samples.append(sample)
self.samples = samples

self.method = 'experimental nuclear resonance vibrational spectroscopy'
if self.instruments is None or self.instruments == []:
instrument = InstrumentReference()
instrument.name = 'NRVS setup'
instrument.lab_id = 'NRVS-setup'
from nomad.datamodel.context import ClientContext
if isinstance(archive.m_context, ClientContext):
pass
else:
instrument.normalize(archive, logger)
instruments = []
instruments.append(instrument)
self.instruments = instruments
elif self.data_file.endswith('_NRVS_sim.dat'):
self.method = 'simulated nuclear resonance vibrational spectroscopy'

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])
Expand Down

0 comments on commit 4ad0a9f

Please sign in to comment.