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

Save clock instructions and add runviewer parser for DummyPseudoclock #54

Merged

Conversation

rpanderson
Copy link
Member

This PR permits whole-suite works-out-of-the-box changes by adding a runviewer parser to DummyPseudoclock (resolves #52).

The additions to the generate_code method of DummyPseudoclock and the get_traces method of DummyPseudoclockParser mock labscript_devices.PineBlaster, which appeared to be the simplest non-dummy pseudoclock device to mimic the instruction set and runviewer parser of.

@rpanderson
Copy link
Member Author

These changes can be tested in conjunction with #53 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)



class DummyPseudoclockParser(object):
clock_resolution = 25e-9
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This mimics the structure of labscript_devices.PineBlaster but could/should probably be extracted from connection table properties.

@rpanderson rpanderson added the enhancement New feature or request label Jun 12, 2020
@philipstarkey
Copy link
Member

@rpanderson I've implemented the changes I suggested. Happy to merge this one before 3.0.0 release

@rpanderson
Copy link
Member Author

Great! Thanks, @philipstarkey.

@philipstarkey philipstarkey merged commit 3863607 into labscript-suite:master Jun 24, 2020
@rpanderson rpanderson deleted the dummy_pseudoclock_updates branch June 24, 2020 11:15
philipstarkey added a commit that referenced this pull request Jun 25, 2020
commit c9de425
Author: Phil Starkey <[email protected]>
Date:   Thu Jun 25 19:12:29 2020 +1000

    Update dependencies in setup.cfg

    Bumped blacs, labscript and labscript_utils versions to `>=3.0.0`

commit d43ced1
Merge: 3863607 1988032
Author: Chris Billington <[email protected]>
Date:   Wed Jun 24 22:48:26 2020 -0400

    Merge pull request #58 from philipstarkey/fix-h5py-file-mode

    Fix h5py deprecation warnings

commit 1988032
Author: philipstarkey <[email protected]>
Date:   Thu Jun 25 10:48:10 2020 +1000

    Fix h5py deprecation warnings

    Addresses labscript-suite/labscript-utils#47 for this module

commit 3863607
Merge: 88eeefe cdd34f8
Author: Phil Starkey <[email protected]>
Date:   Wed Jun 24 10:51:04 2020 +1000

    Merge pull request #54 from rpanderson/dummy_pseudoclock_updates

    Save clock instructions and add runviewer parser for DummyPseudoclock

commit 88eeefe
Merge: 55b1bd8 84eb889
Author: Phil Starkey <[email protected]>
Date:   Wed Jun 24 10:50:09 2020 +1000

    Merge pull request #42 from JQIamo/SpinnakerCamera

    Added SpinnakerCamera

commit cdd34f8
Author: philipstarkey <[email protected]>
Date:   Tue Jun 23 18:34:28 2020 +1000

    Implemented review changes

commit d2e5679
Author: Russell Anderson <[email protected]>
Date:   Fri Jun 12 18:47:25 2020 +1000

    Save clock instructions (mock PineBlaster) and add runviewer_parser

commit 84eb889
Author: philipstarkey <[email protected]>
Date:   Tue Jun 23 12:49:00 2020 +1000

    Implemented review changes

commit 55b1bd8
Merge: bb9f6f5 d5fca30
Author: Russell Anderson <[email protected]>
Date:   Mon Jun 22 18:07:08 2020 +1000

    Merge pull request #57 from philipstarkey/master

    fix docs conf bugs identified in labscript-suite/labscript-utils#57

commit d5fca30
Author: philipstarkey <[email protected]>
Date:   Sat Jun 20 18:33:55 2020 +1000

    fix docs conf bugs identified in labscript-suite/labscript-utils#57

commit bb9f6f5
Merge: 0f1cacd 091110b
Author: Russell Anderson <[email protected]>
Date:   Fri Jun 19 17:57:15 2020 +1000

    Merge pull request #56 from philipstarkey/master

    Empty sphinx project following our template

commit 091110b
Author: philipstarkey <[email protected]>
Date:   Fri Jun 19 17:42:46 2020 +1000

    Empty sphinx project following our template

commit 0f1cacd
Author: Russell Anderson <[email protected]>
Date:   Wed Jun 17 16:39:08 2020 +1000

    Added missing devices to README.md

commit 5347098
Author: Russell Anderson <[email protected]>
Date:   Wed Jun 17 11:38:03 2020 +1000

    Populated README.md with styling, iconogrpahy, prose, and badges

commit bd2505e
Author: DSB <[email protected]>
Date:   Mon May 4 14:27:03 2020 -0400

    SpinnakerCamera

    Adding a camera interface that uses FLIR's newer PySpin/Spinnaker API.

    DSB

Co-authored-by: chrisjbillington <[email protected]>
Co-authored-by: Russell Anderson <[email protected]>
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.

DummyPseudoclock updates
2 participants