Open woldmuyn opened 1 year ago
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
as opposed to,
parameters_stratified_names = ['alpha',]
Then the TDPFs do work..
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