-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmake_allen_tests.py
61 lines (50 loc) · 2.04 KB
/
make_allen_tests.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
from neuronunit.tests.base import VmTest
import pickle
import numpy as np
from allensdk.core.cell_types_cache import CellTypesCache
class AllenTest(VmTest):
def __init__(self,
observation={'mean': None, 'std': None},
name='generic_allen',
prediction={'mean': None, 'std': None},
**params):
#super(self,VmTest).__init__()
super(AllenTest, self).__init__(observation, name, **params)
#required_capabilities = (scap.Runnable, ncap.ProducesMembranePotential,)
name = ''
# units = pass #
# ephysprop_name = ''
aliases = ''
def generate_prediction(self,model = None):
from neuronunit.optimisation.optimization_management import allen_wave_predictions
if model is None:
return self.prediction
else:
dtc = model.model_to_dtc()
dtc,ephys0 = allen_wave_predictions(dtc,thirty=True)
dtc,ephys1 = allen_wave_predictions(dtc,thirty=False)
if name in ephys0.keys():
feature = ephys0['name']
self.prediction = {}
self.prediction['mean'] = feature
self.prediction['std'] = feature
if name in ephys1.keys():
feature = ephys1['name']
self.prediction = {}
self.prediction['mean'] = feature
self.prediction['std'] = feature
return self.prediction
#ephys1.update()
#if not len(self.prediction.keys()):
def compute_params(self):
self.params['t_max'] = (self.params['delay'] +
self.params['duration'] +
self.params['padding'])
def set_observation(self,observation):
self.observation = {}
self.observation['mean'] = observation
self.observation['std'] = observation
def set_prediction(self,prediction):
self.prediction = {}
self.prediction['mean'] = prediction
self.prediction['std'] = prediction