diff --git a/poetry.lock b/poetry.lock index 1d4c2832..542fd550 100644 --- a/poetry.lock +++ b/poetry.lock @@ -5157,4 +5157,4 @@ notebook = ["ipykernel", "jupyter", "jupyterlab", "jupyterlab-h5web"] [metadata] lock-version = "2.0" python-versions = ">=3.8, <3.11.9" -content-hash = "a56de044519ff5626227412da95806bf17ff5b34ed8a989d5a95a0a44b46c0af" +content-hash = "eb339ee32f618b48f031ddecf546f7f5b57c08f051abfb1c2e68576c6d95ff6b" diff --git a/pyproject.toml b/pyproject.toml index 564ee727..7881f82e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,8 +27,8 @@ numba = ">=0.55.1" numpy = ">=1.18" pandas = ">=1.4.1" psutil = ">=5.9.0" -pynxtools-mpes = ">=0.1.1" -pynxtools = ">=0.5.1" +pynxtools-mpes = "^0.2.0" +pynxtools = "^0.6.0" pyyaml = ">=6.0.0" scipy = ">=1.8.0" symmetrize = ">=0.5.5" diff --git a/sed/calibrator/energy.py b/sed/calibrator/energy.py index 2f799576..98d7cf48 100644 --- a/sed/calibrator/energy.py +++ b/sed/calibrator/energy.py @@ -953,9 +953,11 @@ def gather_calibration_metadata(self, calibration: dict = None) -> dict: metadata["applied"] = True metadata["calibration"] = deepcopy(calibration) metadata["tof"] = deepcopy(self.tof) + if metadata["tof"] is None: + metadata["tof"] = 0.0 # create empty calibrated axis entry, if it is not present. if "axis" not in metadata["calibration"]: - metadata["calibration"]["axis"] = 0 + metadata["calibration"]["axis"] = 0.0 return metadata diff --git a/sed/config/NXmpes_config.json b/sed/config/NXmpes_config.json index af065f1d..34b73ffa 100755 --- a/sed/config/NXmpes_config.json +++ b/sed/config/NXmpes_config.json @@ -1,30 +1,29 @@ { "/@default": "entry", - "/ENTRY[entry]/@default": "data", - "/ENTRY[entry]/definition": "NXmpes", - "/ENTRY[entry]/title": "@attrs:metadata/entry_title", - "/ENTRY[entry]/start_time": "@attrs:metadata/timing/acquisition_start", - "/ENTRY[entry]/experiment_institution": "Fritz Haber Institute - Max Planck Society", - "/ENTRY[entry]/experiment_facility": "Time Resolved ARPES", - "/ENTRY[entry]/experiment_laboratory": "Clean Room 4", - "/ENTRY[entry]/entry_identifier": "@attrs:metadata/entry_identifier", - "/ENTRY[entry]/end_time": "@attrs:metadata/timing/acquisition_stop", - "/ENTRY[entry]/duration": "@attrs:metadata/timing/acquisition_duration", - "/ENTRY[entry]/duration/@units": "s", - "/ENTRY[entry]/collection_time": "@attrs:metadata/timing/collection_time", - "/ENTRY[entry]/collection_time/@units": "s", - "/ENTRY[entry]/USER[user]": { - "name": "!@attrs:metadata/user0/name", - "role": "@attrs:metadata/user0/role", - "affiliation": "!@attrs:metadata/user0/affiliation", - "address": "@attrs:metadata/user0/address", - "email": "@attrs:metadata/user0/email" + "/ENTRY/@default": "data", + "/ENTRY/title": "['@eln:/ENTRY/title', '@attrs:metadata/entry_title']", + "/ENTRY/start_time": "@attrs:metadata/timing/acquisition_start", + "/ENTRY/experiment_institution": "Fritz Haber Institute - Max Planck Society", + "/ENTRY/experiment_facility": "Time Resolved ARPES", + "/ENTRY/experiment_laboratory": "Clean Room 4", + "/ENTRY/entry_identifier": "@attrs:metadata/entry_identifier", + "/ENTRY/end_time": "@attrs:metadata/timing/acquisition_stop", + "/ENTRY/duration": "@attrs:metadata/timing/acquisition_duration", + "/ENTRY/duration/@units": "s", + "/ENTRY/collection_time": "@attrs:metadata/timing/collection_time", + "/ENTRY/collection_time/@units": "s", + "/ENTRY/USER[user]": { + "name": "!['@eln:/ENTRY/User/name', '@attrs:metadata/user0/name']", + "role": "['@eln:/ENTRY/User/role', '@attrs:metadata/user0/role']", + "affiliation": "!['@eln:/ENTRY/User/affiliation', '@attrs:metadata/user0/affiliation']", + "address": "['@eln:/ENTRY/User/address', '@attrs:metadata/user0/address']", + "email": "['@eln:/ENTRY/User/email', '@attrs:metadata/user0/email']" }, - "/ENTRY[entry]/INSTRUMENT[instrument]": { + "/ENTRY/INSTRUMENT[instrument]": { "name": "Time-of-flight momentum microscope equipped delay line detector, at the endstation of the high rep-rate HHG source at FHI", "name/@short_name": "TR-ARPES @ FHI", "energy_resolution": { - "resolution": 140.0, + "resolution": "!['@eln:/ENTRY/Instrument/Analyzer/energy_resolution', '@attrs:metadata/instrument/energy_resolution']", "resolution/@units": "meV", "physical_quantity": "energy", "type": "estimated" @@ -44,37 +43,32 @@ "pressure_gauge": { "name": "sample_chamber_pressure", "measurement": "pressure", - "value": "!@attrs:metadata/file/trARPES:XGS600:PressureAC:P_RD", + "value": "!['@eln:/ENTRY/Sample/gas_pressure', '@attrs:metadata/file/trARPES:XGS600:PressureAC:P_RD']", "value/@units": "mbar" } }, - - "/ENTRY[entry]/INSTRUMENT[instrument]/ELECTRONANALYSER[electronanalyser]": { + "/ENTRY/INSTRUMENT[instrument]/ELECTRONANALYSER[electronanalyser]": { "description": "SPECS Metis 1000 Momentum Microscope", "device_information": { "vendor": "SPECS GmbH", "model": "Metis 1000 Momentum Microscope" }, - "fast_axes": [ - "kx", - "ky", - "E" - ], + "fast_axes": ["kx", "ky", "E"], "slow_axes": "@attrs:metadata/instrument/analyzer/slow_axes", "energy_resolution": { - "resolution": "!@attrs:metadata/instrument/analyzer/energy_resolution", + "resolution": "!['@eln:/ENTRY/Instrument/Analyzer/energy_resolution', '@attrs:metadata/instrument/analyzer/energy_resolution']", "resolution/@units": "meV", "physical_quantity": "energy", "type": "estimated" }, "momentum_resolution": { - "resolution": "!@attrs:metadata/instrument/analyzer/momentum_resolution", + "resolution": "!['@eln:/ENTRY/Instrument/Analyzer/momentum_resolution', '@attrs:metadata/instrument/analyzer/momentum_resolution']", "resolution/@units": "1/angstrom", "physical_quantity": "momentum", "type": "estimated" }, "spatial_resolution": { - "resolution": "!@attrs:metadata/instrument/analyzer/spatial_resolution", + "resolution": "!['@eln:/ENTRY/Instrument/Analyzer/spatial_resolution', '@attrs:metadata/instrument/analyzer/spatial_resolution']", "resolution/@units": "µm", "physical_quantity": "length", "type": "estimated" @@ -85,23 +79,15 @@ "AXISNAME[trans_z]/@depends_on": "rot_y", "AXISNAME[trans_z]/@transformation_type": "translation", "AXISNAME[trans_z]/@units": "mm", - "AXISNAME[trans_z]/@vector": [ - 0, - 0, - 1 - ], + "AXISNAME[trans_z]/@vector": [0, 0, 1], "AXISNAME[rot_y]": -115.0, "AXISNAME[rot_y]/@depends_on": ".", "AXISNAME[rot_y]/@transformation_type": "rotation", "AXISNAME[rot_y]/@units": "degrees", - "AXISNAME[rot_y]/@vector": [ - 0, - 1, - 0 - ] + "AXISNAME[rot_y]/@vector": [0, 1, 0] } }, - "/ENTRY[entry]/INSTRUMENT[instrument]/ELECTRONANALYSER[electronanalyser]/COLLECTIONCOLUMN[collectioncolumn]": { + "/ENTRY/INSTRUMENT[instrument]/ELECTRONANALYSER[electronanalyser]/COLLECTIONCOLUMN[collectioncolumn]": { "projection": "@attrs:metadata/instrument/analyzer/projection", "scheme": "@attrs:metadata/instrument/analyzer/scheme", "lens_mode": "@attrs:metadata/instrument/analyzer/lens_mode", @@ -139,20 +125,17 @@ } } }, - "/ENTRY[entry]/INSTRUMENT[instrument]/ELECTRONANALYSER[electronanalyser]/ENERGYDISPERSION[energydispersion]": { + "/ENTRY/INSTRUMENT[instrument]/ELECTRONANALYSER[electronanalyser]/ENERGYDISPERSION[energydispersion]": { "pass_energy": "@attrs:metadata/file/KTOF:Lens:TOF:V", "pass_energy/@units": "eV", "scheme": "tof", "tof_distance": 0.9, "tof_distance/@units": "m" }, - "/ENTRY[entry]/INSTRUMENT[instrument]/ELECTRONANALYSER[electronanalyser]/DETECTOR[detector]": { + "/ENTRY/INSTRUMENT[instrument]/ELECTRONANALYSER[electronanalyser]/DETECTOR[detector]": { "amplifier_type": "MCP", "detector_type": "DLD", - "sensor_pixels": [ - 1800, - 1800 - ], + "sensor_pixels": [1800, 1800], "amplifier_bias": "@attrs:metadata/file/KTOF:Lens:MCPfront:V", "amplifier_bias/@units": "V", "amplifier_voltage": "@attrs:metadata/file/KTOF:Lens:MCPback:V", @@ -160,67 +143,67 @@ "detector_voltage": "@attrs:metadata/file/KTOF:Lens:UDLD:V", "detector_voltage/@units": "V" }, - "/ENTRY[entry]/INSTRUMENT[instrument]/sourceTYPE[source_probe]": { + "/ENTRY/INSTRUMENT[instrument]/sourceTYPE[source_probe]": { "name": "HHG @ TR-ARPES @ FHI", "probe": "photon", "type": "HHG laser", "mode": "Single Bunch", - "frequency": "@attrs:metadata/instrument/beam/probe/frequency", + "frequency": "['@eln:/ENTRY/Instrument/Source/Probe/frequency', '@attrs:metadata/instrument/beam/probe/frequency']", "frequency/@units": "kHz", "associated_beam": "/entry/instrument/beam_probe" }, - "/ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_probe]": { + "/ENTRY/INSTRUMENT[instrument]/beamTYPE[beam_probe]": { "distance": 0.0, "distance/@units": "mm", - "incident_energy": "!@attrs:metadata/instrument/beam/probe/incident_energy", + "incident_energy": "!['@eln:/ENTRY/Instrument/Beam/Probe/incident_energy', '@attrs:metadata/instrument/beam/probe/incident_energy']", "incident_energy/@units": "eV", - "incident_energy_spread": "@attrs:metadata/instrument/beam/probe/incident_energy_spread", + "incident_energy_spread": "['@eln:/ENTRY/Instrument/Beam/Probe/incident_energy_spread', '@attrs:metadata/instrument/beam/probe/incident_energy_spread']", "incident_energy_spread/@units": "eV", - "pulse_duration": "@attrs:metadata/instrument/beam/probe/pulse_duration", + "pulse_duration": "['@eln:/ENTRY/Instrument/Beam/Probe/pulse_duration', '@attrs:metadata/instrument/beam/probe/pulse_duration']", "pulse_duration/@units": "fs", - "incident_polarization": "@attrs:metadata/instrument/beam/probe/incident_polarization", + "incident_polarization": "['@eln:/ENTRY/Instrument/Beam/Probe/incident_polarization', '@attrs:metadata/instrument/beam/probe/incident_polarization']", "incident_polarization/@units": "V^2/mm^2", - "extent": "@attrs:metadata/instrument/beam/probe/extent", + "extent": "['@eln:/ENTRY/Instrument/Beam/Probe/extent', '@attrs:metadata/instrument/beam/probe/extent']", "extent/@units": "µm", "associated_source": "/entry/instrument/source_probe" }, - "/ENTRY[entry]/INSTRUMENT[instrument]/sourceTYPE[source_pump]": { + "/ENTRY/INSTRUMENT[instrument]/sourceTYPE[source_pump]": { "name": "OPCPA @ TR-ARPES @ FHI", "probe": "visible light", "type": "Optical Laser", "mode": "Single Bunch", - "frequency": "@attrs:metadata/instrument/beam/pump/frequency", + "frequency": "['@eln:/ENTRY/Instrument/Source/Pump/frequency', '@attrs:metadata/instrument/beam/pump/frequency']", "frequency/@units": "kHz", "associated_beam": "/entry/instrument/beam_pump" }, - "/ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_pump]": { + "/ENTRY/INSTRUMENT[instrument]/beamTYPE[beam_pump]": { "distance": 0.0, "distance/@units": "mm", - "incident_energy": "!@attrs:metadata/instrument/beam/pump/incident_energy", + "incident_energy": "!['@eln:/ENTRY/Instrument/Beam/Pump/incident_energy', '@attrs:metadata/instrument/beam/pump/incident_energy']", "incident_energy/@units": "eV", - "incident_energy_spread": "@attrs:metadata/instrument/beam/pump/incident_energy_spread", + "incident_energy_spread": "['@eln:/ENTRY/Instrument/Beam/Pump/incident_energy_spread', '@attrs:metadata/instrument/beam/pump/incident_energy_spread']", "incident_energy_spread/@units": "eV", - "incident_wavelength": "@attrs:metadata/instrument/beam/pump/incident_wavelength", + "incident_wavelength": "['@eln:/ENTRY/Instrument/Beam/Pump/incident_wavelength', '@attrs:metadata/instrument/beam/pump/incident_wavelength']", "incident_wavelength/@units": "nm", - "pulse_duration": "@attrs:metadata/instrument/beam/pump/pulse_duration", + "pulse_duration": "['@eln:/ENTRY/Instrument/Beam/Pump/pulse_duration', '@attrs:metadata/instrument/beam/pump/pulse_duration']", "pulse_duration/@units": "fs", - "incident_polarization": "@attrs:metadata/instrument/beam/pump/incident_polarization", + "incident_polarization": "['@eln:/ENTRY/Instrument/Beam/Pump/incident_polarization', '@attrs:metadata/instrument/beam/pump/incident_polarization']", "incident_polarization/@units": "V^2/mm^2", - "pulse_energy": "@attrs:metadata/instrument/beam/pump/pulse_energy", + "pulse_energy": "['@eln:/ENTRY/Instrument/Beam/Pump/pulse_energy', '@attrs:metadata/instrument/beam/pump/pulse_energy']", "pulse_energy/@units": "µJ", - "average_power": "@attrs:metadata/instrument/beam/pump/average_power", + "average_power": "['@eln:/ENTRY/Instrument/Beam/Pump/average_power', '@attrs:metadata/instrument/beam/pump/average_power']", "average_power/@units": "mW", - "extent": "@attrs:metadata/instrument/beam/pump/extent", + "extent": "['@eln:/ENTRY/Instrument/Beam/Pump/extent', '@attrs:metadata/instrument/beam/pump/extent']", "extent/@units": "µm", - "fluence": "@attrs:metadata/instrument/beam/pump/fluence", + "fluence": "['@eln:/ENTRY/Instrument/Beam/Pump/fluence', '@attrs:metadata/instrument/beam/pump/fluence']", "fluence/@units": "mJ/cm^2", "associated_source": "/entry/instrument/source_pump" }, - "/ENTRY[entry]/INSTRUMENT[instrument]/MANIPULATOR[manipulator]": { + "/ENTRY/INSTRUMENT[instrument]/MANIPULATOR[manipulator]": { "temperature_sensor": { "name": "sample_temperature", "measurement": "temperature", - "value": "!@attrs:metadata/file/trARPES:Carving:TEMP_RBV", + "value": "!['@eln:/ENTRY/Instrument/Manipulator/sample_temperature', '@attrs:metadata/file/trARPES:Carving:TEMP_RBV']", "value/@units": "K" }, "sample_bias_voltmeter": { @@ -235,38 +218,26 @@ "AXISNAME[trans_z]/@depends_on": "rot_z", "AXISNAME[trans_z]/@transformation_type": "translation", "AXISNAME[trans_z]/@units": "m", - "AXISNAME[trans_z]/@vector": [ - 0, - 0, - 1 - ], + "AXISNAME[trans_z]/@vector": [0, 0, 1], "AXISNAME[rot_z]/@depends_on": "rot_x", "AXISNAME[rot_z]": -25.0, "AXISNAME[rot_z]/@transformation_type": "rotation", "AXISNAME[rot_z]/@units": "degrees", - "AXISNAME[rot_z]/@vector": [ - 0, - 0, - 1 - ], + "AXISNAME[rot_z]/@vector": [0, 0, 1], "AXISNAME[rot_x]/@depends_on": ".", "AXISNAME[rot_x]": -90.0, "AXISNAME[rot_x]/@transformation_type": "rotation", "AXISNAME[rot_x]/@units": "degrees", - "AXISNAME[rot_x]/@vector": [ - 1, - 0, - 0 - ] + "AXISNAME[rot_x]/@vector": [1, 0, 0] } }, - "/ENTRY[entry]/SAMPLE[sample]": { - "preparation_date": "@attrs:metadata/sample/preparation_date", - "history/notes/description": "@attrs:metadata/sample/sample_history", - "description": "@attrs:metadata/sample/chemical_formula", - "name": "@attrs:metadata/sample/name", + "/ENTRY/SAMPLE[sample]": { + "preparation_date": "['@eln:/ENTRY/Sample/preparation_date', '@attrs:metadata/sample/preparation_date']", + "history/notes/description": "['@eln:/ENTRY/Sample/sample_history', '@attrs:metadata/sample/sample_history']", + "description": "['@eln:/ENTRY/Sample/description', '@attrs:metadata/sample/chemical_formula']", + "name": "['@eln:/ENTRY/Sample/name', '@attrs:metadata/sample/name']", "situation": "vacuum", - "SUBSTANCE[substance]/molecular_formula_hill": "@attrs:metadata/sample/chemical_formula", + "SUBSTANCE[substance]/molecular_formula_hill": "['@eln:/ENTRY/Sample/chemical_formula', '@attrs:metadata/sample/chemical_formula']", "temperature_env": { "temperature_sensor": "@link:/entry/instrument/manipulator/temperature_sensor" }, @@ -282,115 +253,59 @@ "AXISNAME[corrected_phi]": 90.0, "AXISNAME[corrected_phi]/@units": "degrees", "AXISNAME[corrected_phi]/@transformation_type": "rotation", - "AXISNAME[corrected_phi]/@vector": [ - 0, - 1, - 0 - ], + "AXISNAME[corrected_phi]/@vector": [0, 1, 0], "AXISNAME[rot_omg]/@depends_on": "rot_phi", "AXISNAME[rot_omg]": "@attrs:metadata/file/trARPES:Carving:OMG.RBV", "AXISNAME[rot_omg]/@units": "degrees", "AXISNAME[rot_omg]/@transformation_type": "rotation", - "AXISNAME[rot_omg]/@vector": [ - 1, - 0, - 0 - ], + "AXISNAME[rot_omg]/@vector": [1, 0, 0], "AXISNAME[rot_phi]/@depends_on": "rot_tht", "AXISNAME[rot_phi]": "@attrs:metadata/file/trARPES:Carving:PHI.RBV", "AXISNAME[rot_phi]/@units": "degrees", "AXISNAME[rot_phi]/@transformation_type": "rotation", - "AXISNAME[rot_phi]/@vector": [ - 0, - 1, - 0 - ], + "AXISNAME[rot_phi]/@vector": [0, 1, 0], "AXISNAME[rot_tht]/@depends_on": "trans_z", "AXISNAME[rot_tht]": "@attrs:metadata/file/trARPES:Carving:THT.RBV", "AXISNAME[rot_tht]/@units": "degrees", "AXISNAME[rot_tht]/@transformation_type": "rotation", - "AXISNAME[rot_tht]/@vector": [ - 0, - 0, - 1 - ], + "AXISNAME[rot_tht]/@vector": [0, 0, 1], "AXISNAME[trans_z]/@depends_on": "trans_y", "AXISNAME[trans_z]": "@attrs:metadata/file/trARPES:Carving:TRZ.RBV", "AXISNAME[trans_z]/@units": "mm", "AXISNAME[trans_z]/@transformation_type": "translation", - "AXISNAME[trans_z]/@vector": [ - 0, - 0, - 1 - ], + "AXISNAME[trans_z]/@vector": [0, 0, 1], "AXISNAME[trans_y]/@depends_on": "trans_x", "AXISNAME[trans_y]": "@attrs:metadata/file/trARPES:Carving:TRY.RBV", "AXISNAME[trans_y]/@units": "mm", "AXISNAME[trans_y]/@transformation_type": "translation", - "AXISNAME[trans_y]/@vector": [ - 0, - 1, - 0 - ], + "AXISNAME[trans_y]/@vector": [0, 1, 0], "AXISNAME[trans_x]/@depends_on": "/entry/instrument/manipulator/transformations/trans_z", "AXISNAME[trans_x]": "@attrs:metadata/file/trARPES:Carving:TRX.RBV", "AXISNAME[trans_x]/@units": "mm", "AXISNAME[trans_x]/@transformation_type": "translation", - "AXISNAME[trans_x]/@vector": [ - 1, - 0, - 0 - ] + "AXISNAME[trans_x]/@vector": [0, 1, 0] } }, - "/ENTRY[entry]/PROCESS[process]/DISTORTION[distortion]": { - "symmetry": "@attrs:metadata/momentum_correction/correction/rotation_symmetry", - "original_centre": "@attrs:metadata/momentum_correction/correction/center_point", - "original_points": "@attrs:metadata/momentum_correction/correction/outer_points", - "cdeform_field": "@attrs:metadata/momentum_correction/correction/cdeform_field", - "rdeform_field": "@attrs:metadata/momentum_correction/correction/rdeform_field" - }, - "/ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]": { - "depends_on": "@attrs:metadata/momentum_correction/registration/depends_on", - "TRANSFORMATIONS[transformations]": { - "AXISNAME[trans_x]": "@attrs:metadata/momentum_correction/registration/trans_x/value", - "AXISNAME[trans_x]/@transformation_type": "@attrs:metadata/momentum_correction/registration/trans_x/type", - "AXISNAME[trans_x]/@units": "@attrs:metadata/momentum_correction/registration/trans_x/units", - "AXISNAME[trans_x]/@vector": "@attrs:metadata/momentum_correction/registration/trans_x/vector", - "AXISNAME[trans_x]/@depends_on": "@attrs:metadata/momentum_correction/registration/trans_x/depends_on", - "AXISNAME[trans_y]": "@attrs:metadata/momentum_correction/registration/trans_y/value", - "AXISNAME[trans_y]/@units": "@attrs:metadata/momentum_correction/registration/trans_y/units", - "AXISNAME[trans_y]/@transformation_type": "@attrs:metadata/momentum_correction/registration/trans_y/type", - "AXISNAME[trans_y]/@vector": "@attrs:metadata/momentum_correction/registration/trans_y/vector", - "AXISNAME[trans_y]/@depends_on": "@attrs:metadata/momentum_correction/registration/trans_y/depends_on", - "AXISNAME[rot_z]": "@attrs:metadata/momentum_correction/registration/rot_z/value", - "AXISNAME[rot_z]/@units": "@attrs:metadata/momentum_correction/registration/rot_z/units", - "AXISNAME[rot_z]/@transformation_type": "@attrs:metadata/momentum_correction/registration/rot_z/type", - "AXISNAME[rot_z]/@offset": "@attrs:metadata/momentum_correction/registration/rot_z/offset", - "AXISNAME[rot_z]/@vector": "@attrs:metadata/momentum_correction/registration/rot_z/vector", - "AXISNAME[rot_z]/@depends_on": "@attrs:metadata/momentum_correction/registration/rot_z/depends_on" - } - }, - "/ENTRY[entry]/PROCESS_MPES[process]/energy_calibration":{ + "/ENTRY/PROCESS_MPES[process]/energy_calibration":{ "coefficients": "@attrs:metadata/energy_calibration/calibration/coefficients", "fit_function": "@attrs:metadata/energy_calibration/calibration/fit_function", "original_axis": "@attrs:metadata/energy_calibration/tof", "calibrated_axis": "@attrs:metadata/energy_calibration/calibration/axis", "calibrated_axis/@units": "eV" }, - "/ENTRY[entry]/PROCESS_MPES[process]/kx_calibration": { + "/ENTRY/PROCESS_MPES[process]/kx_calibration": { "scaling": "@attrs:metadata/momentum_calibration/calibration/kx_scale", "offset": "@attrs:metadata/momentum_calibration/calibration/x_center", "calibrated_axis": "@attrs:metadata/momentum_calibration/calibration/kx_axis", "calibrated_axis/@units": "Angstrom^-1" }, - "/ENTRY[entry]/PROCESS_MPES[process]/ky_calibration": { + "/ENTRY/PROCESS_MPES[process]/ky_calibration": { "scaling": "@attrs:metadata/momentum_calibration/calibration/ky_scale", "offset": "@attrs:metadata/momentum_calibration/calibration/y_center", "calibrated_axis": "@attrs:metadata/momentum_calibration/calibration/ky_axis", "calibrated_axis/@units": "Angstrom^-1" }, - "/ENTRY[entry]/data": { + "/ENTRY/data": { "@axes": "@data:dims", "AXISNAME_indices[@*_indices]": "@data:*.index", "@signal": "data", diff --git a/tests/test_processor.py b/tests/test_processor.py index fd9899b2..9b9e332d 100644 --- a/tests/test_processor.py +++ b/tests/test_processor.py @@ -3,6 +3,7 @@ import csv import glob import itertools +import json import logging import os import tempfile @@ -1011,6 +1012,7 @@ def test_get_normalization_histogram() -> None: metadata["user0"]["affiliation"] = "affiliation" # instrument metadata["instrument"] = {} +metadata["instrument"]["energy_resolution"] = 150.0 # analyzer metadata["instrument"]["analyzer"] = {} metadata["instrument"]["analyzer"]["energy_resolution"] = 110.0 @@ -1085,21 +1087,33 @@ def test_save(caplog) -> None: caplog.clear() with open("temp_eln.yaml", "w") as f: yaml.dump({"Instrument": {"undocumented_field": "undocumented entry"}}, f) + with open("temp_config.json", "w") as f: + with open( + df_folder + "../../../../sed/config/NXmpes_config.json", + encoding="utf-8", + ) as stream: + config_dict = json.load(stream) + config_dict[ + "/ENTRY[entry]/INSTRUMENT[instrument]/undocumented_field" + ] = "@eln:/ENTRY/Instrument/undocumented_field" + json.dump(config_dict, f, indent=2) with caplog.at_level(logging.WARNING): processor.save( "result.nxs", - input_files=[df_folder + "../../../../sed/config/NXmpes_config.json"], + input_files=["temp_config.json"], eln_data="temp_eln.yaml", + suppress_warning=True, ) assert ( caplog.messages[0] - == "The data entry corresponding to /ENTRY[entry]/SAMPLE[sample]/name is required and " - "hasn't been supplied by the reader." + == "WARNING: The data entry corresponding to /ENTRY[entry]/SAMPLE[sample]/name is " + "required and hasn't been supplied by the reader." ) assert ( caplog.messages[1] - == "Field /ENTRY[entry]/INSTRUMENT[instrument]/undocumented_field written without " - "documentation." + == "WARNING: Field /ENTRY[entry]/INSTRUMENT[instrument]/undocumented_field written " + "without documentation." ) os.remove("output.nxs") os.remove("temp_eln.yaml") + os.remove("temp_config.json") diff --git a/tutorial/3_metadata_collection_and_export_to_NeXus.ipynb b/tutorial/3_metadata_collection_and_export_to_NeXus.ipynb index 42fede36..800e5836 100644 --- a/tutorial/3_metadata_collection_and_export_to_NeXus.ipynb +++ b/tutorial/3_metadata_collection_and_export_to_NeXus.ipynb @@ -75,6 +75,7 @@ "\n", "#NXinstrument\n", "metadata['instrument'] = {}\n", + "metadata['instrument']['energy_resolution'] = 140.\n", "#analyzer\n", "metadata['instrument']['analyzer']={}\n", "metadata['instrument']['analyzer']['slow_axes'] = \"delay\" # the scanned axes\n",