import os
import neuronunit
NU = neuronunit.__path__[0]
from neuronunit.models.reduced import ReducedModel
# The regular Izhikevich model
model = ReducedModel(os.path.join(NU,'models/NeuroML2/LEMS_2007One.xml'))
# Same model with only explicitInput removed.
model_no_input_1 = ReducedModel(os.path.join(NU,'models/NeuroML2/fragments/LEMS_2007One-no-input-1.xml'))
# Same model with only pulseGenerator removed.
model_no_input_2 = ReducedModel(os.path.join(NU,'models/NeuroML2/fragments/LEMS_2007One-no-input-2.xml'))
assert model.has_pulse_generator() # Because the regular model should have the components it needs
assert not model_no_input_1.has_pulse_generator() # Because part of the implementation has been removed
assert not model_no_input_2.has_pulse_generator() # Because another part of the implemntation has been removed
from neuronunit.capabilities import ReceivesSquareCurrent, ProducesActionPotentials
ReceivesSquareCurrent.check(model) # Should return True
True
ReceivesSquareCurrent.check(model_no_input_1), ReceivesSquareCurrent.check(model_no_input_2) # Should return False, False
(False, False)
ProducesActionPotentials.check(model) # Should return True
True
# Should return True, True because the removed components have nothing to do with action potential generating capabilities
ProducesActionPotentials.check(model_no_input_1), ProducesActionPotentials.check(model_no_input_2)
(True, True)
# The first list should be empty because this model passes all extra capability checks. This list being empty
# means that it should be safe to use. The other two models will contain ReceivesSquareCurrent, because this check failed
# for each of those models.
model.failed_extra_capabilities, model_no_input_1.failed_extra_capabilities, model_no_input_2.failed_extra_capabilities
([], [neuronunit.capabilities.ReceivesSquareCurrent], [neuronunit.capabilities.ReceivesSquareCurrent])