spc-group / haven

Bluesky tools for beamlines managed by the spectroscopy group
https://haven-spc.readthedocs.io/en/latest/
Other
4 stars 6 forks source link

Pass edge name from the Firefly energy scan plan window #297

Open canismarko opened 2 weeks ago

canismarko commented 2 weeks ago

Can the energy scan plan window pass in the name of the edge (e.g. Ni-K) instead of the E0 value itself?

The energy plan window allows you to specify E0 using an editable combobox by either typing an explicit energy (e.g. 8333.0), or by selecting a named edge from the list (e.g. Ni K (8333 eV)).

image

The energy_scan() plan creates two metadata keys: "edge" and "E0". If the plan is called as energy_scan(..., E0="Ni-K") then the metadata become:

{
    "edge": "Ni-K",
    "E0": 8333.0,
}

and if called as energy_scan(..., E0=8333.0) then the metadata are:

{
    "edge": 8333.0,
    "E0": 8333.0,
}

Since the Firefly energy_scan plan window converts the edge name to its energy value before creating the BPlan object, the latter metadata are saved.

If we modify the plan window to pass the edge name, then we get a few benefits.