-
Notifications
You must be signed in to change notification settings - Fork 0
/
image_test.py
74 lines (55 loc) · 2.45 KB
/
image_test.py
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import platform
import time
from andorLib import *
from astropy.io import fits
import matplotlib.pyplot as plt
output_dir = os.path.abspath('/home/alex/fits_images/Andor_test_one.fits')
fig, ax = plt.subplots(nrows=1, ncols=1)
ax.set_ylabel('Detector Temperature [Celsius]')
ax.set_xlabel('Time [Sec]')
ax.set_ylim(ymin=-100, ymax=60)
run_command = input('[SYSTEM MESSAGE] Begin Initialization? [y/n]: ')
if run_command == 'y' or run_command == '':
andor = Andor()
andor.loadLibrary()
print('[DETECTING OPERATING SYSTEM]')
print(f' -> OS INFO = {platform.platform()}')
print('[DETERMINING NUMBER OF CONNECTED CAMERAS]')
connected_cams = andor.GetAvailableCameras()
print(f' -> STATUS: [{connected_cams[0]}]')
print(f' -> CONNECTED CAMERAS: {connected_cams[1]}')
print(f'[DETERMINING CAMERA HANDLE]')
cam_handle = andor.GetCameraHandle(connected_cams[1]-1)
print(f' -> STATUS: [{cam_handle[0]}]')
print(f' -> CAMERA HANDLE: {cam_handle[1]}')
print(f'[SETTING ACTIVE CAMERA TO HANDLE]')
cam_set = andor.SetCurrentCamera(cam_handle[1])
print(f' -> STATUS: [{cam_set}]')
initialize_command = input('[SYSTEM MESSAGE] Initialize Camera? [y/n]: ')
if initialize_command == 'y' or initialize_command == '':
initialize = andor.Initialize()
andor.GetCameraSerialNumber()
andor.SetReadMode(mode=4)
andor.SetAcquisitionMode(mode=1)
andor.SetVSSpeed(index=1)
andor.SetHSSpeed(typ=0, index=2)
andor.SetPreAmpGain(index=0)
andor.SetExposureTime(0.1)
andor.SetShutter(1, 0, 20, 20)
detector_dimensions = andor.GetDetector()
andor.SetImage(hbin=1, vbin=1, hstart=1, hend=detector_dimensions[1], vstart=1, vend=detector_dimensions[2])
andor.GetDetector()
take_image_command = input('[SYSTEM MESSAGE] Take Image? [y/n]: ')
if take_image_command == 'y' or take_image_command == '':
andor.StartAcquisition()
data = []
andor.GetAcquiredData16(data)
andor.SaveAsTxt(path=f'/home/alex/fits_images/savefits_tests/test_data.txt')
#andor.SaveAsFITS(FileTitle='test.fits', typ=0)
#andor.saveFits(data)
if take_image_command == 'n':
print('Image Acquisition Cancelled: Shutting Down')
if initialize_command == 'n':
print('Initialization Cancelled: Shutting Down')
if run_command == 'n':
print('Initialization Cancelled: Shutting Down')