zwoasi¶
Contents:
Interface to ZWO ASI range of USB cameras.
Calls to the zwoasi module may raise TypeError or ValueError exceptions if an input argument
is incorrect. Failure conditions from within the module may raise exceptions of type ZWO_Error. Errors from
conditions specifically from the SDK C library are indicated by errors of type ZWO_IOError; certain
Camera.capture() errors are signalled by ZWO_CaptureError.
-
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. Type
numpy.ndarray.
-
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
ZWO_Errorwill 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 notNonethe image is saved usingPIL.Image.Image.save().capture_video_frame()will wait indefinitely unless a timeout has been given. The SDK suggests that the timeout value, in milliseconds, should be twice the exposure plus 500 ms.
-
close()¶ Close the camera in the ASI library.
The destructor will automatically close the camera if it has not already been closed.
-
get_bin()¶ 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.
-
get_roi()¶ Retrieves the region of interest (ROI).
Returns a
tuplecontaining(start_x, start_y, width, height).
-
get_video_data(timeout=None, buffer_=None)¶ Retrieve a single video frame. Type
bytearray.Low-level function to retrieve data. See
capture_video_frame()for a more convenient method to acquire an image (and optionally save it).
-
set_roi(start_x=None, start_y=None, width=None, height=None, bins=None, image_type=None)¶ Set the region of interest (ROI).
If
binsis not given then the current pixel binning value will be used. The ROI coordinates are considered after binning has been taken into account, ie ifbins=2then the maximum possible height is reduced by a factor of two.If
width=Noneorheight=Nonethen 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=Nonethen the ROI will be horizontally centred. Ifstart_y=Nonethen the ROI will be vertically centred.
-
start_video_capture()¶ Enable video capture mode.
Retrieve video frames with
capture_video_frame().
-
stop_video_capture()¶ Leave video capture mode.
-
-
exception
zwoasi.ZWO_CaptureError(message, exposure_status=None)¶ Exception class for when
Camera.capture()fails.
-
exception
zwoasi.ZWO_IOError(message, error_code=None)¶ Exception class for all errors returned from the ASI SDK library.