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

Widgets and runviewer parser for DummyIntermediateDevice #53

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rpanderson
Copy link
Member

@rpanderson rpanderson commented Jun 12, 2020

This PR sees the addition of some core functionality and common labscript precepts to make DummyIntermediateDevice more useful, and representative of real intermediate devices.

  • Previously, AnalogOutput and DigitalOutput children were allowed, but not included on the blacs tab.
  • The @set_passed_properties decorator is used to save keyword arguments to the connection table.
  • transition_to_buffered method of the DummyIntermediateDeviceWorker returns the final values from the instruction table, so that these can be used to update the front panel after each shot (not working; see below).
  • The runviewer parser (DummyIntermediateDeviceParser) is a simplified version of that from labscript_devices.NIDAQmx.
  • I've used the ports schema for the digital outs, mostly so I could repurpose some of the labscript_devices.NIDAQmx code for creating widgets in the DummyIntermediateDeviceTab. However, this could be omitted for a simpler fixed number of digital outputs.

TODO:

@rpanderson
Copy link
Member Author

rpanderson commented Jun 12, 2020

These changes can be tested in conjunction with #54 using the following experiment script, which is a slightly extended version of that in labscript-suite/labscript-utils#54. Load this into runmanager and submit it to blacs (check 'Run shot(s)') and/or runviewer (check 'View shot(s)').

from labscript import start, stop, add_time_marker, AnalogOut, DigitalOut
from labscript_devices.DummyPseudoclock.labscript_devices import DummyPseudoclock
from labscript_devices.DummyIntermediateDevice import DummyIntermediateDevice

# Use a virtual, or 'dummy', device for the psuedoclock
DummyPseudoclock(name='pseudoclock')

# An output of this DummyPseudoclock is its 'clockline' attribute, which we use
# to trigger children devices
DummyIntermediateDevice(name='intermediate_device', parent_device=pseudoclock.clockline)

# Create an AnalogOut child of the DummyIntermediateDevice
AnalogOut(name='analog_out', parent_device=intermediate_device, connection='ao0')

# Create a DigitalOut child of the DummyIntermediateDevice
DigitalOut(
    name='digital_out', parent_device=intermediate_device, connection='port0/line0'
)

# Begin issuing labscript primitives
# A timing variable t is used for convenience
# start() elicits the commencement of the shot
t = 0
add_time_marker(t, "Start", verbose=True)
start()

# Wait for 1 second with all devices in their default state
t += 1

# Change the state of digital_out, and denote this using a time marker
add_time_marker(t, "Toggle digital_out (high)", verbose=True)
digital_out.go_high(t)

# Wait for 0.5 seconds
t += 0.5

# Ramp analog_out from 0.0 V to 1.0 V over 0.25 s with a 1 kS/s sample rate
t += analog_out.ramp(t=t, initial=0.0, final=1.0, duration=0.25, samplerate=1e3)

# Change the state of digital_out, and denote this using a time marker
add_time_marker(t, "Toggle digital_out (low)", verbose=True)
digital_out.go_low(t)

# Wait for 0.5 seconds
t += 0.5

# Stop the experiment shot with stop()
stop(t)

@philipstarkey
Copy link
Member

TODO:

No, it shouldn't be related to that. Most likely an issue with channel names not aligning with the output names in the returned dictionary?

In addition to that though, this PR currently breaks backwards compatibility by enforcing specific channel names for analog and digital outputs. People are using this device in their real experiments (see here for example). I thus think it would be better to introspect the attached outputs (and channel names) from the connection table dynamically. That might mean we can't do analog limits until labscript-suite/labscript#44 is resolved though. We should be able to detect static vs buffered Digital outputs based on the output class though.

@philipstarkey
Copy link
Member

Let's target this for 3.1.0

@rpanderson rpanderson force-pushed the dummy_intermediate_updates branch from dd2978d to dc437b5 Compare June 23, 2020 09:20
@rpanderson rpanderson added this to the 3.1 milestone Jun 23, 2020
@rpanderson rpanderson force-pushed the dummy_intermediate_updates branch from dc437b5 to 1800f31 Compare June 25, 2020 05:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants