Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ dependencies = [
"numpy>=1.21.6",
"opencv-python>=4.8.1.78",
"pynxtools-mpes>=0.2.2",
"pynxtools>=0.10.1",
"pynxtools>=0.10.6",
"python-dateutil>=2.8.2",
"pyyaml>=6.0",
"xarray>=0.20.2",
Expand Down
126 changes: 61 additions & 65 deletions src/specsscan/config/NXmpes_arpes_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"/ENTRY/experiment_institution": "Fritz Haber Institute - Max Planck Society",
"/ENTRY/experiment_facility": "Time Resolved ARPES",
"/ENTRY/experiment_laboratory": "Clean Room 4",
"/ENTRY/identifierNAME[entry_identifier]": "@attrs:metadata/loader/scan_path",
"/ENTRY/identifierNAME[identifier_entry]": "@attrs:metadata/loader/scan_path",
"/ENTRY/end_time": "@attrs:metadata/timing/acquisition_stop",
"/ENTRY/duration": "@attrs:metadata/timing/acquisition_duration",
"/ENTRY/duration/@units": "s",
Expand Down Expand Up @@ -39,17 +39,13 @@
"type": "estimated"
},
"RESOLUTION[temporal_resolution]": {
"resolution": "!['@attrs:metadata/elabFTW/laser_status/temporal_resolution', '35.0']",
"resolution/@units": "fs",
"resolution": "!['@eln:/ENTRY/Instrument/temporal_resolution', '@attrs:metadata/instrument/temporal_resolution', '@attrs:metadata/elabFTW/laser_status/temporal_resolution']",
"resolution/@units": "['@eln:/ENTRY/Instrument/temporal_resolution/@units', 'fs']",
"physical_quantity": "time",
"type": "estimated"
},
"RESOLUTION[angular_resolution]": {
"resolution": "@link:/entry/instrument/electronanalyzer/angular_resolution/resolution",
"resolution/@units": "deg",
"physical_quantity": "angle",
"type": "derived"
},
"RESOLUTION[angular_resolution]": "@link:/entry/instrument/electronanalyzer/angular_resolution",
"RESOLUTION[spatial_resolution]": "@link:/entry/instrument/electronanalyzer/spatial_resolution",
"pressure_gauge": {
"name": "sample_chamber_pressure",
"measurement": "pressure",
Expand Down Expand Up @@ -91,21 +87,21 @@
"AXISNAME[trans_z]/@transformation_type": "translation",
"AXISNAME[trans_z]/@units": "mm",
"AXISNAME[trans_z]/@vector": [0, 0, 1],
"analyzer_dispersion/@depends_on": "analyzer_rotation",
"analyzer_dispersion": "@data:angular1.data",
"analyzer_dispersion/@transformation_type": "rotation",
"analyzer_dispersion/@units": "degrees",
"analyzer_dispersion/@vector": [1, 0, 0],
"analyzer_elevation/@depends_on": "analyzer_dispersion",
"analyzer_elevation": 0,
"analyzer_elevation/@transformation_type": "rotation",
"analyzer_elevation/@units": "degrees",
"analyzer_elevation/@vector": [0, 1, 0],
"analyzer_rotation/@depends_on": "rot_y",
"analyzer_rotation": 0,
"analyzer_rotation/@transformation_type": "rotation",
"analyzer_rotation/@units": "degrees",
"analyzer_rotation/@vector": [0, 0, 1],
"AXISNAME[analyzer_dispersion]/@depends_on": "analyzer_rotation",
"AXISNAME[analyzer_dispersion]": "@data:angular0.data",
"AXISNAME[analyzer_dispersion]/@transformation_type": "rotation",
"AXISNAME[analyzer_dispersion]/@units": "degrees",
"AXISNAME[analyzer_dispersion]/@vector": [1, 0, 0],
"AXISNAME[analyzer_elevation]/@depends_on": "analyzer_dispersion",
"AXISNAME[analyzer_elevation]": 0,
"AXISNAME[analyzer_elevation]/@transformation_type": "rotation",
"AXISNAME[analyzer_elevation]/@units": "degrees",
"AXISNAME[analyzer_elevation]/@vector": [0, 1, 0],
"AXISNAME[analyzer_rotation]/@depends_on": "rot_y",
"AXISNAME[analyzer_rotation]": 0,
"AXISNAME[analyzer_rotation]/@transformation_type": "rotation",
"AXISNAME[analyzer_rotation]/@units": "degrees",
"AXISNAME[analyzer_rotation]/@vector": [0, 0, 1],
"AXISNAME[rot_y]/@depends_on": ".",
"AXISNAME[rot_y]": 140.0,
"AXISNAME[rot_y]/@transformation_type": "rotation",
Expand Down Expand Up @@ -266,38 +262,38 @@
"drain_current_env": {
"ammeter": "@link:/entry/instrument/manipulator/drain_current_ammeter"
},
"depends_on": "/entry/sample/transformations/offset_azimuth",
"depends_on": "/entry/sample/transformations/sample_azimuth",
"TRANSFORMATIONS[transformations]": {
"offset_azimuth/@depends_on": "sample_azimuth",
"offset_azimuth": 0,
"offset_azimuth/@units": "degrees",
"offset_azimuth/@transformation_type": "rotation",
"offset_azimuth/@vector": [0, 0, 1],
"sample_azimuth/@depends_on": "offset_tilt",
"sample_azimuth": "@attrs:metadata/scan_info/trARPES:Carving:OMG.RBV",
"sample_azimuth/@units": "degrees",
"sample_azimuth/@transformation_type": "rotation",
"sample_azimuth/@vector": [0, 0, 1],
"offset_tilt/@depends_on": "sample_tilt",
"offset_tilt": 0,
"offset_tilt/@units": "degrees",
"offset_tilt/@transformation_type": "rotation",
"offset_tilt/@vector": [1, 0, 0],
"sample_tilt/@depends_on": "offset_polar",
"sample_tilt": "@attrs:metadata/scan_info/trARPES:Carving:PHI.RBV",
"sample_tilt/@units": "degrees",
"sample_tilt/@transformation_type": "rotation",
"sample_tilt/@vector": [1, 0, 0],
"offset_polar/@depends_on": "sample_polar",
"offset_polar": -9,
"offset_polar/@units": "degrees",
"offset_polar/@transformation_type": "rotation",
"offset_polar/@vector": [0, 1, 0],
"sample_polar/@depends_on": "yz_flip",
"sample_polar": "@attrs:metadata/scan_info/trARPES:Carving:THT.RBV",
"sample_polar/@units": "degrees",
"sample_polar/@transformation_type": "rotation",
"sample_polar/@vector": [0, 1, 0],
"AXISNAME[offset_azimuth]/@depends_on": "sample_tilt",
"AXISNAME[offset_azimuth]": 0,
"AXISNAME[offset_azimuth]/@units": "degrees",
"AXISNAME[offset_azimuth]/@transformation_type": "rotation",
"AXISNAME[offset_azimuth]/@vector": [0, 0, 1],
"AXISNAME[sample_azimuth]/@depends_on": "offset_azimuth",
"AXISNAME[sample_azimuth]": "@attrs:metadata/scan_info/trARPES:Carving:OMG.RBV",
"AXISNAME[sample_azimuth]/@units": "degrees",
"AXISNAME[sample_azimuth]/@transformation_type": "rotation",
"AXISNAME[sample_azimuth]/@vector": [0, 0, 1],
"AXISNAME[offset_tilt]/@depends_on": "sample_polar",
"AXISNAME[offset_tilt]": 0,
"AXISNAME[offset_tilt]/@units": "degrees",
"AXISNAME[offset_tilt]/@transformation_type": "rotation",
"AXISNAME[offset_tilt]/@vector": [1, 0, 0],
"AXISNAME[sample_tilt]/@depends_on": "offset_tilt",
"AXISNAME[sample_tilt]": "@attrs:metadata/scan_info/trARPES:Carving:PHI.RBV",
"AXISNAME[sample_tilt]/@units": "degrees",
"AXISNAME[sample_tilt]/@transformation_type": "rotation",
"AXISNAME[sample_tilt]/@vector": [1, 0, 0],
"AXISNAME[offset_polar]/@depends_on": "yz_flip",
"AXISNAME[offset_polar]": -9,
"AXISNAME[offset_polar]/@units": "degrees",
"AXISNAME[offset_polar]/@transformation_type": "rotation",
"AXISNAME[offset_polar]/@vector": [0, 1, 0],
"AXISNAME[sample_polar]/@depends_on": "offset_polar",
"AXISNAME[sample_polar]": "@attrs:metadata/scan_info/trARPES:Carving:THT.RBV",
"AXISNAME[sample_polar]/@units": "degrees",
"AXISNAME[sample_polar]/@transformation_type": "rotation",
"AXISNAME[sample_polar]/@vector": [0, 1, 0],
"AXISNAME[yz_flip]/@depends_on": "xy_adjust",
"AXISNAME[yz_flip]": 90.0,
"AXISNAME[yz_flip]/@units": "degrees",
Expand Down Expand Up @@ -332,7 +328,7 @@
"calibrated_axis/@units": "energy",
"physical_quantity": "energy",
"PARAMETERS[conversion_parameters]":{
"TERM[*{apply_fft_filter,binning,rotation_angle,lens_mode,kinetic_energy,pass_energy,work_function,a_inner,da_matrix,retardation_ratio,source,dims,e_shift,de1,e_range,a_range,pixel_size,magnification,angle_offset_px,energy_offset_px}]": "@attrs:metadata/conversion_parameters/*"
"PARAMETER[*{apply_fft_filter,binning,rotation_angle,lens_mode,kinetic_energy,pass_energy,work_function,a_inner,da_matrix,retardation_ratio,source,dims,e_shift,de1,e_range,a_range,pixel_size,magnification,angle_offset_px,energy_offset_px}]": "@attrs:metadata/conversion_parameters/*"
}
},
"/ENTRY/CALIBRATION[angular0_calibration]":{
Expand All @@ -348,16 +344,16 @@
"binding_energy": 0.0,
"binding_energy/@units": "energy"
},
"/ENTRY/data": {
"/ENTRY/DATA[data]": {
"@axes": "@data:dims",
"@*_indices": "@data:*.index",
"@AXISNAME_indices[@*_indices]": "@data:*.index",
"@signal": "data",
"data": "@data:data",
"data/@units": "counts",
"*": "@data:*.data",
"*/@units": "@data:*.unit",
"*/@reference": "@attrs:metadata/scan_info/coordinate_depends/*",
"*/@long_name": "@attrs:metadata/scan_info/coordinate_label/*",
"energy/@type": "kinetic"
"DATA[data]": "@data:data",
"DATA[data]/@units": "counts",
"AXISNAME[*]": "@data:*.data",
"AXISNAME[*]/@units": "@data:*.unit",
"AXISNAME[*]/@reference": "@attrs:metadata/scan_info/coordinate_depends/*",
"AXISNAME[*]/@long_name": "@attrs:metadata/scan_info/coordinate_label/*",
"AXISNAME[energy]/@type": "kinetic"
}
}
11 changes: 11 additions & 0 deletions src/specsscan/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,17 @@ def fetch_elab_metadata(self, scan: int, metadata: dict) -> dict:
float(metadata["elabFTW"]["laser_status"]["pump2_profile_y"]),
]

# calculate temporal resolution
if (
"laser_status" in metadata["elabFTW"]
and "pump_pulse_duration" in metadata["elabFTW"]["laser_status"]
and "probe_pulse_duration" in metadata["elabFTW"]["laser_status"]
):
metadata["elabFTW"]["laser_status"]["temporal_resolution"] = np.sqrt(
metadata["elabFTW"]["laser_status"]["pump_pulse_duration"] ** 2
+ metadata["elabFTW"]["laser_status"]["probe_pulse_duration"] ** 2,
)

# fix preparation date
if "sample" in metadata["elabFTW"] and "preparation_date" in metadata["elabFTW"]["sample"]:
metadata["elabFTW"]["sample"]["preparation_date"] = (
Expand Down
3 changes: 2 additions & 1 deletion tutorial/3_specsscan_conversion_to_NeXus.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
"metadata['instrument'] = {}\n",
"# energy resolution\n",
"metadata['instrument']['energy_resolution'] = 150.\n",
"metadata['instrument']['temporal_resolution'] = 35.\n",
"metadata['instrument']['electronanalyzer'] = {}\n",
"metadata['instrument']['electronanalyzer']['energy_resolution'] = 120.\n",
"metadata['instrument']['electronanalyzer']['angular_resolution'] = 0.2\n",
Expand Down Expand Up @@ -204,7 +205,7 @@
"outputs": [],
"source": [
"plt.figure()\n",
"res_xarray.loc[{\"energy\":slice(21.6, 21.8)}].sum(axis=2).plot()"
"res_xarray.loc[{\"energy\":slice(-.1, .1)}].sum(axis=2).plot()"
]
},
{
Expand Down