Skip to content

Commit

Permalink
Adding efel.reset()
Browse files Browse the repository at this point in the history
  • Loading branch information
sasaray committed Jun 25, 2019
1 parent fca1511 commit 8200793
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 5 deletions.
6 changes: 5 additions & 1 deletion hippounit/tests/test_BackpropagatingAPTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ def find_current_amp(self, model, delay, dur, section_stim, loc_stim, section_re
amplitude = binsearch_result[1]
spikecount = binsearch_result[2]
elif i==0: #spikecount[i-1] is the last element here
if spikecounts[i] >= 10 and spikecounts[i] <= 20 and spikecounts[i+1] >= spikecounts[i]:
if spikecounts[i] >= 10 and spikecounts[i] <= 20 and spikecounts[i+1] >= spikecounts[i]:
amplitudes.append(amps[i])
_spikecounts.append(spikecounts[i])
elif spikecounts[i] < 10 and spikecounts[i+1] > 20 and spikecounts[i+1] >= spikecounts[i]:
Expand Down Expand Up @@ -697,6 +697,8 @@ def validate_observation(self, observation):
def generate_prediction(self, model, verbose=False):
"""Implementation of sciunit.Test.generate_prediction."""

efel.reset()

if self.base_directory:
self.path_results = self.base_directory + 'results/' + 'backpropagating_AP/' + model.name + '/'
else:
Expand Down Expand Up @@ -806,6 +808,8 @@ def generate_prediction(self, model, verbose=False):

self.plot_features(model, features, actual_distances)

efel.reset()

return prediction

def compute_score(self, observation, prediction, verbose=False):
Expand Down
4 changes: 4 additions & 0 deletions hippounit/tests/test_DepolarizationBlockTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,8 @@ def validate_observation(self, observation):
def generate_prediction(self, model, verbose=False):
"""Implementation of sciunit.Test.generate_prediction."""

efel.reset()

pool = multiprocessing.Pool(self.npool, maxtasksperchild=1)
#amps = numpy.arange(0,3.55,0.05)
amps = numpy.arange(0,1.65,0.05)
Expand All @@ -557,6 +559,8 @@ def generate_prediction(self, model, verbose=False):

prediction = {'model_I_maxNumAP':float(I_maxNumAP)*nA, 'model_I_below_depol_block':float(I_below_depol_block)*nA, 'model_Veq': float(Veq)*mV}

efel.reset()

return prediction

def compute_score(self, observation, prediction, verbose=False):
Expand Down
4 changes: 4 additions & 0 deletions hippounit/tests/test_ObliqueIntegrationTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -1637,6 +1637,8 @@ def validate_observation(self, observation):
def generate_prediction(self, model, verbose=False):
"""Implementation of sciunit.Test.generate_prediction."""

efel.reset()

if self.base_directory:
self.path_results = self.base_directory + 'results/' + 'oblique_integration/' + model.name + '/'
else:
Expand Down Expand Up @@ -1878,6 +1880,8 @@ def generate_prediction(self, model, verbose=False):

print "Results are saved in the directory: ", self.path_results

efel.reset()

return prediction

def compute_score(self, observation, prediction, verbose=False):
Expand Down
4 changes: 4 additions & 0 deletions hippounit/tests/test_PSPAttenuationTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,8 @@ def validate_observation(self, observation):
def generate_prediction(self, model, verbose=False):
"""Implementation of sciunit.Test.generate_prediction."""

efel.reset()

if self.base_directory:
self.path_results = self.base_directory + 'results/' + 'PSP_attenuation/' + model.name + '/'
else:
Expand Down Expand Up @@ -534,6 +536,8 @@ def generate_prediction(self, model, verbose=False):
file_name_mean_features = self.path_results + 'PSP_attenuation_mean_model_features.json'
json.dump(prediction, open(file_name_mean_features, "wb"), indent=4)

efel.reset()

return prediction

def compute_score(self, observation, prediction, verbose=False):
Expand Down
10 changes: 7 additions & 3 deletions hippounit/tests/test_SomaticFeaturesTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,9 @@ def analyse_traces(self, stimuli_list, traces_results, features_list):
stim_name=key
if stim_name == stimulus:

trace['T'] = traces_results[i][key][0]
trace['V'] = traces_results[i][key][1]
trace['T'] = traces_results[i][stim_name][0]
trace['V'] = traces_results[i][stim_name][1]


for i in range (0, len(stimuli_list)):
if stimuli_list[i][0]==stimulus:
Expand Down Expand Up @@ -360,6 +361,8 @@ def create_figs(self, model, traces_results, features_names, feature_results_dic
def generate_prediction(self, model, verbose=False):
"""Implementation of sciunit.Test.generate_prediction."""

efel.reset()

self.observation = collections.OrderedDict(sorted(self.observation.items()))

global model_name_soma
Expand All @@ -369,7 +372,6 @@ def generate_prediction(self, model, verbose=False):

stimuli_list=self.create_stimuli_list()


run_stim_ = functools.partial(self.run_stim, model)
traces_results = pool.map(run_stim_, stimuli_list, chunksize=1)
#traces_results = traces_result.get()
Expand Down Expand Up @@ -440,6 +442,8 @@ def generate_prediction(self, model, verbose=False):

prediction=soma_features

efel.reset()

return prediction

def compute_score(self, observation, prediction, verbose=False):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def package_files(directory):

setup(
name='hippounit',
version='1.2.3',
version='1.2.4',
author='Sara Saray, Szabolcs Kali, Christian Rossert, Andrew Davison, Shailesh Appukuttan',
author_email='[email protected], [email protected], [email protected], [email protected], [email protected]',
packages=['hippounit', 'hippounit.tests', 'hippounit.capabilities', 'hippounit.scores'],
Expand Down

0 comments on commit 8200793

Please sign in to comment.