我想使用 ASCOM 驱动程序在 Python 中控制一个 CCD 天文相机,但还没有找到一个示例脚本来展示它是如何完成的。
我想看看相机的基本控制是如何完成的——设置曝光长度、开始曝光、下载图像数据。
有人可以发布一个我可以用作起点的示例 Python 脚本吗?
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