Skip to content

Commit 38513cb

Browse files
committed
add metadata support for pump2
1 parent b9478cf commit 38513cb

File tree

2 files changed

+28
-13
lines changed

2 files changed

+28
-13
lines changed

src/specsscan/core.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,10 @@ def load_scan(
254254
if k in res_xarray.dims
255255
}
256256

257+
# store data for resolved axis coordinates
258+
for axis in res_xarray.dims:
259+
self._scan_info[axis] = res_xarray.coords[axis].data
260+
257261
res_xarray = res_xarray.rename(rename_dict)
258262
for k, v in coordinate_mapping.items():
259263
if k in fast_axes:
@@ -264,18 +268,6 @@ def load_scan(
264268
slow_axes.add(v)
265269
self._scan_info["coordinate_depends"] = depends_dict
266270

267-
axis_dict = {
268-
"/entry/sample/transformations/sample_polar": "Polar",
269-
"/entry/sample/transformations/sample_tilt": "Tilt",
270-
"/entry/sample/transformations/sample_azimuth": "Azimuth",
271-
"/entry/instrument/beam_pump/pulse_delay": "delay",
272-
}
273-
274-
# store data for resolved axis coordinates
275-
for k, v in depends_dict.items():
276-
if v in axis_dict:
277-
self._scan_info[axis_dict[v]] = res_xarray.coords[k].data
278-
279271
for name in res_xarray.dims:
280272
try:
281273
res_xarray[name].attrs["unit"] = self._config["units"][name]

src/specsscan/metadata.py

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,15 @@ def fetch_elab_metadata(self, scan: int, metadata: dict) -> dict:
216216
float(metadata["elabFTW"]["laser_status"]["probe_profile_x"]),
217217
float(metadata["elabFTW"]["laser_status"]["probe_profile_y"]),
218218
]
219+
if (
220+
"laser_status" in metadata["elabFTW"]
221+
and "pump2_profile_x" in metadata["elabFTW"]["laser_status"]
222+
and "pump2_profile_y" in metadata["elabFTW"]["laser_status"]
223+
):
224+
metadata["elabFTW"]["laser_status"]["pump2_profile"] = [
225+
float(metadata["elabFTW"]["laser_status"]["pump2_profile_x"]),
226+
float(metadata["elabFTW"]["laser_status"]["pump2_profile_y"]),
227+
]
219228

220229
# fix preparation date
221230
if "sample" in metadata["elabFTW"] and "preparation_date" in metadata["elabFTW"]["sample"]:
@@ -249,11 +258,25 @@ def fetch_elab_metadata(self, scan: int, metadata: dict) -> dict:
249258
elif metadata["elabFTW"]["scan"]["probe_polarization"] == "p":
250259
metadata["elabFTW"]["scan"]["probe_polarization"] = 0
251260

261+
if (
262+
"scan" in metadata["elabFTW"]
263+
and "pump2_polarization" in metadata["elabFTW"]["scan"]
264+
and isinstance(metadata["elabFTW"]["scan"]["pump2_polarization"], str)
265+
):
266+
if metadata["elabFTW"]["scan"]["pump2_polarization"] == "s":
267+
metadata["elabFTW"]["scan"]["pump2_polarization"] = 90
268+
elif metadata["elabFTW"]["scan"]["pump2_polarization"] == "p":
269+
metadata["elabFTW"]["scan"]["pump2_polarization"] = 0
270+
252271
# remove pump information if pump not applied:
253-
if not metadata["elabFTW"]["scan"].get("pump_status", 1):
272+
if metadata["elabFTW"]["scan"].get("pump_status", "closed") == "closed":
254273
if "pump_photon_energy" in metadata["elabFTW"].get("laser_status", {}):
255274
del metadata["elabFTW"]["laser_status"]["pump_photon_energy"]
256275

276+
if metadata["elabFTW"]["scan"].get("pump2_status", "closed") == "closed":
277+
if "pump2_photon_energy" in metadata["elabFTW"].get("laser_status", {}):
278+
del metadata["elabFTW"]["laser_status"]["pump2_photon_energy"]
279+
257280
return metadata
258281

259282

0 commit comments

Comments
 (0)