Skip to main content

Modern python bindings for ZWO ASI astronomical cameras

Project description

pypi versions License: MIT zwoasi/test

zwoasi

Modern, type-safe, zero-dependency Python library for controlling ZWO ASI astronomical cameras.

Installation

pip install zwo

or

using your preferred environment / package manager of choice, e.g., poetry, conda or uv:

poetry add zwo
conda install zwo
uv add zwo

Linux Setup

To check if you any ZWO ASI cameras connected, run the following command:

lsusb | grep 03c3

N.B. The 03c3 is the vendor ID for ZWO.

You should see something like this as your output:

Bus 001 Device 016: ID 03c3:620b ZWO ASI6200MM Pro

To allow non-root users to access the ASI camera, you need to create a udev rule. Firstly, create the .rules file:

cat <<EOF > asi.rules
ACTION=="add", ATTR{idVendor}=="03c3", RUN+="/bin/sh -c '/bin/echo 200 >/sys/module/usbcore/parameters/usbfs_memory_mb'"
SUBSYSTEMS=="usb", ATTR{idVendor}=="03c3", MODE="0666"
EOF

The following command will copy the rule to the correct location:

sudo install asi.rules /lib/udev/rules.d
sudo udevadm control --reload-rules && sudo udevadm trigger

Once you have done this, check that the camera is accessible by running the following command:

ls -l /dev/bus/usb/$(lsusb | grep 03c3:620b | awk '{print $2}')/$(lsusb | grep 03c3:620b | awk '{print $4}' | tr -d :)

You should see something like this:

crw-rw-rw- 1 root root 189, 0 Jan  1 00:00 /dev/bus/usb/001/001

i.e., the camera is accessible by all users with permissions crw-rw-rw- with a mode of MODE=0666.

Then when you have verified these steps, run the following command:

cat /sys/module/usbcore/parameters/usbfs_memory_mb

If the output is anything other than 200, something has gone wrong. To fix, simply follow the steps above again.

Once you have verified that the camera is accessible, if you reconnect the camera by unplugging it from the UBS port and plugging it back in, you can now use the zwo library to control the camera.

MacOS Setup

There is no additional setup required for MacOS.

Windows Setup

There is no additional setup required for Windows.

Usage

from zwo import ZWOASICamera, ZWOASICameraParams

# Let's assume the camera ID is 0 (e.g., only 1 camera is connected):
id = 0

# Create a new camera parameters instance (for demonstration purposes we are
# connecting to a ASI62000M Pro model) which has a pid of "620b":
# N.B. Replace the pid with the correct one for your camera model.
pid: str = "620b"

params: ZWOASICameraParams = ZWOASICameraParams(pid=pid)

# Create a new camera instance:
zwo = ZWOASICamera(id, params)

# Check if the camera is ready:
is_ready = zwo.is_ready()

if not is_ready:
    print("Camera is not ready!")
    exit(1)

As the zwo instance is fully typed, you can use your IDE's autocompletion to see all the available methods and properties.

We have also provided further usage examples in the examples directory.

Milestones

  • Type-safe modern 3.6+ Python
  • Portable .h, .so and .dylib files for Linux and MacOS
  • Portable .dll files for Windows
  • Fully unit tested
  • Simpler API (modelled around the ASCOM Alpaca API)
  • Integration testing with HIL testing (hardware-in-the-loop)
  • Zero-external dependencies (no numpy, astropy etc for portability)
  • Example API usage
  • Fully supported ZWO ASI Camera operations
  • Fully supported ZWO Electronic Automatic Focuser operations
  • Fully supported ZWO Filter Wheel operations
  • Fully seasoned recipes for usage with numpy, astropy et al.
  • ASCOM Alpaca APIs w/Fast API

Miscellaneous

For more information on the ZWO ASI SDK, please visit the ZWO ASI SDK website.

Disclaimer

This project is not affiliated with ZWO ASI in any way. It is a community-driven project. All trademarks and logos are the property of their respective owners. The ZWO ASI SDK is the property of ZWO ASI.

License

This project is licensed under the terms of the MIT license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zwo-0.5.1.tar.gz (20.7 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

zwo-0.5.1-py3-none-any.whl (27.7 MB view details)

Uploaded Python 3

File details

Details for the file zwo-0.5.1.tar.gz.

File metadata

  • Download URL: zwo-0.5.1.tar.gz
  • Upload date:
  • Size: 20.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for zwo-0.5.1.tar.gz
Algorithm Hash digest
SHA256 ebf7c67eaec93d1b7cf76d951b4a3d6cc0192ff60ed3e8c6e69dad38232b310e
MD5 3090344f0e254d916378530085cedd90
BLAKE2b-256 35c905199fdf0ecce5b92a0b07d58c699bd1d8663a08e9b3c3e65d4613cb5156

See more details on using hashes here.

Provenance

The following attestation bundles were made for zwo-0.5.1.tar.gz:

Publisher: publish.yml on michealroberts/zwoasi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file zwo-0.5.1-py3-none-any.whl.

File metadata

  • Download URL: zwo-0.5.1-py3-none-any.whl
  • Upload date:
  • Size: 27.7 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for zwo-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5fa02fed24bac750ac421f8c82cc7e3c63be68e4cfbf15caade1ae126b84d3d7
MD5 a4f9cf1e1f2ff9824f4c5e2ceb7da351
BLAKE2b-256 c45be8eb554289f9bc3fd2de84d2e6ed0646a5f7d71ecb436511200f305b4a08

See more details on using hashes here.

Provenance

The following attestation bundles were made for zwo-0.5.1-py3-none-any.whl:

Publisher: publish.yml on michealroberts/zwoasi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page