xray-imaging / energy

General purpose EPICS IOC / CLI that allows to move an arbitrary set of motors using a list of pre-calibrated positions stored in a dictionary. The list of motor positions is labeled with an energy value. When the energy selected is not in the list, interpolated positions are calculated. CLI allows add/remove pre-calibrated positions the dictionary
https://xray-energy.readthedocs.io
Other
0 stars 1 forks source link

Inconsistent CLI subcommands #2

Open carterbox opened 1 year ago

carterbox commented 1 year ago

First, the pink subcommand should not exist. Instead of energy pink, user's should be typing energy set pink because pink is just a label for a stage setting, so it should be treated like every other stage setting.

Second, the mono subcommand is mentioned in the README, but I think it has been replaced with set.

Third, the add and save commands are both mentioned in the README, but I think only add is a valid command now.

decarlof commented 1 year ago

This addresses second and third.

For the first point, I need to come up with a set of keywords/parameters that are intuitive for both configuration (mono/pink) and both BM and ID line (in BM I have mono and pink for ID I have only mono and single line undulator beam).

Currently at 2-BM I can set the beamline in mono beam with energy values in a range 10-30 so a command like:

energy set --energy 20

is very intuitive. For pink beam at 2-BM I have only one cut off energy available (at 30keV) so I thought:

energy pink

to be more intuitive. But I agree it breaks the logic with the mono beam change and is also not valid at other BM where for example they can change the pink beam cut off.

A more standard solution could be:

energy mono --energy 20 or energy set --mode mono --energy 20 energy pink --energy 30 or energy set --mode pink --energy 30

there is then the issue of the ID where we have mono and there is no pink mode but a single line or harmonic. I added a new parameter (--beamline) this way I can add a new mode

energy line --energy 20 or energy set --mode line --energy 20

and make sure that the above are valid only when --beamline contains 'id' and do the same for the BM pink mode

decarlof commented 1 year ago

This commit implements:

energy set --mode Mono --energy 20 energy set --mode Pink --energy 30

and address the first point.

Default option for --mode is Mono so previous command in use at the beamline: energy set --energy 20 is identical to energy set --mode Mono --energy 20 and works as before.

carterbox commented 1 year ago

Are the energy ranges for mono and pink overlapping? i.e. Can you set the energy to 10keV for both mono and pink modes? If not, then mono and pink are redundant modifiers because the energy alone describes the desired state.

Regardless, I think that --mode is something that you do want. Because I can imagine that you could use --mode for differentiating different experimental setups. i.e. You could have --mode tomography --mode ptychography ?

decarlof commented 1 year ago

yes they are overlapping, and yes mode can be extended to define configuration related to techniques