From d767304f9438a1e6b596089e7792c761a6a9771f Mon Sep 17 00:00:00 2001 From: Julia Schumann <32182254+schumannj@users.noreply.github.com> Date: Fri, 21 Jun 2024 13:23:59 +0000 Subject: [PATCH] replace ELNSample and ELNInstrument with basesections, add categories to all entrydata type schema sections --- .../schema_packages/mypackage.py | 44 +++++++++++-------- 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/src/nomad_unisyscat/schema_packages/mypackage.py b/src/nomad_unisyscat/schema_packages/mypackage.py index 42d4b3a..dc4abf7 100644 --- a/src/nomad_unisyscat/schema_packages/mypackage.py +++ b/src/nomad_unisyscat/schema_packages/mypackage.py @@ -9,12 +9,14 @@ from nomad.datamodel.data import ArchiveSection, Schema from nomad.datamodel.metainfo.annotations import ELNAnnotation from nomad.datamodel.metainfo.basesections import ( + CompositeSystem, CompositeSystemReference, + Instrument, InstrumentReference, Measurement, MeasurementResult, ) -from nomad.datamodel.metainfo.eln import ELNInstrument, ELNSample + from nomad.datamodel.metainfo.plot import PlotlyFigure, PlotSection from nomad.metainfo import Datetime, Quantity, SchemaPackage, Section from nomad.metainfo.metainfo import Category, MCategory, SubSection @@ -40,26 +42,19 @@ class EntryDataCategory(MCategory): class UniSysCatElnCategory(EntryDataCategory): m_def = Category(label='UniSysCat', categories=[EntryDataCategory]) -class UniSysCatSample(ELNSample, Schema): +class UniSysCatSample(CompositeSystem, Schema): ''' Class autogenerated from yaml schema. ''' m_def = Section( - a_eln={ - "hide": [ - "chemical_formula", - "description", - "datetime" - ] - }, label='Sample', categories=[UniSysCatElnCategory],) creation_time = Quantity( type=Datetime, - a_eln={ - "component": "DateTimeEditQuantity" - }, + a_eln=dict( + component= 'DateTimeEditQuantity', label='creation time' + ), ) protein_solution = Quantity( type=MEnum(['ReRH', 'ReMBH']), @@ -82,11 +77,12 @@ class UniSysCatSample(ELNSample, Schema): "component": "RadioEnumEditQuantity" }, ) - additional_information = Quantity( + + description = Quantity( type=str, - a_eln={ - "component": "RichTextEditQuantity" - }, + a_eln=dict( + component= "RichTextEditQuantity", label='additional information' + ), ) def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None: @@ -101,8 +97,12 @@ def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None: super().normalize(archive, logger) -class UniSysCatInstrument(ELNInstrument): - pass +class UniSysCatInstrument(Instrument, Schema): + m_def = Section( + label = 'Instrument entry', + categories=[UniSysCatElnCategory] + ) + class EPRSettings(ArchiveSection): @@ -430,6 +430,10 @@ class NRVSResult(MeasurementResult): class NRVSpectroscopy(Measurement, PlotSection, Schema): + m_def = Section( + label = 'NRVS measurement entry', + categories=[UniSysCatElnCategory] + ) data_file = Quantity( type=str, description=""" @@ -554,6 +558,10 @@ class IRResult(MeasurementResult): class IRSpectroscopy(Measurement, PlotSection, Schema): + m_def = Section( + label = 'IR measurement entry', + categories=[UniSysCatElnCategory] + ) data_file = Quantity( type=str, description="""