-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathfits_capture.py
More file actions
28 lines (22 loc) · 858 Bytes
/
fits_capture.py
File metadata and controls
28 lines (22 loc) · 858 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from allsky import AllSkyCamera
import serial
import argparse, sys
def capture_image(device, exposure_time, savefile):
try:
cam = AllSkyCamera(device)
cam.open_shutter()
print('Downloading image ...')
image = cam.get_image(exposure=exposure_time)
image.writeto(savefile)
except serial.serialutil.SerialException as err:
print(str(err))
sys.exit(2)
def main():
parser = argparse.ArgumentParser()
parser.add_argument('-d', '--device', help='Path to serial device', default='/dev/usbserial')
parser.add_argument('-e', '--exposure', type=float, help='Exposure time in seconds', default=1.0)
parser.add_argument('path', help='Filename to save image')
args = parser.parse_args()
capture_image(args.device, args.exposure, args.path)
if __name__ == '__main__':
main()