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

Implement mock flag for more devices #55

Open
rpanderson opened this issue Jun 15, 2020 · 1 comment
Open

Implement mock flag for more devices #55

rpanderson opened this issue Jun 15, 2020 · 1 comment
Labels

Comments

@rpanderson
Copy link
Member

In developing works-out-of-the-box (and without any connected hardware) functionality and examples (#52, #53, #54), I've largely re-implemented subsets of existing labscript device code. As an alternative (or to supplement this), we could instead have a mock flag for (more) existing devices, which allows the functionality to be tested without that device being physically present. A good example of this is labscript_devices.IMAQdxCamera, which can be instantiated with:

# We then initiate an IMAQdxCamera using this RemoteBLACS instance
# using mock=True to bypass any attempts to commmunicate with an
# actual camera
IMAQdxCamera(
    name='camera',
    parent_device=camera_trigger,
    connection='trigger',
    serial_number=0xDEADBEEF,
    worker=test_remote,
    mock=True,
)

With this virtual device, one can even call labscript methods and simulated data will be generated in the shot file during transition_to_manual, e.g.

camera.expose(t, name='comparison', frametype='before', trigger_duration=0.2)

This has the benefit of being able to simulate control and automation workflows, which is obviously super useful for demonstration, training, etc.

On the other hand, extracting the minimal subset from actual labscript device code into dedicated dummy devices assists developers in writing new labscript device code for unsupported devices.

@rpanderson
Copy link
Member Author

A good example of this is labscript_devices.IMAQdxCamera

See, for example, labscript-suite/labscript-utils#55.

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

No branches or pull requests

1 participant