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

ISI and CV test need to override VMTests.validate_observation method. #170

Open russelljjarvis opened 6 years ago

russelljjarvis commented 6 years ago

@rgerkin

ISI and CV test need to override VMTests.validate_observation method, but I need to learn what united_keys, nonunited_keys actually mean.

    def validate_observation(self, observation):
        super(LocalVariationTest,self).validate_observation(observation,
                                                     united_keys=['rheobase'],
                                                     nonunited_keys=['type'])

        assert ('type' in observation) and (observation['type'] in [1,2]), \
            ("observation['type'] must be either 1 or 2, corresponding to "
             "type 1 or type 2 threshold firing rate dynamics.")
rgerkin commented 6 years ago

"united" and "nonunited" refer to whether they have units or not (although it also looks like the more common meaning of "not divided", so sorry for the possible confusion. The "united" keys are checked to make sure they are instances from the quantities package, and that they have the units that the test requires (the test class's units attribute). "nonunited" keys are checked to make sure they are not from quantities, and that they are dimensionless.

The base class's validate_observation here implements all of this, and is general enough to validate observations in most of the derived tests. However, some other tests may need additional validation, so their validate_observation methods can call the base class's one via super and also implement additional validation of the observation.