forked from esutlie/behavior_code
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgui_functions.py
More file actions
61 lines (46 loc) · 1.45 KB
/
gui_functions.py
File metadata and controls
61 lines (46 loc) · 1.45 KB
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
from support_classes import *
from time import sleep
from timescapes import *
import RPi.GPIO as GPIO
import random
import pickle
def run_behavior(mouse):
print(f"running behavior for {mouse}")
def calibrate(port):
print(f'calibrating port {port}')
with open('stand_alone/durations.pkl', 'rb') as f:
durations = pickle.load(f)
GPIO.setmode(GPIO.BCM)
port_object = Port(port, dist_info='filler', duration=durations[port])
for _ in range(100):
port_object.sol_on()
sleep(port_object.base_duration)
port_object.sol_off()
sleep(.1)
def increase(port):
with open('stand_alone/durations.pkl', 'rb') as f:
durations = pickle.load(f)
durations[port] += .0005
print(f'increasing port {port} to {durations[port]}')
with open('stand_alone/durations.pkl', 'wb') as f:
pickle.dump(durations, f)
def decrease(port):
with open('stand_alone/durations.pkl', 'rb') as f:
durations = pickle.load(f)
durations[port] -= .0005
print(f'decreasing port {port} to {durations[port]}')
with open('stand_alone/durations.pkl', 'wb') as f:
pickle.dump(durations, f)
def reset():
print('resetting task')
def stop():
print('stopping task')
def party():
print('partying')
#
# if __name__ == '__main__':
# durations = {1: .01,
# 2: .01,
# 3: .01}
# with open('durations.pkl', 'wb') as f:
# pickle.dump(durations, f)