ARTIQ Network Device Support Package (NDSP) Integration for the PyVCAM Wrapper
PyVCAM Wrapper is a Python3.X wrapper for the PVCAM SDK. This project is a fork of the PyVCAM Wrapper developed by the Teledyne Photometrics team and is dependent on PyVCAM v2.1.5.
Follow the instructions below to get PyVCAM up and running on your machine for development and testing.
- An understanding of PVCAM is very helpful for understanding PyVCAM.
- A C/C++ compiler is needed to build native source code. For Windows, MSVC 1928 was used for testing.
- The newest version of Python 3 which can be downloaded here.
- The latest PVCAM and PVCAM SDK which can be downloaded here.
- PyVCAM was developed and tested using Microsoft Windows 10/64-bit. The build package also supports Linux, but testing has been minimal.
ARTIQ Integration with Network Device Support Packages (NDSP)
- Clone this repository into your Projects folder with the command
git clone git@github.com:quantumion/PyVCAM.git.
- Note: The following steps (2-3) may be skipped if installation is to be done in the default/user specified environment - virtual environment usage is not a requirement.
- Navigate into your PyVCAM folder and create a virtual environment with
virtualenv venv. - Activate your virtual environment with
source venv/bin/activate. - Install PyVCAM by running
pip install ..
- Run
python -m pyvcam. - Add flags to specify parameters. Add
-hto see a list of flags. - To specify a port, run with
python -m pyvcam -p <port number>. The default port is3249.- NOTE: You need to modify your
device_db.pyfile if you have changed the port number.
- NOTE: You need to modify your
- In your
device_db.pyfile, you will need to specify a remote port that your environment will connect to, as specified in the NDSP guide.
device_db = {
"pyvcam": {
"type": "controller",
"host": "::1", # Change this for a different host
"port": 3249, # Change this for a different port number
"command": "python -m pyvcam -p {port}"
}
... # The rest of your device_db
}
- In every ARTIQ experiment, you will need to initialize a pyvcam device within the
buildfunction.
def build(self):
self.setattr_device("pyvcam")
- Camera functions run like a normal function with
self.pyvcam.<function>(). - Functions with argument parameters may be input into parenthesis.
- Due to the implementation of the driver class, functions must also be modified from their default style. Follow the style in the "Driver Wrapper" columns as shown below.
- Example usage given that a camera object cam/self.pyvcam has already been created:
| Bare PyVCAM Class | Driver Wrapper | Result |
|---|---|---|
print(cam.gain) |
print(self.pyvcam.get_gain()) |
Prints current gain value as int |
cam.gain = 1 |
self.pyvcam.set_gain(1) |
Sets gain value to 1 |
This captures a single image with a 20 millisecond exposure time and prints the values of the first 5 pixels.
- Given that a camera object cam/self.pyvcam has already been created:
| Bare PyVCAM Class | Driver Wrapper |
|---|---|
frame = cam.get_frame(exp_time=20) |
frame = self.pyvcam.get_frame(exp_time=20) |
print("First five pixels of frame: {}, {}, {}, {}, {}".format(*frame[:5]))
This prints the current settings of the camera.
- Given that a camera object cam/self.pyvcam has already been created:
| Bare PyVCAM Class | Driver Wrapper |
|---|---|
print(cam.exp_mode) |
print(self.pyvcam.get_exp_mode()) |
print(cam.readout_port) |
print(self.pyvcam.get_readout_port()) |
print(cam.speed_table_index) |
print(self.pyvcam.get_speed_table_index()) |
print(cam.gain) |
print(self.pyvcam.get_gain()) |
This is an example of how to change some of the settings on the cameras.
- Given that a camera object cam/self.pyvcam has already been created:
| Bare PyVCAM Class | Driver Wrapper |
|---|---|
cam.exp_mode = "Internal Trigger" |
self.pyvcam.set_exp_mode("Internal Trigger") |
cam.readout_port = 0 |
self.pyvcam.set_readout_port(0) |
cam.speed_table_index = 0 |
self.pyvcam.set_speed_table_index(0) |
cam.gain = 1 |
self.pyvcam.set_gain(1) |
More information on how to use this wrapper and how it works can be found here.
TODO
Generating Documentation Using Sphinx
- Install Sphinx by entering
pip install -U sphinxin your terminal. - After installation, type
sphinx-build --versionin your terminal. A successful installation will return a version number.
- Ensure the PyVCAM Package is already installed in your environment as shown in the Initial Setup. This is important as the Sphinx configuration will read directly from the installation.
- Navigate to the
docs/folder. - Run the command
make html. This reads the.rstfiles indocs/source/and automatically generates documentation inhtmlformat indocs/build/.
Steve Bellinger
David Giese
Lubomír Walder
Zhengqi Hao
HerrZiffer
Kevin Chen
Collin Epstein
This program is developed and supported as part of the QuantumIon project at the Institute for Quantum Computing at the University of Waterloo.
This research was undertaken thanks in part to funding from the Canada First Research Excellence Fund.