scidash / neuronunit

A package for data-driven validation of neuron and ion channel models using SciUnit
http://neuronunit.scidash.org
38 stars 24 forks source link

Problems with neo/python3.5: AttributeError: 'AnalogSignal' object has no attribute 'time_slice' #132

Closed russelljjarvis closed 6 years ago

russelljjarvis commented 6 years ago

After satisfying previous problem with dimensions of array in time constant test:


    AttributeError                            Traceback (most recent call last)
    <string> in <module>()

    /opt/conda/lib/python3.5/site-packages/ipyparallel/client/remotefunction.py in <lambda>(f, *sequences)
    248             if _mapping:
    249                 if sys.version_info[0] >= 3:
--> 250                     f = lambda f, *sequences: list(map(f, *sequences))
    251                 else:
    252                     f = map

    /home/jovyan/neuronunit/neuronunit/optimization/exhaustive_search.py in parallel_method(dtc)
     52         if k!=0 and k!=2:
     53             t.params = dtc.vtest[k]
---> 54             score = t.judge(model,stop_on_error = False, deep_error = True)
     55             dtc.scores[str(t)] = score.sort_key
     56 

    /opt/conda/lib/python3.5/site-packages/sciunit-0.1.5.8-py3.5.egg/sciunit/__init__.py in judge(self, model, skip_incapable, stop_on_error, deep_error)
    308 
    309         if deep_error:
--> 310             score = self._judge(model, skip_incapable=skip_incapable)
    311         else:
    312             try:

    /opt/conda/lib/python3.5/site-packages/sciunit-0.1.5.8-py3.5.egg/sciunit/__init__.py in _judge(self, model, skip_incapable)
    256         self.check_capabilities(model, skip_incapable=skip_incapable)
    257         # 2.
--> 258         prediction = self.generate_prediction(model)
    259         self.last_model = model
    260         # 3.

    /home/jovyan/neuronunit/neuronunit/tests/waveform.py in generate_prediction(self, model)
     69     def generate_prediction(self, model):
     70         model.inject_square_current(self.params['injected_square_current'])
---> 71         prediction = super(InjectedCurrentAPWidthTest,self).generate_prediction(model)
     72 
     73         return prediction

    /home/jovyan/neuronunit/neuronunit/tests/waveform.py in generate_prediction(self, model)
     28         model.rerun = True
     29 
---> 30         widths = model.get_AP_widths()
     31         # Put prediction in a form that compute_score() can use.
     32         prediction = {'mean':np.mean(widths) if len(widths) else None,

    /home/jovyan/neuronunit/neuronunit/capabilities/__init__.py in get_AP_widths(self)
     80 
     81     def get_AP_widths(self):
---> 82         action_potentials = self.get_APs()
     83         widths = spikes2widths(action_potentials)
     84         return widths

    /home/jovyan/neuronunit/neuronunit/models/reduced.py in get_APs(self, rerun, **run_params)
     44     def get_APs(self, rerun=False, **run_params):
     45         vm = self.get_membrane_potential(rerun=rerun, **run_params)
---> 46         waveforms = sf.get_spike_waveforms(vm)
     47         return waveforms
     48 

    /home/jovyan/neuronunit/neuronunit/capabilities/spike_functions.py in get_spike_waveforms(vm, threshold, width)
     42                                              units=spike_train.units)
     43 
---> 44     snippets = [vm.time_slice(t-width/2,t+width/2) for t in spike_train]
     45     result = neo.core.AnalogSignal(np.array(snippets).T.squeeze(),
     46                                    units=vm.units,

    /home/jovyan/neuronunit/neuronunit/capabilities/spike_functions.py in <listcomp>(.0)
     42                                              units=spike_train.units)
     43 
---> 44     snippets = [vm.time_slice(t-width/2,t+width/2) for t in spike_train]
     45     result = neo.core.AnalogSignal(np.array(snippets).T.squeeze(),
     46                                    units=vm.units,

    AttributeError: 'AnalogSignal' object has no attribute 'time_slice'
E
======================================================================
rgerkin commented 6 years ago

I'm not having this problem in the master branch. Can you give me a formula for reproducing it?

rgerkin commented 6 years ago

This appears to be related to having the wrong version of Neo or NeuronUnit in your Docker container.