add check so that time constants cannot be negative
This commit is contained in:
parent
c841bed77e
commit
f41b6bdb78
@ -1,5 +1,6 @@
|
||||
|
||||
from stimuli.AbstractStimulus import AbstractStimulus
|
||||
from warnings import warn
|
||||
|
||||
|
||||
class AbstractModel:
|
||||
@ -77,6 +78,10 @@ class AbstractModel:
|
||||
if key not in self.DEFAULT_VALUES.keys():
|
||||
raise ValueError("Given key is unknown!\n"
|
||||
"Please check spelling and refer to list LIFAC.KEYS.")
|
||||
if "tau" in key and value < 0:
|
||||
warn("Time constants cannot be negative! Setting it to 0.5ms")
|
||||
self.parameters[key] = 0.00005
|
||||
return
|
||||
self.parameters[key] = value
|
||||
|
||||
def _set_default_parameters(self):
|
||||
@ -87,3 +92,7 @@ class AbstractModel:
|
||||
if k not in self.DEFAULT_VALUES.keys():
|
||||
err_msg = "Unknown key in the given parameters:" + str(k)
|
||||
raise ValueError(err_msg)
|
||||
|
||||
if "tau" in k and params[k] < 0:
|
||||
warn("Time constants cannot be negative setting" + str(k) + "0.5ms")
|
||||
params[k] = 0.00005
|
||||
|
Loading…
Reference in New Issue
Block a user