How to set a tuple in the scanner? #36
-
Description:Currently, it is not possible to set a tuple in the scanner (by tuple, I mean Tuple[List[str], int] used to define an element of a Driver). This can be problematic if it is used for a variable that could be changed during a scan. Normally, a tuple is used for selecting an item from a list e.g. ( voltage, current) or (TunicsPlus, TunicsT100S), which is usually done once before a scan and doesn't need to be changed during the scan. However, if the tuple is used for defining the number of points e.g. (1, 5, 10) or the allowed range e.g. (10, 100, 1000), it could be useful to define it during a scan when using multiple recipes with different ranges or precision. Therefore, we either avoid using tuples for this purpose and use int or float with selection inside the function to the nearest allowed value (see for example this driver), or we need to implement the setting of a tuple in the scanner. Problem:
Solution:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
@Totorminator98, @pyMatJ Thought? |
Beta Was this translation helpful? Give feedback.
For now, I've implemented a manual tuple setting on the scanner with an initial value taken from the last measured value (I've added the option to core.element.Variable directly -> could be used later for any type of variable).
Another "problem" occurred to me with the tuple. If a driver is used without the GUI, tuple is a complicated variable to use to set a base value. You can't do set_value('var') but have to do something like set_value(['var', 'test'], 0)).
We could consider having two possible driver behaviors depending on the type of arg to perform the first operation instead of the tuple operation. But this would have to be done at Driver level.
Edit: would lead to reading issue no…