Skip to content

Commit

Permalink
Merge pull request #44 from OpenCOMPES/fixes-for-nxmpes-arpes
Browse files Browse the repository at this point in the history
Update example to use NXmpes_arpes
  • Loading branch information
rettigl authored Jul 13, 2024
2 parents 7f9bc91 + d29f68c commit a7a570a
Show file tree
Hide file tree
Showing 6 changed files with 214 additions and 210 deletions.
373 changes: 187 additions & 186 deletions poetry.lock

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,11 @@ ipywidgets = ">=7.7.1"
matplotlib = ">=3.5.1"
numpy = ">=1.21.6"
opencv-python = ">=4.8.1.78"
pynxtools-mpes = ">=0.0.1"
pynxtools = ">=0.3.1"
pynxtools-mpes = ">=0.1.1"
pynxtools = ">=0.5.0"
python-dateutil = ">=2.8.2"
pyyaml = ">=6.0"
xarray = ">=0.20.2"
setuptools = ">50"
tifffile = ">=2022.5.4"
tqdm = ">=4.62.3"
scipy = ">=1.8.0"
Expand Down
31 changes: 15 additions & 16 deletions specsscan/config/NXmpes_arpes_config.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"/@default": "entry",
"/ENTRY[entry]/@default": "data",
"/ENTRY[entry]/definition": "NXmpes",
"/ENTRY[entry]/definition/@version": "None",
"/ENTRY[entry]/definition": "NXmpes_arpes",
"/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",
Expand All @@ -15,9 +14,9 @@
"/ENTRY[entry]/collection_time": "@attrs:metadata/timing/collection_time",
"/ENTRY[entry]/collection_time/@units": "s",
"/ENTRY[entry]/USER[user]": {
"name": "@attrs:metadata/user0/name",
"name": "!@attrs:metadata/user0/name",
"role": "@attrs:metadata/user0/role",
"affiliation": "@attrs:metadata/user0/affiliation",
"affiliation": "!@attrs:metadata/user0/affiliation",
"address": "@attrs:metadata/user0/address",
"email": "@attrs:metadata/user0/email"
},
Expand Down Expand Up @@ -70,19 +69,19 @@
"fast_axes": "@attrs:metadata/scan_info/fast_axes",
"slow_axes": "@attrs:metadata/scan_info/slow_axes",
"energy_resolution": {
"resolution": "@attrs:metadata/instrument/electronanalyser/energy_resolution",
"resolution": "!@attrs:metadata/instrument/electronanalyser/energy_resolution",
"resolution/@units": "meV",
"physical_quantity": "energy",
"type": "derived"
},
"angular_resolution": {
"resolution": "@attrs:metadata/instrument/electronanalyser/angular_resolution",
"resolution": "!@attrs:metadata/instrument/electronanalyser/angular_resolution",
"resolution/@units": "deg",
"physical_quantity": "angle",
"type": "derived"
},
"spatial_resolution": {
"resolution": "@attrs:metadata/instrument/electronanalyser/spatial_resolution",
"resolution": "!@attrs:metadata/instrument/electronanalyser/spatial_resolution",
"resolution/@units": "µm",
"physical_quantity": "length",
"type": "estimated"
Expand Down Expand Up @@ -135,7 +134,7 @@
"diameter": 300.0,
"diameter/@units": "mm",
"entrance_slit": {
"shape": "curved",
"shape": "curved slit",
"size": 1.0,
"size/@units": "mm"
},
Expand Down Expand Up @@ -169,7 +168,7 @@
"/ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_probe]": {
"distance": 0.0,
"distance/@units": "mm",
"incident_energy": "@attrs:metadata/instrument/beam/probe/incident_energy",
"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/@units": "eV",
Expand All @@ -193,7 +192,7 @@
"/ENTRY[entry]/INSTRUMENT[instrument]/beamTYPE[beam_pump]": {
"distance": 0.0,
"distance/@units": "mm",
"incident_energy": "@attrs:metadata/instrument/beam/pump/incident_energy",
"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/@units": "eV",
Expand All @@ -217,7 +216,7 @@
"temperature_sensor": {
"name": "sample_temperature",
"measurement": "temperature",
"value": "@attrs:metadata/scan_info/trARPES:Carving:TEMP_RBV",
"value": "!@attrs:metadata/scan_info/trARPES:Carving:TEMP_RBV",
"value/@units": "K"
},
"sample_bias_voltmeter": {
Expand All @@ -229,7 +228,7 @@
"drain_current_amperemeter": {
"name": "drain_current",
"measurement": "current",
"value": "@attrs:metadata/scan_info/trARPES:Sample:Measure",
"value": "!@attrs:metadata/scan_info/trARPES:Sample:Measure",
"value/@units": "A"
},
"depends_on": "/entry/instrument/manipulator/transformations/trans_z",
Expand Down Expand Up @@ -337,13 +336,13 @@
},
"/ENTRY[entry]/data": {
"@axes": "@data:dims",
"AXISNAME_indices[@*_indices]": "@data:*.index",
"@*_indices": "@data:*.index",
"@signal": "data",
"data": "@data:data",
"data/@units": "counts",
"AXISNAME[*]": "@data:*.data",
"AXISNAME[*]/@units": "@data:*.unit",
"AXISNAME_depends[@*_depends]": "@attrs:metadata/scan_info/coordinate_depends/*",
"*": "@data:*.data",
"*/@units": "@data:*.unit",
"@*_depends": "@attrs:metadata/scan_info/coordinate_depends/*",
"energy/@type": "kinetic"
}
}
2 changes: 1 addition & 1 deletion specsscan/config/example_config_FHI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ nexus:
# the reader to use
reader: "mpes"
# the NeXus definition to use
definition: "NXmpes"
definition: "NXmpes_arpes"
# additional input files, e.g. config and ELN files
input_files: ["../specsscan/config/NXmpes_arpes_config.json"]

Expand Down
11 changes: 8 additions & 3 deletions tests/test_specsscan.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import numpy as np
import pytest
from pynxtools.dataconverter.convert import ValidationFailed

import specsscan
from specsanalyzer.core import create_fft_params
Expand Down Expand Up @@ -323,8 +324,8 @@ def test_conversion_and_save_to_nexus():
sps.save("result.tiff")
sps.save("result.tiff", alias_dict={"X": "angular0", "Y": "angular1"})
sps.save("result.h5")
# with pytest.raises(LookupError):
# sps.save("result.nxs")
with pytest.raises(ValidationFailed):
sps.save("result.nxs", fail=True)

metadata = {}
# General
Expand All @@ -345,6 +346,10 @@ def test_conversion_and_save_to_nexus():
metadata["instrument"]["beam"]["probe"] = {}
metadata["instrument"]["beam"]["probe"]["incident_energy"] = 21.7

# sample
metadata["sample"] = {}
metadata["sample"]["name"] = "Name"

metadata["scan_info"] = {}
metadata["scan_info"]["trARPES:XGS600:PressureAC:P_RD"] = 2.5e-11
metadata["scan_info"]["trARPES:Carving:TEMP_RBV"] = 70
Expand All @@ -357,4 +362,4 @@ def test_conversion_and_save_to_nexus():
collect_metadata=True,
)

sps.save("result.nxs")
sps.save("result.nxs", fail=True)
2 changes: 1 addition & 1 deletion tutorial/3_specsscan_conversion_to_NeXus.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
},
"outputs": [],
"source": [
"config = {\"nexus\":{\"definition\": \"NXmpes\"}, \"spa_params\":{\"crop\":True, \"ek_range_min\":0.07597844332538181, \"ek_range_max\":0.9117413199045858, \"ang_range_min\":0.16453159041394336, \"ang_range_max\":0.8840087145969499,}}\n",
"config = {\"nexus\":{\"definition\": \"NXmpes_arpes\"}, \"spa_params\":{\"crop\":True, \"ek_range_min\":0.07597844332538181, \"ek_range_max\":0.9117413199045858, \"ang_range_min\":0.16453159041394336, \"ang_range_max\":0.8840087145969499,}}\n",
"sps = SpecsScan(config=config, user_config=\"../specsscan/config/example_config_FHI.yaml\")\n",
"path = \"../tests/data/\" # Path to the test data set"
]
Expand Down

0 comments on commit a7a570a

Please sign in to comment.