Use correct sense function for sense parameters in Keysight 344xxA driver #6723
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The Keysight344xxA class implements the sense parameters without checking the sense function.
The parameters in the SENSE subsystem have to be handled based on the current sense function. By default the VISA path is always
"SENSe:VOLTage:DC"
and the parameters will only get/set the values for the DC voltage measurement. The actual sense function that is currently used by the instrument completely ignored.I was not entirely sure how to implement this. I had the following other ideas how to solve this:
SenseParameter
class that overridesget_raw()
andset_raw()
to read the sense function just before calling eitherget()
orset()
, but according to the documentation you cannot use bothget_raw()
andget_cmd
at the same time. And it would also be overkill since I actually just need a decorator for the methodsget_raw()
andset_raw()
, I don't need to completely modify them. Is there a way to add such a decorator?Keysight344xxASense
for all the sense parameters to move them from the root instrument toself.sense
. I could then override the methodsask()
andwrite()
in the module to "inject" the correct sense function path just before actually sending the command to the VISA handle.get_cmd
andset_cmd
and manually callself.ask()
andself.write()
with the correct commands.The merge request currently implements solution 3 for the parameters
NPLC
,autorange
,autozero
,aperture_mode
andaperture_time
. The parametersrange
andresolution
are still missing since their validators require some extra work.Are you happy with the current approach or would you prefer one of the other two solutions? Or is there something that I am missing completely that would make the implementation a lot more straight forward?
I am looking forward to your feedback!