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

The file get_neab.py should be re-written as a function. #174

Closed russelljjarvis closed 6 years ago

russelljjarvis commented 6 years ago

The function takes neurolex_id

and returns observations and paramaterized NU test suits.

The problem is what to do with AIBS observations, which are available a bit less often.

def get_neuron_criteria(cell_id,file_name=None):
    from neuronunit import tests as nu_tests, neuroelectro
    from neuronunit.tests import passive, waveform, fi
    #
    tests = []
    #observation =  fi.neuroelectro_summary_observation(fi_basket)
    tests += [fi.RheobaseTestP(observation=observation)]
    test_class_params = [(fi.RheobaseTest,None),
                     (passive.InputResistanceTest,None),
                     (passive.TimeConstantTest,None),
                     (passive.CapacitanceTest,None),
                     (passive.RestingPotentialTest,None),
                     (waveform.InjectedCurrentAPWidthTest,None),
                     (waveform.InjectedCurrentAPAmplitudeTest,None),
                     (waveform.InjectedCurrentAPThresholdTest,None)]#,
    inh_observations = []
    for cls,params in test_class_params:
        inh_observations.append(cls.neuroelectro_summary_observation(cell_id))
        tests += [cls(inh_observations[-1])]

    hooks = {tests[0]:{'f':update_amplitude}} #This is a trick to dynamically insert the method
    #update amplitude at the location in sciunit thats its passed to, without any loss of generality.
    suite = sciunit.TestSuite("vm_suite",tests)#
    if file_name is not None:
        file_name = file_name +'.p'
        with open(file_name, 'wb') as f:
            pickle.dump(tests, f)
    return tests, inh_observations
russelljjarvis commented 6 years ago

Done