def format_test(self):
        from neuronunit.optimisation.optimization_management import switch_logic, active_values, passive_values
        # pre format the current injection dictionary based on pre computed
        # rheobase values of current injection.
        # This is much like the hooked method from the old get neab file.
        self.protocols = {}
        if not hasattr(self,'tests'):
            self.tests = copy.copy(self.tests)
        if hasattr(self.tests,'keys'):# is type(dict):
            tests = [key for key in self.tests.values()]
            self.tests = switch_logic(tests)#,self.tests.use_rheobase_score)
        else:
            self.tests = switch_logic(self.tests)



        for v in self.tests:
            k = v.name
            self.protocols[k] = {}
            if hasattr(v,'passive'):#['protocol']:
                if v.passive == False and v.active == True:
                    keyed = self.protocols[k]#.params
                    self.protocols[k] = active_values(keyed,self.rheobase)
                elif v.passive == True and v.active == False:
                    keyed = self.protocols[k]#.params
                    self.protocols[k] = passive_values(keyed)

            if v.name in str('RestingPotentialTest'):
                self.protocols[k]['injected_square_current'] = {}
                self.protocols[k]['injected_square_current']['amplitude'] = 0.0*qt.pA
            keyed = v.params['injected_square_current']
            v.params['t_max'] = keyed['delay']+keyed['duration'] + 200.0*pq.ms
        return self.tests
def initialise_test(v,rheobase):
    v = switch_logic([v])
    v = v[0]
    k = v.name
    if not hasattr(v,'params'):
        v.params = {}
    if not 'injected_square_current' in v.params.keys():    
        v.params['injected_square_current'] = {}
    if v.passive == False and v.active == True:
        keyed = v.params['injected_square_current']
        v.params = active_values(keyed,rheobase)
        v.params['injected_square_current']['delay'] = DELAY
        v.params['injected_square_current']['duration'] = DURATION
    if v.passive == True and v.active == False:

        v.params['injected_square_current']['amplitude'] =  -10*pq.pA
        v.params['injected_square_current']['delay'] = PASSIVE_DELAY
        v.params['injected_square_current']['duration'] = PASSIVE_DURATION

    if v.name in str('RestingPotentialTest'):
        v.params['injected_square_current']['delay'] = PASSIVE_DELAY
        v.params['injected_square_current']['duration'] = PASSIVE_DURATION
        v.params['injected_square_current']['amplitude'] = 0.0*pq.pA    
        
    return v