nerdfever.com
nerdfever.com

Reputation: 1782

Python script for controlling ASCOM CCD camera?

I want to control a CCD astronomical camera in Python using the ASCOM driver, but haven't found an example script to show how it's done.

I'd like to see how basic control of the camera is done - set exposure length, start exposure, download image data.

Can someone post an example Python script I can use as a starting point?

Upvotes: 5

Views: 3868

Answers (1)

saranova
saranova

Reputation: 86

import win32com.client
from astropy.io import fits

# if you don't know what your driver is called, use the ASCOM Chooser
#x = win32com.client.Dispatch("ASCOM.Utilities.Chooser")
#x.DeviceType = 'Camera'
#driver = x.Choose(None)

# otherwise, just use it
driver = "ASCOM.AtikCameras.Camera"

camera = win32com.client.Dispatch(driver)
camera.connected = True
camera.CoolerOn = True

openshutter = True # False will take a dark frame
exptime = 1
camera.StartExposure(exptime,openshutter)
image = camera.ImageArray

hdu = fits.PrimaryHDU(image)
hdu.writeto('test.fits')

# see more camera methods/properties here:
# https://ascom-standards.org/Help/Developer/html/T_ASCOM_DriverAccess_Camera.htm

Upvotes: 4

Related Questions