Skip to content

Commit

Permalink
replace ELNSample and ELNInstrument with basesections, add categories…
Browse files Browse the repository at this point in the history
… to all entrydata type schema sections
  • Loading branch information
schumannj committed Jun 21, 2024
1 parent b904e1c commit d767304
Showing 1 changed file with 26 additions and 18 deletions.
44 changes: 26 additions & 18 deletions src/nomad_unisyscat/schema_packages/mypackage.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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']),
Expand All @@ -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:
Expand All @@ -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):
Expand Down Expand Up @@ -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="""
Expand Down Expand Up @@ -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="""
Expand Down

0 comments on commit d767304

Please sign in to comment.