Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use correct sense function for sense parameters in Keysight 344xxA driver #6723

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

janekfleper
Copy link
Contributor

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:

  1. Create a SenseParameter class that overrides get_raw() and set_raw() to read the sense function just before calling either get() or set(), but according to the documentation you cannot use both get_raw() and get_cmd at the same time. And it would also be overkill since I actually just need a decorator for the methods get_raw() and set_raw(), I don't need to completely modify them. Is there a way to add such a decorator?
  2. Create an instrument module Keysight344xxASense for all the sense parameters to move them from the root instrument to self.sense. I could then override the methods ask() and write() in the module to "inject" the correct sense function path just before actually sending the command to the VISA handle.
  3. Pass callable methods to the parameters get_cmd and set_cmd and manually call self.ask() and self.write() with the correct commands.

The merge request currently implements solution 3 for the parameters NPLC, autorange, autozero, aperture_mode and aperture_time. The parameters range and resolution 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!

@janekfleper janekfleper requested a review from a team as a code owner December 16, 2024 17:38
@janekfleper janekfleper changed the title Use correct sense function for sense parameters Use correct sense function for sense parameters in Keysight 344xxA driver Dec 16, 2024
@janekfleper
Copy link
Contributor Author

@microsoft-github-policy-service agree company="University of Bonn"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant