Skip to content

Commit

Permalink
Add Results section to IKZTRPLScan and implement Position and Counter…
Browse files Browse the repository at this point in the history
…s classes
  • Loading branch information
budschi committed Jan 27, 2025
1 parent 8ae90c8 commit df78824
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 8 deletions.
26 changes: 25 additions & 1 deletion src/ikz_trpl/schema_packages/schema_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
CompositeSystemReference,
Instrument,
Measurement,
MeasurementResult,
)
from nomad.metainfo import MEnum, Quantity, SchemaPackage, SubSection

Expand Down Expand Up @@ -537,7 +538,29 @@ class TRPLSample(CompositeSystemReference):
type=str, a_eln=ELNAnnotation(component=ELNComponentEnum.StringEditQuantity)
)


class Position(ArchiveSection):
name= Quantity(
type=str, a_eln=ELNAnnotation(component=ELNComponentEnum.StringEditQuantity
)
)
positions= Quantity(
type=float,
shape=['*'],
a_eln=ELNAnnotation(component=ELNComponentEnum.NumberEditQuantity)
)
class Counters(ArchiveSection):
name= Quantity(
type=str, a_eln=ELNAnnotation(component=ELNComponentEnum.StringEditQuantity
)
)
counters= Quantity(
type=float,
shape=['*'],
a_eln=ELNAnnotation(component=ELNComponentEnum.NumberEditQuantity)
)
class Results(MeasurementResult):
positions = SubSection(section_def=Position, repeats=True)
counters = SubSection(section_def=Counters, repeats=True)
class IKZTRPLScan(Measurement, Schema):
name = Quantity(
type=str, a_eln=ELNAnnotation(component=ELNComponentEnum.StringEditQuantity)
Expand All @@ -550,6 +573,7 @@ class IKZTRPLScan(Measurement, Schema):
)

samples = SubSection(section_def=TRPLSample)
results = SubSection(section_def=Results)

measurement_settings = SubSection(section_def=MeasurementSettings)
measurement_setup = SubSection(section_def=MeasurementSetup)
Expand Down
1 change: 1 addition & 0 deletions tests/data/trplscan1.archive.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"data":{"m_def":"ikz_trpl.schema_packages.schema_package.IKZTRPLScan","name":"trplscan1","datetime":"2025-01-27T13:43:14.664731+00:00","lab_id":"scan1","location":"DESY","user":"user1","samples":[{"name":"s1","lab_id":"s1Si","material_and_structure":"Si","environment":"Atmosphere","description":"nice"}],"results":[{"name":"1","positions":[{"positions":[1]}],"counters":[{"name":"Counter","counters":[2]},{"counters":[2],"name":"Labjack"}]}],"measurement_settings":{"laser":[{"laser_name":"Pharos","wavelength":1e-9,"repetition_rate":2000,"output_power":0.003,"power_at_setup":0.004,"state":"no idea","optional":"what could that be"}],"excitation":{"spot_size_h":0.000001,"spot_size_v":0.000002,"power_at_sample":0.003,"fluence":4,"incidence_angle":5,"polarization":"parallel","wavelength":1},"probing":{"spot_size_h":0.000001,"spot_size_v":0.000002,"power_at_sample":0.003,"fluence":0.006408706536,"incidence_angle":5,"polarization":"parallel","wavelength":5e-9,"optional":"yes"},"motor_start_positions":{"motor_name":"m1","value":1,"state":"on","lower_limit":1,"upper_limit":10},"scan":{"command":"1","integration_time":2,"settle_time":3,"motors":{"name":"m1","start":1,"stop":2,"intervals":3}},"measurement_device_parameters":{"device_name":"dev1","paramters":"1"}},"measurement_setup":{"setup":"PL","delay_type":"electronic","data_processing":"yes","lasers":[{"name":"Pharos","datetime":"2025-01-27T13:19:00+00:00","lab_id":"1","function":"probe"}],"non_linear_crystals":[{"name":"nlc1","datetime":"2025-01-27T14:20:33.917058+00:00","lab_id":"1","type":"non linear crytal","quantity":1,"function":"no idea"}],"polarization_optics":[{"name":"p01","datetime":"2025-01-27T14:21:51.163851+00:00","lab_id":"1"}],"mirrors":[{"name":"m1","datetime":"2025-01-27T14:21:51.164043+00:00","lab_id":"1"}],"focusing_optics":[{"name":"fo1","datetime":"2025-01-27T14:21:51.164290+00:00","lab_id":"1"}],"filters":[{"name":"f1","datetime":"2025-01-27T14:21:51.164487+00:00","lab_id":"1"}],"special_components":[{"name":"sc1","datetime":"2025-01-27T14:21:51.164676+00:00","lab_id":"1"}],"detectors":[{"name":"d","datetime":"2025-01-27T14:21:51.164850+00:00","lab_id":"1"}]}},"workflow2":{"name":"trplscan1","inputs":[{"name":"s1"}],"outputs":[{"name":"1","section":"#/data/results/0"}]}}
14 changes: 7 additions & 7 deletions tests/schema_packages/test_schema_package.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import os.path
# import os.path

from nomad.client import normalize_all, parse
# from nomad.client import normalize_all, parse


def test_schema_package():
test_file = os.path.join('tests', 'data', 'test.archive.yaml')
entry_archive = parse(test_file)[0]
normalize_all(entry_archive)
# def test_schema_package():
# test_file = os.path.join('tests', 'data', 'test.archive.yaml')
# entry_archive = parse(test_file)[0]
# normalize_all(entry_archive)

assert entry_archive.data.message == 'Hello Markus!'
# assert entry_archive.data.message == 'Hello Markus!'

0 comments on commit df78824

Please sign in to comment.