You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/source/adding_devices.rst
+18-7Lines changed: 18 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,15 +12,23 @@ Though not strictly required, you should also consider providing a `runviewer_pa
12
12
General Strategy
13
13
~~~~~~~~~~~~~~~~
14
14
15
-
As a general rule, it is best to model new hardware implementations off of a currently implemented device that has similar functionality. If the functionality is similar enough, it may even be possible to simply sub-class the currently implemented device, which is likely preferrable.
15
+
As a general rule, it is best to model new hardware implementations off of a currently implemented device that has similar functionality.
16
+
If the functionality is similar enough, it may even be possible to simply sub-class the currently implemented device, which is likely preferrable.
16
17
17
-
Barring the above simple solution, one must work from scratch. It is best to begin by determining the **labscript** device class to inherit from: `Psuedoclock`, `Device`, `IntermediateDevice`. The first is for implementing Psuedoclock devices, the second is for generic devices that are not hardware timed by a pseudoclock, and the last is for hardware timed device that are connected to another device controlled via labscript.
18
+
Barring the above simple solution, one must work from scratch.
19
+
It is best to begin by determining the **labscript** device class to inherit from: `Psuedoclock`, `Device`, `IntermediateDevice`.
20
+
The first is for implementing Psuedoclock devices, the second is for generic devices that are not hardware timed by a pseudoclock, and the last is for hardware timed device that are connected to another device controlled via labscript.
18
21
19
-
The `labscript_device` implements general configuration parameters, many of which are passed to the `BLACS_worker`. It also implements the `generate_code` method which converts **labscript** high-level instructions and saves them to the h5 file.
22
+
The `labscript_device` implements general configuration parameters, many of which are passed to the `BLACS_worker`.
23
+
It also implements the `generate_code` method which converts **labscript** high-level instructions and saves them to the h5 file.
20
24
21
-
The `BLACS_tab` defines the GUI widgets that control the device. This typically takes the form of using standard widgets provided by **labscript** for controlling **labscript** output primitives (ie `AnalogOut`, `DigitalOut`,`DDS`, etc). This configuration is done in the `initialiseGUI` method. This also links directly to the appropriate BLACS workers.
25
+
The `BLACS_tab` defines the GUI widgets that control the device.
26
+
This typically takes the form of using standard widgets provided by **labscript** for controlling **labscript** output primitives (ie `AnalogOut`, `DigitalOut`,`DDS`, etc).
27
+
This configuration is done in the `initialiseGUI` method.
28
+
This also links directly to the appropriate BLACS workers.
22
29
23
-
The `BLACS_worker` handles communication with the hardware itself and often represents the bulk of the work required to implement a new labscript device. In general, it should provide five different methods:
30
+
The `BLACS_worker` handles communication with the hardware itself and often represents the bulk of the work required to implement a new labscript device.
31
+
In general, it should provide five different methods:
24
32
25
33
* `init`: This method initialised communications with the device. Not to be confused with the standard python class `__init__` method.
26
34
* `program_manual`: This method allows for user control of the device via the `BLACS_tab`, setting outputs to the values set in the `BLACS_tab` widgets.
@@ -37,7 +45,9 @@ There are currently two supported file organization styles for a labscript-devic
37
45
38
46
The old style has the `labscript_device`, `BLACS_tab`, `BLACS_worker`, and `runviewer_parser` all in the same file, which typically has the same name as the `labscript_device` class name.
39
47
40
-
The new style allows for arbitrary code organization, but typically has a folder named after the `labscript_device` with each device component in a different file (ie `labscript_devices.py`, `BLACS_workers.py`, etc). With this style, the folder requires an `__init__.py` file (which can be empty) as well as a `register_classes.py` file. This file imports :obj:`<labscript-utils:labscript_utils.device_registry>` via
48
+
The new style allows for arbitrary code organization, but typically has a folder named after the `labscript_device` with each device component in a different file (ie `labscript_devices.py`, `BLACS_workers.py`, etc).
49
+
With this style, the folder requires an `__init__.py` file (which can be empty) as well as a `register_classes.py` file.
50
+
This file imports :obj:`<labscript-utils:labscript_utils.device_registry>` via
41
51
42
52
.. code-block:: python
43
53
@@ -56,4 +66,5 @@ This function informs **labscript** where to find the necessary classes during i
56
66
Contributions to **labscript-devices**
57
67
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
58
68
59
-
If you decide to implement a labscript-device for controlling new hardware, we highly encourage you to consider making a pull-request to the **labscript-devices** repository in order to add your work to the **labscript-suite**. Increasing the list of supported devices is an important way for the **labscript-suite** to continue to grow, allowing new users to more quickly get up and running with hardware they may already have.
69
+
If you decide to implement a labscript-device for controlling new hardware, we highly encourage you to consider making a pull-request to the **labscript-devices** repository in order to add your work to the **labscript-suite**.
70
+
Increasing the list of supported devices is an important way for the **labscript-suite** to continue to grow, allowing new users to more quickly get up and running with hardware they may already have.
Copy file name to clipboardExpand all lines: docs/source/devices.rst
+8-3Lines changed: 8 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,9 @@ Here is a list of all the currently supported devices.
7
7
Pseudoclocks
8
8
~~~~~~~~~~~~
9
9
10
-
Pseudoclocks provide the timing backbone of the labscript_suite. These devices produce hardware-timed clocklines that trigger other device outputs and acquisitions. Many pseudoclock devices also include other types of outputs, including digital voltage and DDS frequency synthesizers.
10
+
Pseudoclocks provide the timing backbone of the labscript_suite.
11
+
These devices produce hardware-timed clocklines that trigger other device outputs and acquisitions.
12
+
Many pseudoclock devices also include other types of outputs, including digital voltage and DDS frequency synthesizers.
11
13
12
14
.. toctree::
13
15
:maxdepth:2
@@ -22,7 +24,8 @@ Pseudoclocks provide the timing backbone of the labscript_suite. These devices p
22
24
NI DAQS
23
25
~~~~~~~~~~~~
24
26
25
-
The NI_DAQmx device provides a generic interface for National Instruments data acquisition hardware. This includes digital and analog voltage I/O. These input/outputs can be either static or hardware-timed dynamically changing variables.
27
+
The NI_DAQmx device provides a generic interface for National Instruments data acquisition hardware.
28
+
This includes digital and analog voltage I/O. These input/outputs can be either static or hardware-timed dynamically changing variables.
26
29
27
30
.. toctree::
28
31
:maxdepth:2
@@ -32,7 +35,9 @@ The NI_DAQmx device provides a generic interface for National Instruments data a
32
35
Cameras
33
36
~~~~~~~~~~~~
34
37
35
-
The camera devices provide interfaces for using various scientific cameras to acquire hardware-timed images during an experiment. They are organized by the programming API the underlies the communication to the device. The "master" camera class which provides the core functionality and from which the others derive is the IMAQdx class.
38
+
The camera devices provide interfaces for using various scientific cameras to acquire hardware-timed images during an experiment.
39
+
They are organized by the programming API the underlies the communication to the device.
40
+
The "master" camera class which provides the core functionality and from which the others derive is the IMAQdx class.
Copy file name to clipboardExpand all lines: docs/source/devices/andorsolis.rst
+4-2Lines changed: 4 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,8 @@ Andor Solis Cameras
3
3
4
4
A labscript device for controlling Andor scientific cameras via the Andor SDK3 interface.
5
5
6
-
Presently, this device is hard-coded for use with the iXon camera. Minor modifications can allow use with other Andor cameras, so long as they are compatible with the Andor SDK3 library.
6
+
Presently, this device is hard-coded for use with the iXon camera.
7
+
Minor modifications can allow use with other Andor cameras, so long as they are compatible with the Andor SDK3 library.
7
8
8
9
.. autosummary::
9
10
labscript_devices.AndorSolis.labscript_devices
@@ -13,7 +14,8 @@ Presently, this device is hard-coded for use with the iXon camera. Minor modific
13
14
Installation
14
15
~~~~~~~~~~~~
15
16
16
-
The Andor SDK is available from Andor as a paid product (typically purchased with the camera). It must be installed with the SDK directory added to the system path.
17
+
The Andor SDK is available from Andor as a paid product (typically purchased with the camera).
18
+
It must be installed with the SDK directory added to the system path.
Copy file name to clipboardExpand all lines: docs/source/devices/flycapture2.rst
+14-5Lines changed: 14 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,9 @@
1
1
FlyCapture2 Cameras
2
2
===================
3
3
4
-
This device allows control of FLIR (formerly Point Grey) scientific cameras via the `FlyCapture2 SDK <https://www.flir.com/products/flycapture-sdk/>`_ with the now deprecated PyCapture2 wrapper. In order to use this device, both the SDK and the python wrapper must be installed. Note that PyCapture2 only supports up to Python 3.6.
4
+
This device allows control of FLIR (formerly Point Grey) scientific cameras via the `FlyCapture2 SDK <https://www.flir.com/products/flycapture-sdk/>`_ with the now deprecated PyCapture2 wrapper.
5
+
In order to use this device, both the SDK and the python wrapper must be installed.
6
+
Note that PyCapture2 only supports up to Python 3.6.
5
7
6
8
The new FLIR SDK is supported using the :doc:`SpinnakerCamera labscript device <spinnaker>`.
7
9
@@ -15,21 +17,28 @@ Installation
15
17
16
18
First ensure that the FlyCapture2 SDK is installed.
17
19
18
-
The python wrapper is available via FLIR and is only released for Python up to 3.6. It must be installed separately, pointed to the correct conda environment during install.
20
+
The python wrapper is available via FLIR and is only released for Python up to 3.6.
21
+
It must be installed separately, pointed to the correct conda environment during install.
19
22
20
23
21
-
For GigE cameras, ensure that the network interface card (NIC) on the computer with the BLACS controlling the camera has enabled Jumbo Frames. That maximum allowed value (typically 9000) is preferable to avoid dropped frames.
24
+
For GigE cameras, ensure that the network interface card (NIC) on the computer with the BLACS controlling the camera has enabled Jumbo Frames.
25
+
That maximum allowed value (typically 9000) is preferable to avoid dropped frames.
22
26
23
27
Usage
24
28
~~~~~
25
29
26
-
Like the :doc:`IMAQdxCamera <IMAQdx>` device, the bulk of camera configuration is performed using a dictionary of kwargs, where the key names and values mirror those provided by the FlyCapture2 SDK interface. Which parameters can/need to be set depend on the communication interface. Discovery of what parameters are available can be done in three ways:
30
+
Like the :doc:`IMAQdxCamera <IMAQdx>` device, the bulk of camera configuration is performed using a dictionary of kwargs, where the key names and values mirror those provided by the FlyCapture2 SDK interface.
31
+
Which parameters can/need to be set depend on the communication interface.
32
+
Discovery of what parameters are available can be done in three ways:
27
33
28
34
1. Careful reading of the FlyCapture2 SDK docs.
29
35
2. Mirroring the FlyCap Viewer parameter names and values.
30
36
3. Connecting to the camera with a minimal configuration, viewing the current parameters dictionary, and copying the relevant values to the connection table (preferred).
31
37
32
-
The python structure for setting these values differs somewhat from other camera devices in labscript, taking the form of nested dictionaries. This structure most closely matches the structure of the FlyCapture2 SDK in that each camera property has multiple sub-elements that control the feature. In this implementation, the standard camera properties are set using keys with ALL CAPS. The control of the Trigger Mode and Image Mode properties is handled separately, using a slightly different nesting structure than the other properties.
38
+
The python structure for setting these values differs somewhat from other camera devices in labscript, taking the form of nested dictionaries.
39
+
This structure most closely matches the structure of the FlyCapture2 SDK in that each camera property has multiple sub-elements that control the feature.
40
+
In this implementation, the standard camera properties are set using keys with ALL CAPS.
41
+
The control of the Trigger Mode and Image Mode properties is handled separately, using a slightly different nesting structure than the other properties.
33
42
34
43
Below is a generic configuration for a Point Grey Blackfly PGE-23S6M-C device.
and :class:`AnalogIn <labscript:labscript.labscript.AnalogIn>` labscript quantities for use in experiments. Exact numbers of channels, performance, and configuration depend on the model of DAQ used.
59
+
and :class:`AnalogIn <labscript:labscript.labscript.AnalogIn>` labscript quantities for use in experiments.
60
+
Exact numbers of channels, performance, and configuration depend on the model of DAQ used.
60
61
61
62
.. code-block:: python
62
63
@@ -78,7 +79,9 @@ and :class:`AnalogIn <labscript:labscript.labscript.AnalogIn>` labscript quantit
78
79
AnalogOut('daq_ao0',daq,'ao0')
79
80
AnalogIn('daq_ai1',daq,'ai1')
80
81
81
-
NI DAQs are also used within labscript to provide a :class:`WaitMonitor <labscript:labscript.labscript.waitmonitor>`. When configured, the `WaitMonitor` allows for arbitrary-length pauses in experiment execution, waiting for some trigger to restart. The monitor provides a measurement of the duration of the wait for use in interpreting the resulting data from the experiment.
82
+
NI DAQs are also used within labscript to provide a :class:`WaitMonitor <labscript:labscript.labscript.waitmonitor>`.
83
+
When configured, the `WaitMonitor` allows for arbitrary-length pauses in experiment execution, waiting for some trigger to restart.
84
+
The monitor provides a measurement of the duration of the wait for use in interpreting the resulting data from the experiment.
82
85
83
86
Configuration uses three digital I/O connections on the DAQ:
84
87
@@ -98,7 +101,9 @@ An example configuration of a `WaitMonitor` using a NI DAQ is shown here
98
101
# Necessary to ensure even number of digital out lines in shot
99
102
DigitalOut('daq_do1',daq,'port0/line1')
100
103
101
-
Note that the counter connection is specified using the logical label `'ctr0'`. On many NI DAQs, the physical connection to this counter is PFI9. The physical wiring for this configuration would have port0/line0 wired directly to PFI9, with PFI1 being sent to the master pseudoclock retriggering system in case of timeout. If timeouts are not expected/represent experiment failure, this physical connection can be omitted.
104
+
Note that the counter connection is specified using the logical label `'ctr0'`. On many NI DAQs, the physical connection to this counter is PFI9.
105
+
The physical wiring for this configuration would have port0/line0 wired directly to PFI9, with PFI1 being sent to the master pseudoclock retriggering system in case of timeout.
106
+
If timeouts are not expected/represent experiment failure, this physical connection can be omitted.
Copy file name to clipboardExpand all lines: docs/source/devices/opalkellyXEM3001.rst
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,9 @@ A pseudoclocking labscript device based on the OpalKelly XEM3001 integration mod
6
6
Installation
7
7
~~~~~~~~~~~~
8
8
9
-
Firmware (.bit) files for the FPGA are available `here <https://github.com/labscript-suite/opalkellyxem3001>`_ and should be placed in the labscript_devices folder along with the `CiceroOpalKellyXEM3001.py` file. The Opal Kelly SDK, which provides the python bindings, is also required. The python bindings will need to either be added to the PATH or manually copied to the site-packages of the virtual environment that BLACS is running in.
9
+
Firmware (.bit) files for the FPGA are available `here <https://github.com/labscript-suite/opalkellyxem3001>`_ and should be placed in the labscript_devices folder along with the `CiceroOpalKellyXEM3001.py` file.
10
+
The Opal Kelly SDK, which provides the python bindings, is also required.
11
+
The python bindings will need to either be added to the PATH or manually copied to the site-packages of the virtual environment that BLACS is running in.
Copy file name to clipboardExpand all lines: docs/source/devices/prawnblaster.rst
+5-2Lines changed: 5 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,9 +30,12 @@ The PrawnBlaster takes advantage of the specs of the Pico to provide the followi
30
30
Installation
31
31
~~~~~~~~~~~~
32
32
33
-
In order to turn the standard Pico into a PrawnBlaster, you need to load the custom firmware available in the `Github repo <https://github.com/labscript-suite/PrawnBlaster/tree/master/build/prawnblaster>`_ onto the board. The simplest way to do this is by holding the reset button on the board while plugging the USB into a computer. This will bring up a mounted folder that you copy-paste the firmware to. Once copied, the board will reset and be ready to go.
33
+
In order to turn the standard Pico into a PrawnBlaster, you need to load the custom firmware available in the `Github repo <https://github.com/labscript-suite/PrawnBlaster/tree/master/build/prawnblaster>`_ onto the board.
34
+
The simplest way to do this is by holding the reset button on the board while plugging the USB into a computer.
35
+
This will bring up a mounted folder that you copy-paste the firmware to. Once copied, the board will reset and be ready to go.
34
36
35
-
Note that this device communicates using a virtual COM port. The number is assigned by the controlling computer and will need to be determined in order for BLACS to connect to the PrawnBlaster.
37
+
Note that this device communicates using a virtual COM port.
38
+
The number is assigned by the controlling computer and will need to be determined in order for BLACS to connect to the PrawnBlaster.
Copy file name to clipboardExpand all lines: docs/source/devices/pulseblaster.rst
+7-2Lines changed: 7 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,19 @@
1
1
Pulseblaster
2
2
============
3
3
4
-
This labscript device controls the Spincore PulseblaserDDS-II-300-AWG. The Pulseblaster is a programmable pulse generator that is the typical timing backbone of an experiment (ie it generates the pseudoclock timing pulses that control execution of other devices in the experiment). This labscript device is the master implementation of the various Pulseblaster devices. Other Pulseblaster labscript devices subclass this device and make the relevant changes to hard-coded values. Most importantly, the `core_clock_freq` must be manually set to match that of the Pulseblaster being used in order for the timing of the programmed pulses to be correct (in the `labscript_device` and the `BLACS_worker`).
4
+
This labscript device controls the Spincore PulseblaserDDS-II-300-AWG.
5
+
The Pulseblaster is a programmable pulse generator that is the typical timing backbone of an experiment (ie it generates the pseudoclock timing pulses that control execution of other devices in the experiment).
6
+
This labscript device is the master implementation of the various Pulseblaster devices.
7
+
Other Pulseblaster labscript devices subclass this device and make the relevant changes to hard-coded values.
8
+
Most importantly, the `core_clock_freq` must be manually set to match that of the Pulseblaster being used in order for the timing of the programmed pulses to be correct (in the `labscript_device` and the `BLACS_worker`).
5
9
6
10
This particular version of Pulseblaster has a 75 MHz core clock frequency and also has DDS synthesizer outputs.
7
11
8
12
Installation
9
13
~~~~~~~~~~~~
10
14
11
-
Use of the Pulseblaster requires driver installation available from the manufacturer `here <https://www.spincore.com/support/>`_. The corresponding python wrapper, `spinapi <https://github.com/chrisjbillington/spinapi/>`_ is available via pip.
15
+
Use of the Pulseblaster requires driver installation available from the manufacturer `here <https://www.spincore.com/support/>`_.
16
+
The corresponding python wrapper, `spinapi <https://github.com/chrisjbillington/spinapi/>`_ is available via pip.
0 commit comments