def model_to_dtc(self):
     dtc = DataTC()
     dtc.attrs = self.attrs
     try:
         dtc.backend = self.get_backend()
     except:
         dtc.backend = self.backend
     if hasattr(self, 'rheobase'):
         dtc.rheobase = self.rheobase
     return dtc
 def test_ap_threshold(self):
     from neuronunit.models.reduced import ReducedModel
     from neuronunit.optimization import get_neab
     from neuronunit.tests.waveform import InjectedCurrentAPThresholdTest as T
     from neuronunit.optimization.optimization_management import format_test
     from neuronunit.optimization.data_transport_container import DataTC
     dtc = DataTC()
     dtc.rheobase = self.rheobase
     dtc = format_test(dtc)
     self.model = ReducedModel(get_neab.LEMS_MODEL_PATH,
                               backend=('NEURON', {
                                   'DTC': dtc
                               }))
     #score = self.run_test(T)
     score = self.run_test(T, pred=self.rheobase)
     assert score.norm_score is not None
     self.assertTrue(score.norm_score is not None)
 def generate_prediction(self,model = None):
     if self.prediction is None:
         dtc = DataTC()
         dtc.backed = model.backend
         dtc.attrs = model.attrs
         dtc.rheobase = model.rheobase
         dtc.tests = [self]
         dtc = three_step_protocol(dtc)
         dtc,ephys0 = allen_wave_predictions(dtc,thirty=True)
         dtc,ephys1 = allen_wave_predictions(dtc,thirty=False)
         if self.name in ephys0.keys():
             feature = ephys0[self.name]
             self.prediction = {}
             self.prediction['value'] = feature
             #self.prediction['std'] = feature
         if self.name in ephys1.keys():
             feature = ephys1[self.name]
             self.prediction = {}
             self.prediction['value'] = feature
             #self.prediction['std'] = feature
         return self.prediction