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

Improvements #18

Closed
wants to merge 10 commits into from
Closed

Conversation

MatthieuDartiailh
Copy link
Contributor

This PR adds some tools I needed when working on the DC sources (LabPy/lantz_drivers#4) :

  • Alias feature : allow to reference a Feature from a different subsystem. This can be useful when we need a Feature in a channel (because of the standard) but the actual setting is global (see Keysight E3631A).
  • NEW channel aliases : allow to map custom channel id to instrument channel id (allowing to use 0, 1, 2 even if the instrument ids are names)
  • getter and setter factories (avoid writing common get/set customization by hand):
    • constant : simply make a getter function returning a constant. Can be passed as the first argument to a Feature constructor.
    • conditional : return different values based on the state of the instrument. The condition must be of the form 'a if driver.b else c' (driver represent the current system not the root driver). When the default kwargs is True (False by default) the result of the condition evaluation is passed as a cmd argument to default_get/set_feature.
  • unit utility functions :
    • to_float : turn something we assume to be a Quantity to a float (should not be used on arbitrary objects)
    • to_quantity : turn a float in a Quantity if units are supported (no-op otherwise)

Add testing Python 3.5 on Travis.

These are quite simple so in the absence of any comment I will merge in a week or so as they are needed for testing LabPy/lantz_drivers#4

@MatthieuDartiailh
Copy link
Contributor Author

Updated with channel aliases (see edited message)

@MatthieuDartiailh
Copy link
Contributor Author

Closing as the repo is mostly dead

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