-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathLocationAnimation.py
64 lines (50 loc) · 1.89 KB
/
LocationAnimation.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
try:
import pygtk
pygtk.require("2.0")
except:
raise Exception()
import gtk
from Animation.AnimationWindow import MainWin as MainWin
import gobject as gobj
import logging
from Data.readData import load_mux, load_vl, load_wv, load_cl
from Analysis.matchClToVl import match_cl_to_vl
#from ContextPredictors.PiecewiseHMM import PiecewiseHMM
#from ContextPredictors.DotProduct import DotProduct
timeout_rate = 15
animation_step_size = 10
if __name__ == '__main__':
logging.basicConfig(level=logging.DEBUG)
room_shape = [[-55,55],[-55,55]]
animal = 66
session = 60
tetrode=3
fn, trigger_tm = load_mux(animal, session)
vl = load_vl(animal,fn)
cl = load_cl(animal,fn,tetrode)
wv = load_wv(animal,fn,tetrode)
wv_iters = match_cl_to_vl(cl['Time'],vl, trigger_tm)
#WAVE_L = WR.read(vl[2],vl[3], is_clockwise(*vl[2:6]))
#actual_prediction = np.array([is_clockwise(x,y,vx,vy) for
# x,y,vx,vy in zip(*vl.values()[2:6])])
#logging.info('Starting to generate waveforms...')
#global WAVE_L
#WAVE_L = WR.read(vl[2],vl[3],actual_prediction)
#WAVE_L = np.array([WR.read(x,y,actual) for actual, x,y in zip(actual_prediction, *vl[2:4])])
#logging.info('Finished generating waveform.')
'''
HMM = PiecewiseHMM(vl[2],vl[3],WAVE_L,actual_prediction)
comps = np.array([len(hmm_tup[1].means_) if hmm_tup is not None else 0 for hmm_tup in HMM.HMMs])
side_of_arr = int(np.sqrt(len(comps)))
comps = comps.reshape([side_of_arr,side_of_arr])
print comps'''
#HMM.make_predictions()
#HMM.print_perc_correct()
#physical = rand_walk(step_num=1000,step_size=.05)
CPr = None
top = MainWin(step=animation_step_size)
top.init_ER(vl, room_shape)
#top.init_WR(wv, cl, wv_iters)
top.add_predictor(CPr)
gobj.timeout_add(timeout_rate,top.update)
gtk.main()