[x] I have checked to ensure there aren't other open Pull Requests for the same update/change
[x] I have updated the documentation accordingly.
Describe your fixes/additions/changes
This PR may break existing code but is easy to fix
Addresses issue #50.
Models were previously defined as follows,
class ODE_influenza_model(ODEModel):
"""
Simple SEIR model for influenza with undetected carriers
"""
state_names = ['S','E','Ip','Iud','Id','R','Im_inc']
parameter_names = ['alpha', 'beta', 'gamma', 'delta','N']
parameter_stratified_names = ['f_ud']
dimension_names = ['age_group']
@staticmethod
def integrate(t, S, E, Ip, Iud, Id, R, Im_inc, alpha, beta, gamma, delta, N, f_ud):
# Calculate total population
T = S+E+Ip+Iud+Id+R
# Calculate differentials
dS = -beta*N@((Ip+Iud+0.22*Id)*S/T)
dE = beta*N@((Ip+Iud+0.22*Id)*S/T) - 1/alpha*E
dIp = 1/alpha*E - 1/gamma*Ip
dIud = f_ud/gamma*Ip - 1/delta*Iud
dId = (1-f_ud)/gamma*Ip - 1/delta*Id
dR = 1/delta*(Iud+Id)
# Calculate incidence mild disease
dIm_inc_new = (1-f_ud)/gamma*Ip - Im_inc
return dS, dE, dIp, dIud, dId, dR, dIm_inc_new
But I found the _names suffix to state_names, parameter_names etc quite redundant so I changed it into states, parameters etc. See below, this PR may break existing code.
class ODE_influenza_model(ODEModel):
"""
Simple SEIR model for influenza with undetected carriers
"""
states = ['S','E','Ip','Iud','Id','R','Im_inc']
parametes = ['alpha', 'beta', 'gamma', 'delta','N']
stratified_parameters = ['f_ud']
dimensions = ['age_group']
@staticmethod
def integrate(t, S, E, Ip, Iud, Id, R, Im_inc, alpha, beta, gamma, delta, N, f_ud):
# Calculate total population
T = S+E+Ip+Iud+Id+R
# Calculate differentials
dS = -beta*N@((Ip+Iud+0.22*Id)*S/T)
dE = beta*N@((Ip+Iud+0.22*Id)*S/T) - 1/alpha*E
dIp = 1/alpha*E - 1/gamma*Ip
dIud = f_ud/gamma*Ip - 1/delta*Iud
dId = (1-f_ud)/gamma*Ip - 1/delta*Id
dR = 1/delta*(Iud+Id)
# Calculate incidence mild disease
dIm_inc_new = (1-f_ud)/gamma*Ip - Im_inc
return dS, dE, dIp, dIud, dId, dR, dIm_inc_new
Might decide to drop the stratified parameters concept to make the code more sleak but still undecided atm.
Describe your fixes/additions/changes
This PR may break existing code but is easy to fix
Addresses issue #50.
Models were previously defined as follows,
But I found the
_names
suffix tostate_names
,parameter_names
etc quite redundant so I changed it intostates
,parameters
etc. See below, this PR may break existing code.Might decide to drop the stratified parameters concept to make the code more sleak but still undecided atm.