Package: camera-zwo-asi
CAMERA-ZWO-ASIpython wrapper over ZWO astronomical camerasWhat is itcamera-zwo-asi is a python wrapper of the C++ SDK as provided byZWO. It provides a python object oriented interface for interacting with ZWO astronomical cameras.
The version of SDK currently binded is 1.24.
You may find the original C++ SDK binaries and documentationhere.Requirementscamera-zwo-asi has been tested only with :python 3.10 on Ubuntu 20.04python 3.9 on raspberry pi 3 (PI OS Lite 32-bit)but is likely to work with other recent version of python3 / ubuntu / raspberry. Compilation on other linux based platforms is less likely to be successful.DependenciesThe following APT dependencies are required:aptinstall-ylibusb-1.0-0-devlibgl1-mesa-glxlibglib2.0-devlibopencv-devpython3-devcmakeninja-buildlibusb-devFor raspberry, also install:apt install -y libatlas-base-devInstallationfrom PyPIpipinstallcamera-zwo-asifrom sourcegitclonehttps://github.com/MPI-IS/camera_zwo_asi.gitcdcamera_zwo_asi
pipinstall.allow your computer to reach your USB cameraRun:zwo-asi-udevand follow the instruction printed on screen.running unit-testsTests requires to have a usb camera plugged in.
After installation from source:cd camera_zwo_asi
pytest ./tests/test.pyCommand line usageThe following command line tools are provided:Information about connected camera(s)# will print information about connected cameraszwo-asi-printDumping the current configuration of the camera# will create in the current folder a file called 'zwo_asi.toml' which# contains the current configuration of the camerazwo-asi-dumpTaking pictures# Takes a picture and display it. If there is a file 'zwo-asi.toml' in the current# directory, configure first the camera using it.zwo-asi-shot# Same as above, but does not display the image.zwo-asi-shot-silent# Same as above, and also save the file to /tmp/img.bmp# For the list of supported file formats:# https://docs.opencv.org/2.4/modules/highgui/doc/reading_and_writing_images_and_video.html#imreadzwo-asi-shot-silent--path/tmp/img.bmp# Same as above, but ignores the 'zwo-asi.toml' file that may be in the# current directory.zwo-asi-shot-silent-noconfig--path/tmp/img.bmp# Same as above, but uses the second camera (index 1).# Will work only if at least two cameras are connected.zwo-asi-shot-silent-noconfig--path/tmp/img.bmp--index1# Getting info:zwo-asi-shot-hTaking pictures with the configuration of your choice# generate the file corresponding to the current camera's configurationzwo-asi-dump## edit zwo_asi.toml to your liking.## take a picture with your desired configurationzwo-asi-shotWhen setting up the configuration (by editingzwo_asi.toml), some controllable supports 'auto mode' and some are not writable. When callingzwo-asi-print, you may see which ones, by looking at the column 'auto-mode' and 'writable'. For example:(asi sdk: 1, 24, 0, 0)
ZWO ASI294MC Pro (id: 0)
max heigth: (2822) | max width: (4144) |
colored: * | mechanical shuttger: - | st4 port: - | 
has cooler: * | is usb3 host: * | is usb3: * | 
is triggered camera: - | bayer pattern: RG
supported bins: 1 2 3 4 
supported image types: raw8 rgb24 raw16 y8 
pixel size (um): 4.63 | elec per ADU: 0.399 | bit depth: 14

|controllable               |value   |min value |max value    |auto-mode  |in auto-mode  |writable
--
|AutoExpMaxExpMS            |30000   |1         |60000        |           |              |*
|AutoExpMaxGain             |285     |0         |570          |           |              |*
|AutoExpTargetBrightness    |100     |50        |160          |           |              |*
|BandWidth                  |80      |40        |100          |*          |*             |*
|CoolPowerPerc              |0       |0         |100          |           |              | 
|CoolerOn                   |0       |0         |1            |           |              |*
|Exposure                   |10000   |32        |2000000000   |*          |              |*
|Flip                       |0       |0         |3            |           |              |*
|Gain                       |200     |0         |570          |*          |              |*
|HighSpeedMode              |0       |0         |1            |           |              |*
|MonoBin                    |0       |0         |1            |           |              |*
|Offset                     |8       |0         |80           |           |              |*
|TargetTemp                 |0       |-40       |30           |           |              |*
|Temperature                |0       |-500      |1000         |           |              | 
|WB_B                       |95      |1         |99           |*          |              |*
|WB_R                       |52      |1         |99           |*          |              |*BandWidthsupports auto-mode and is currently in auto-mode,Exposuresupports auto-mode
but is not currently in auto-mode. Temperature is not writable.To set inzwo_asi.tomla controllable in auto mode, use the string "auto". For example, this sets BandWidth to auto-mode:[controllables]
AutoExpMaxExpMS = 30000
AutoExpMaxGain = 285
AutoExpTargetBrightness = 100
BandWidth = "auto"
CoolerOn = 0
Exposure = 10000
Flip = 0
Gain = 200
HighSpeedMode = 0
MonoBin = 0
Offset = 8
TargetTemp = 0
WB_B = 95
WB_R = 52There are also a few rules that has to be respected when setting the values of the ROI (Region Of Interest):the width and height are positive, and below the max allowed valuesthe width must be a multiple of 8the height must be a multiple of 2binned sensor width and height must be respected
(i.e. start_x + width < max_width / number bins; and
start_y + height < max_height / number_bins)For example, this respects these rules:[roi]
start_x = 0
start_y = 0
width = 4144
height = 2822
bins = 1
type = "raw8"note:when the camera closes, it restores its configuration. Therefore callingzwo-asi-printafter taking a picture withzwo-asi-shotmay not display the configuration that was used to take the picture.API usagefrompathlibimportPathimportcamera_zwo_asi# connecting to the camera# at index 0camera=camera_zwo_asi.Camera(0)# printing information in the# terminalprint(camera)# changing some controllables# (supported arguments: the one that are# indicated as 'writable' in the information# printed above)camera.set_control("Gain",300)camera.set_control("Exposure","auto")# changing the ROI (region of interest)roi=camera.get_roi()roi.type=camera_zwo_asi.ImageType.rgb24roi.start_x=20roi.start_y=20roi.bins=2roi.width=480roi.height=340camera.set_roi(roi)# saving this updated configuration to a fileconf_path=Path("/tmp")/"asi.toml"camera.to_toml(conf_path)# taking the picturefilepath=Path("/tmp")/"asi.bmp"show=True# filepath and show are optional, if you do not# want to save the image or display itimage=camera.capture(filepath=filepath,show=show)# getting a flat numpy array with the image dataimage.get_data()# getting a shaped numpy array with image dataimage.get_image()# showing the imageimage.display(resize=0.25)# saving the image (once more, for demo)image.save(filepath)# configuring the camera using a configuration filecamera.configure_from_toml(conf_path)# taking a picture, overwriting the previous imagecamera.capture(image=image)image.display(resize=1.5)Other projectpython-zwoasiis another python wrapper for ZWO cameras.Author and copyrightVincent Berenz, Max Planck Institute for Intelligent Systems, Empirical Inference DepartmentCopyright 2022 Max Planck Gesellschaft