You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Time dependant functions is not working for stratified parameters, because of bug in parameter check.
What I Did
The specified time-dependent parameter 'alpha' is not an existing model parameter
in _validate_time_dependent_parameters(self)
all_param_names = model.parameter_names.copy()
for lst in model.parameters_stratified_names:
all_param_names.extend(lst)
if model.stratification:
all_param_names.extend(model.stratification)
print(all_param_names)
Note that in the following model, there is one stratified parameter alpha, which is stratified according to the only stratification Nc in this model. If the parameter alpha is defined as a list inside a list in the parameters_stratified_names.
class ODE_influenza_model(BaseModel):
"""
Simple SEIR model for influenza with undetected carriers
"""
state_names = ['S','E','Ia','Im','R','Im_inc']
parameter_names = ['beta','sigma','f_a','gamma']
parameters_stratified_names = [['alpha'],]
stratification = ['Nc']
@staticmethod
def integrate(t, S, E, Ia, Im, R, Im_inc, beta, sigma, f_a, gamma, alpha, Nc):
# Calculate total population
T = S+E+Ia+Im+R
# Calculate differentials
dS = -beta*Nc@((Ia+Im)*S/T)
dE = beta*Nc@((Ia+Im)*S/T) - 1/sigma*E
dIa = f_a*E/sigma - 1/gamma*Ia
dIm = (1-f_a)/sigma*E - 1/gamma*Im
dR = 1/gamma*(Ia+Im)
# Calculate incidence mild disease
dIm_inc_new = (1-f_a)/sigma*E - Im_inc
return dS, dE, dIa, dIm, dR, dIm_inc_new
Technical questions
Description
Time dependant functions is not working for stratified parameters, because of bug in parameter check.
What I Did
in
_validate_time_dependent_parameters(self)
output:
['Ki', 'Kp', 'covid_H', 'covid_dH', 'covid_min', 'a', 'l', 'p', 'h', 'a', 'b', 'e', 't', 'a', 'g', 'a', 'm', 'm', 'a', 'MDC_keys']
Solution
Change
extend
toappend
The text was updated successfully, but these errors were encountered: