Skip to content

Commit 14a99fc

Browse files
authored
Merge pull request #76 from OpenCOMPES/update_pynxtools
Update pynxtools
2 parents 0c2d4be + 7ea32ea commit 14a99fc

File tree

4 files changed

+75
-67
lines changed

4 files changed

+75
-67
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ dependencies = [
4141
"numpy>=1.21.6",
4242
"opencv-python>=4.8.1.78",
4343
"pynxtools-mpes>=0.2.2",
44-
"pynxtools>=0.10.1",
44+
"pynxtools>=0.10.6",
4545
"python-dateutil>=2.8.2",
4646
"pyyaml>=6.0",
4747
"xarray>=0.20.2",

src/specsscan/config/NXmpes_arpes_config.json

Lines changed: 61 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"/ENTRY/experiment_institution": "Fritz Haber Institute - Max Planck Society",
77
"/ENTRY/experiment_facility": "Time Resolved ARPES",
88
"/ENTRY/experiment_laboratory": "Clean Room 4",
9-
"/ENTRY/identifierNAME[entry_identifier]": "@attrs:metadata/loader/scan_path",
9+
"/ENTRY/identifierNAME[identifier_entry]": "@attrs:metadata/loader/scan_path",
1010
"/ENTRY/end_time": "@attrs:metadata/timing/acquisition_stop",
1111
"/ENTRY/duration": "@attrs:metadata/timing/acquisition_duration",
1212
"/ENTRY/duration/@units": "s",
@@ -39,17 +39,13 @@
3939
"type": "estimated"
4040
},
4141
"RESOLUTION[temporal_resolution]": {
42-
"resolution": "!['@attrs:metadata/elabFTW/laser_status/temporal_resolution', '35.0']",
43-
"resolution/@units": "fs",
42+
"resolution": "!['@eln:/ENTRY/Instrument/temporal_resolution', '@attrs:metadata/instrument/temporal_resolution', '@attrs:metadata/elabFTW/laser_status/temporal_resolution']",
43+
"resolution/@units": "['@eln:/ENTRY/Instrument/temporal_resolution/@units', 'fs']",
4444
"physical_quantity": "time",
4545
"type": "estimated"
4646
},
47-
"RESOLUTION[angular_resolution]": {
48-
"resolution": "@link:/entry/instrument/electronanalyzer/angular_resolution/resolution",
49-
"resolution/@units": "deg",
50-
"physical_quantity": "angle",
51-
"type": "derived"
52-
},
47+
"RESOLUTION[angular_resolution]": "@link:/entry/instrument/electronanalyzer/angular_resolution",
48+
"RESOLUTION[spatial_resolution]": "@link:/entry/instrument/electronanalyzer/spatial_resolution",
5349
"pressure_gauge": {
5450
"name": "sample_chamber_pressure",
5551
"measurement": "pressure",
@@ -91,21 +87,21 @@
9187
"AXISNAME[trans_z]/@transformation_type": "translation",
9288
"AXISNAME[trans_z]/@units": "mm",
9389
"AXISNAME[trans_z]/@vector": [0, 0, 1],
94-
"analyzer_dispersion/@depends_on": "analyzer_rotation",
95-
"analyzer_dispersion": "@data:angular1.data",
96-
"analyzer_dispersion/@transformation_type": "rotation",
97-
"analyzer_dispersion/@units": "degrees",
98-
"analyzer_dispersion/@vector": [1, 0, 0],
99-
"analyzer_elevation/@depends_on": "analyzer_dispersion",
100-
"analyzer_elevation": 0,
101-
"analyzer_elevation/@transformation_type": "rotation",
102-
"analyzer_elevation/@units": "degrees",
103-
"analyzer_elevation/@vector": [0, 1, 0],
104-
"analyzer_rotation/@depends_on": "rot_y",
105-
"analyzer_rotation": 0,
106-
"analyzer_rotation/@transformation_type": "rotation",
107-
"analyzer_rotation/@units": "degrees",
108-
"analyzer_rotation/@vector": [0, 0, 1],
90+
"AXISNAME[analyzer_dispersion]/@depends_on": "analyzer_rotation",
91+
"AXISNAME[analyzer_dispersion]": "@data:angular0.data",
92+
"AXISNAME[analyzer_dispersion]/@transformation_type": "rotation",
93+
"AXISNAME[analyzer_dispersion]/@units": "degrees",
94+
"AXISNAME[analyzer_dispersion]/@vector": [1, 0, 0],
95+
"AXISNAME[analyzer_elevation]/@depends_on": "analyzer_dispersion",
96+
"AXISNAME[analyzer_elevation]": 0,
97+
"AXISNAME[analyzer_elevation]/@transformation_type": "rotation",
98+
"AXISNAME[analyzer_elevation]/@units": "degrees",
99+
"AXISNAME[analyzer_elevation]/@vector": [0, 1, 0],
100+
"AXISNAME[analyzer_rotation]/@depends_on": "rot_y",
101+
"AXISNAME[analyzer_rotation]": 0,
102+
"AXISNAME[analyzer_rotation]/@transformation_type": "rotation",
103+
"AXISNAME[analyzer_rotation]/@units": "degrees",
104+
"AXISNAME[analyzer_rotation]/@vector": [0, 0, 1],
109105
"AXISNAME[rot_y]/@depends_on": ".",
110106
"AXISNAME[rot_y]": 140.0,
111107
"AXISNAME[rot_y]/@transformation_type": "rotation",
@@ -266,38 +262,38 @@
266262
"drain_current_env": {
267263
"ammeter": "@link:/entry/instrument/manipulator/drain_current_ammeter"
268264
},
269-
"depends_on": "/entry/sample/transformations/offset_azimuth",
265+
"depends_on": "/entry/sample/transformations/sample_azimuth",
270266
"TRANSFORMATIONS[transformations]": {
271-
"offset_azimuth/@depends_on": "sample_azimuth",
272-
"offset_azimuth": 0,
273-
"offset_azimuth/@units": "degrees",
274-
"offset_azimuth/@transformation_type": "rotation",
275-
"offset_azimuth/@vector": [0, 0, 1],
276-
"sample_azimuth/@depends_on": "offset_tilt",
277-
"sample_azimuth": "@attrs:metadata/scan_info/trARPES:Carving:OMG.RBV",
278-
"sample_azimuth/@units": "degrees",
279-
"sample_azimuth/@transformation_type": "rotation",
280-
"sample_azimuth/@vector": [0, 0, 1],
281-
"offset_tilt/@depends_on": "sample_tilt",
282-
"offset_tilt": 0,
283-
"offset_tilt/@units": "degrees",
284-
"offset_tilt/@transformation_type": "rotation",
285-
"offset_tilt/@vector": [1, 0, 0],
286-
"sample_tilt/@depends_on": "offset_polar",
287-
"sample_tilt": "@attrs:metadata/scan_info/trARPES:Carving:PHI.RBV",
288-
"sample_tilt/@units": "degrees",
289-
"sample_tilt/@transformation_type": "rotation",
290-
"sample_tilt/@vector": [1, 0, 0],
291-
"offset_polar/@depends_on": "sample_polar",
292-
"offset_polar": -9,
293-
"offset_polar/@units": "degrees",
294-
"offset_polar/@transformation_type": "rotation",
295-
"offset_polar/@vector": [0, 1, 0],
296-
"sample_polar/@depends_on": "yz_flip",
297-
"sample_polar": "@attrs:metadata/scan_info/trARPES:Carving:THT.RBV",
298-
"sample_polar/@units": "degrees",
299-
"sample_polar/@transformation_type": "rotation",
300-
"sample_polar/@vector": [0, 1, 0],
267+
"AXISNAME[offset_azimuth]/@depends_on": "sample_tilt",
268+
"AXISNAME[offset_azimuth]": 0,
269+
"AXISNAME[offset_azimuth]/@units": "degrees",
270+
"AXISNAME[offset_azimuth]/@transformation_type": "rotation",
271+
"AXISNAME[offset_azimuth]/@vector": [0, 0, 1],
272+
"AXISNAME[sample_azimuth]/@depends_on": "offset_azimuth",
273+
"AXISNAME[sample_azimuth]": "@attrs:metadata/scan_info/trARPES:Carving:OMG.RBV",
274+
"AXISNAME[sample_azimuth]/@units": "degrees",
275+
"AXISNAME[sample_azimuth]/@transformation_type": "rotation",
276+
"AXISNAME[sample_azimuth]/@vector": [0, 0, 1],
277+
"AXISNAME[offset_tilt]/@depends_on": "sample_polar",
278+
"AXISNAME[offset_tilt]": 0,
279+
"AXISNAME[offset_tilt]/@units": "degrees",
280+
"AXISNAME[offset_tilt]/@transformation_type": "rotation",
281+
"AXISNAME[offset_tilt]/@vector": [1, 0, 0],
282+
"AXISNAME[sample_tilt]/@depends_on": "offset_tilt",
283+
"AXISNAME[sample_tilt]": "@attrs:metadata/scan_info/trARPES:Carving:PHI.RBV",
284+
"AXISNAME[sample_tilt]/@units": "degrees",
285+
"AXISNAME[sample_tilt]/@transformation_type": "rotation",
286+
"AXISNAME[sample_tilt]/@vector": [1, 0, 0],
287+
"AXISNAME[offset_polar]/@depends_on": "yz_flip",
288+
"AXISNAME[offset_polar]": -9,
289+
"AXISNAME[offset_polar]/@units": "degrees",
290+
"AXISNAME[offset_polar]/@transformation_type": "rotation",
291+
"AXISNAME[offset_polar]/@vector": [0, 1, 0],
292+
"AXISNAME[sample_polar]/@depends_on": "offset_polar",
293+
"AXISNAME[sample_polar]": "@attrs:metadata/scan_info/trARPES:Carving:THT.RBV",
294+
"AXISNAME[sample_polar]/@units": "degrees",
295+
"AXISNAME[sample_polar]/@transformation_type": "rotation",
296+
"AXISNAME[sample_polar]/@vector": [0, 1, 0],
301297
"AXISNAME[yz_flip]/@depends_on": "xy_adjust",
302298
"AXISNAME[yz_flip]": 90.0,
303299
"AXISNAME[yz_flip]/@units": "degrees",
@@ -332,7 +328,7 @@
332328
"calibrated_axis/@units": "energy",
333329
"physical_quantity": "energy",
334330
"PARAMETERS[conversion_parameters]":{
335-
"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/*"
331+
"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/*"
336332
}
337333
},
338334
"/ENTRY/CALIBRATION[angular0_calibration]":{
@@ -348,16 +344,16 @@
348344
"binding_energy": 0.0,
349345
"binding_energy/@units": "energy"
350346
},
351-
"/ENTRY/data": {
347+
"/ENTRY/DATA[data]": {
352348
"@axes": "@data:dims",
353-
"@*_indices": "@data:*.index",
349+
"@AXISNAME_indices[@*_indices]": "@data:*.index",
354350
"@signal": "data",
355-
"data": "@data:data",
356-
"data/@units": "counts",
357-
"*": "@data:*.data",
358-
"*/@units": "@data:*.unit",
359-
"*/@reference": "@attrs:metadata/scan_info/coordinate_depends/*",
360-
"*/@long_name": "@attrs:metadata/scan_info/coordinate_label/*",
361-
"energy/@type": "kinetic"
351+
"DATA[data]": "@data:data",
352+
"DATA[data]/@units": "counts",
353+
"AXISNAME[*]": "@data:*.data",
354+
"AXISNAME[*]/@units": "@data:*.unit",
355+
"AXISNAME[*]/@reference": "@attrs:metadata/scan_info/coordinate_depends/*",
356+
"AXISNAME[*]/@long_name": "@attrs:metadata/scan_info/coordinate_label/*",
357+
"AXISNAME[energy]/@type": "kinetic"
362358
}
363359
}

src/specsscan/metadata.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,17 @@ def fetch_elab_metadata(self, scan: int, metadata: dict) -> dict:
243243
float(metadata["elabFTW"]["laser_status"]["pump2_profile_y"]),
244244
]
245245

246+
# calculate temporal resolution
247+
if (
248+
"laser_status" in metadata["elabFTW"]
249+
and "pump_pulse_duration" in metadata["elabFTW"]["laser_status"]
250+
and "probe_pulse_duration" in metadata["elabFTW"]["laser_status"]
251+
):
252+
metadata["elabFTW"]["laser_status"]["temporal_resolution"] = np.sqrt(
253+
metadata["elabFTW"]["laser_status"]["pump_pulse_duration"] ** 2
254+
+ metadata["elabFTW"]["laser_status"]["probe_pulse_duration"] ** 2,
255+
)
256+
246257
# fix preparation date
247258
if "sample" in metadata["elabFTW"] and "preparation_date" in metadata["elabFTW"]["sample"]:
248259
metadata["elabFTW"]["sample"]["preparation_date"] = (

tutorial/3_specsscan_conversion_to_NeXus.ipynb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
"metadata['instrument'] = {}\n",
6767
"# energy resolution\n",
6868
"metadata['instrument']['energy_resolution'] = 150.\n",
69+
"metadata['instrument']['temporal_resolution'] = 35.\n",
6970
"metadata['instrument']['electronanalyzer'] = {}\n",
7071
"metadata['instrument']['electronanalyzer']['energy_resolution'] = 120.\n",
7172
"metadata['instrument']['electronanalyzer']['angular_resolution'] = 0.2\n",
@@ -204,7 +205,7 @@
204205
"outputs": [],
205206
"source": [
206207
"plt.figure()\n",
207-
"res_xarray.loc[{\"energy\":slice(21.6, 21.8)}].sum(axis=2).plot()"
208+
"res_xarray.loc[{\"energy\":slice(-.1, .1)}].sum(axis=2).plot()"
208209
]
209210
},
210211
{

0 commit comments

Comments
 (0)