-
Notifications
You must be signed in to change notification settings - Fork 2
/
optimal_window.py
73 lines (53 loc) · 1.79 KB
/
optimal_window.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
# Code written by Saptarshi Ghosh
import numpy as np
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import cross_val_score
import scipy.optimize
from matplotlib import pyplot as plt
%matplotlib inline
import seaborn as sns
sns.set()
"""
Determine optimal window size for reward decoding
"""
example_master_dict_res={'VISrl' : [], 'MG' : [],'NB' : [],'CA2' : [],'SPF' : []}
targetneurons = ['VISrl', 'MG','NB','CA2','SPF']
for u in targetneurons:
targetneurons=[u]
for j in range(10,90,10): #before
total_length=j
vals=[]
for i in range(0,40,10): # afetr
pre=j
post=i
windowVals=[pre/100,post/100]
try:
ff=get_accuracy(targetneurons,windowVals,label ='response')
vals.append([windowVals,ff,j+1])
except:
vals.append([windowVals,0.0,j+1])
print("Error!")
master_dictexample_master_dict_res_res[u].append(vals)
print("Brain Area:",u," ",total_length/100,"sec")
"""
Determine optimal window size for response decoding
"""
example_master_dict={'MEA' : [],'CA' : [],'PT' : [],'MOp' : [],'PAG' : []}
targetneurons = ['MEA','CA','PT','MOp','PAG']
for u in targetneurons:
targetneurons=[u]
for j in range(20,220,10):
total_length=j
vals=[]
for i in range(10,total_length,10):
pre=total_length-i
post=i
windowVals=[pre/100,post/100]
try:
ff=get_accuracy(targetneurons,windowVals,label ='feedback_type')
vals.append([windowVals,ff,total_length])
except:
vals.append([windowVals,0.0,total_length])
print("Error!")
example_master_dict[u].append(vals)
print("Brain Area:",u," ",total_length/100,"sec")