-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathZionMain.py
71 lines (59 loc) · 2.3 KB
/
ZionMain.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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from fractions import Fraction
from ZionSession import ZionSession
from Camera.ZionCamera import ZionCameraParameters
from GUI.ZionGtk import check_for_valid_filename
# TODO: make pip requirements file
# TODO: move this to a double-clickable executable (ie no need to IDE)
########################################################################
######################### User-Level Settings ##########################
########################################################################
# Session Name: This will be the name of the folder (prefixed with datetime info and suffixed with index).
# NOTE: No underscores allowed in session name!
Session_Name = 'TS'
if not check_for_valid_filename(Session_Name):
raise Exception("Invalid character (or whitespace) found in session name!")
# Camera Properties:
# These can't change while camera is open:
Binning = False
# w/ binning: 0.1 < framerate < 42
# w/o binning: 0.05 < framerate < 10 fps
#Default Values:
Initial_Values = ZionCameraParameters(
brightness= 50,
contrast= -2,
saturation= 0,
sharpness= 0,
awb_mode= 'off',
red_gain= Fraction(2,1),
blue_gain= Fraction(2,1),
exposure_mode= 'off',
shutter_speed= 250000,
analog_gain= Fraction(8,1),
digital_gain= Fraction(1,1),
framerate= 1,
vflip= True,
)
PID_Params = {
'Target_Temperature': 58,
'PWM_Frequency': 10,
'P': 500,
'I': 25,
'delta_t': 1, #makes no difference as of now (TODO: speed up?)
'bias': 0,
}
########################################################################
############################# Main Script ##############################
########################################################################
# Initialization Block:
mySession = ZionSession(Session_Name, Binning, Initial_Values, PID_Params)
#Start preview:
# ~ mySession.InteractivePreview(window=(560,75,640,480))
# mySession.InteractivePreview(window=(1172,75,720,540))
mySession.StartSession()
########################################################################
######################### Shutdown Script ##############################
########################################################################
# Shut down Turn LEDs off and turns off camera
mySession.QuitSession()