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

Make Sciunit Optimize a method of NU test. #225

Open russelljjarvis opened 4 years ago

russelljjarvis commented 4 years ago

Make Sciunit Optimize a method of NU test.

This would mean creating a method inside the NU test class init.py or base.py of NU test class.

rgerkin commented 4 years ago

Much like there is test.judge(model), there should be test.optimize(model), at least for those test classes which support it (i.e. which have an optimization framework). This could be done via an Optimizable mix-in, e.g.:

class Optimizable:
   def optimize(self, model, **kwargs):
      [code here]

And then e.g. VmTest could have its signature redefined from class VmTest(sciunit.Test) to class VmTest(sciunit.Test, Optimizable).

russelljjarvis commented 4 years ago

I seem to have misunderstood the intention the first time I read this. What I did do instead is make a new test class that inherits from python dictionaries, and then make optimize a method of this new abstract dictionary. To meet your desired specifications, would require more work. I believe the feature is a type of syntactic sugar. I don't think we should be held up by it, as I don't think its critical for delivering a product.

https://github.com/russelljjarvis/neuronunit/blob/master/neuronunit/optimisation/optimization_management.py#L111-L127

rgerkin commented 4 years ago

Right, I think it can be part of a later refactoring step.