Interface to ZWO ASI range of USB cameras.

class zwoasi.Camera(id_)

Representation of ZWO ASI camera.

The constructor for a camera object requires the camera ID number or model. The camera destructor automatically closes the camera.

capture(initial_sleep=0.01, poll=0.01, buffer_=None, filename=None)

Capture a still image.

capture_video_frame(buffer_=None, filename=None, timeout=None)

Capture a single frame from video. Type numpy.ndarray.

Video mode must have been started previously otherwise a ZWOException will be raised. A new buffer will be used to store the image unless one has been supplied with the buffer keyword argument. If filename is not None the image is saved using provided Camera.capture_video_frame() will wait indefinitely unless a timeout has been given. The suggested timeout value, in milliseconds, is twice the exposure plus 500 ms.


Close the camera in the ASI library.

The destructor will automatically close the camera if it has not already been closed.


Retrieves the pixel binning. Type int.

A pixel binning of one means no binning is active, a value of 2 indicates two pixels horizontally and two pixels vertically are binned.


Retrieves the region of interest (ROI).

Returns a tuple containing (start_x, start_y, width, height).

set_roi(start_x=None, start_y=None, width=None, height=None, bins=None, image_type=None)

Set the region of interest (ROI).

If bins is not given then the current pixel binning value will be used. The ROI coordinates are considered after binning has been taken into account, ie if bins=2 then the maximum possible height is reduced by a factor of two.

If width=None or height=None then the maximum respective value will be used. The ASI SDK library requires that width is a multiple of 8 and height is a multiple of 2; a ValueError will be raised if this is not the case.

If start_x=None then the ROI will be horizontally centred. If start_y=None then the ROI will be vertically centred.

exception zwoasi.ZWO_Exception

Exception class for all errors returned from the ASI library.


Retrieves the number of ZWO ASI cameras that are connected.


Retrieves model names of all connected ZWO ASI cameras. Type list of str.

Indices and tables