BioSANS2020.propagation.deterministic.euler_mod
¶
This is the euler_mod module
The main task this module do is to integrate ordinary differential equation (ODE) using the Euler method. In this module, two implementa- tion is provided. Both are tau-adaptive.
The list of functions in this module are as follows;
euler_model
euler_int
euler2_model
euler_wer_est
euler_help
euler2_int
Module Contents¶
Functions¶
|
This function returns the ODE model as a list of evaluated deri- |
|
This function performs tau-adpative euler integration. The tau is |
|
[summary] |
|
This function serves to do some part of the task in euler_help |
|
This function serves to do some part of the task in euler2_int. |
|
This function performs tau-adpative euler integration. The tau is |
- BioSANS2020.propagation.deterministic.euler_mod.euler_model(sp_comp, ks_dict, conc, r_dict, p_dict, stch_var, d_time, del_coef, molar=False)¶
This function returns the ODE model as a list of evaluated deri- vative of each components at a particular intance given by the state of the inputs.
- Args:
- sp_comp (dict): dictionary of appearance or position of species
or component in the reaction tag of BioSANS topology file.
For example;
#REACTIONS A => B, -kf1 # negative means to be estimated B => C, kf2
The value of sp_comp is
sp_comp = {‘A’: {0}, ‘B’: {0, 1}, ‘C’: {1}}
A appears in first reaction with index 0 B appears in first and second reaction with index 0, 1 C appears in second reaction with index 1
- ks_dict (dict): dictionary of rate constant that appear in each
reactions.
For example;
#REACTIONS A => B , 0.3 # first reaction B <=> C, 0.1, 0.2 # second reaction
The value of ks_dict is
- ks_dict = {
0 : [0.3], # first reaction 1 : [0.1, 0.2] # second reaction
}
conc (dict): dictionary of initial concentration.
For example;
{‘A’: 100.0, ‘B’: -1.0, ‘C’: 0.0} negative means unknown or for estimation
r_dict (dict): dictionary of reactant stoichiometry. For example
- r_dict = {
0: {‘A’: 1}, # first reaction, coefficient of A is 1 1: {‘B’: 1} # second reaction, coefficient of B is 1
}
p_dict (dict): dictionary of product stoichiometry. For example
- p_dict = {
0: {‘B’: 1}, # first reaction, coefficient of B is 1 1: {‘C’: 1} # second reaction, coefficient of C is 1
}
stch_var (numpy.ndarray): stoichiometric matrix. For example
- stch_var = np.array([
[ -1, 0 ] # species A [ 1, -1 ] # species B [ 0, 1 ] # species C
#1st rxn 2nd rxn
])
d_time ([type]): [description] del_coef (float, optional): factor for modifying time steps used
in the integration/propagation of ODE. Defaults to 10.
- molarTrue if concentration or amount is in molar otherwise it
is False. Defaults to False. If molar is True, macroscopic propensity is used. If it is False, microscopic propensity is used.
- Returns:
- list: 2 element list i.e. [value of dx/dt, d_time] where x are
the components
- BioSANS2020.propagation.deterministic.euler_mod.euler_int(t_var, sp_comp, ks_dict, sconc, r_dict, p_dict, stch_var, del_coef=10, lna_solve=False, items=None, implicit=False, molar=False, rfile='')¶
This function performs tau-adpative euler integration. The tau is adjusted in such a way that limit the change of the fastest reaction to del_coef amounts.
- Args:
t_var (list): list of time points in the simulation sp_comp (dict): dictionary of appearance or position of species
or component in the reaction tag of BioSANS topology file.
For example;
#REACTIONS A => B, -kf1 # negative means to be estimated B => C, kf2
The value of sp_comp is
sp_comp = {‘A’: {0}, ‘B’: {0, 1}, ‘C’: {1}}
A appears in first reaction with index 0 B appears in first and second reaction with index 0, 1 C appears in second reaction with index 1
- ks_dict (dict): dictionary of rate constant that appear in each
reactions.
For example;
#REACTIONS A => B , 0.3 # first reaction B <=> C, 0.1, 0.2 # second reaction
The value of ks_dict is
- ks_dict = {
0 : [0.3], # first reaction 1 : [0.1, 0.2] # second reaction
}
sconc (dict): dictionary of initial concentration.
For example;
{‘A’: 100.0, ‘B’: -1.0, ‘C’: 0.0} negative means unknown or for estimation
r_dict (dict): dictionary of reactant stoichiometry. For example
- r_dict = {
0: {‘A’: 1}, # first reaction, coefficient of A is 1 1: {‘B’: 1} # second reaction, coefficient of B is 1
}
p_dict (dict): dictionary of product stoichiometry. For example
- p_dict = {
0: {‘B’: 1}, # first reaction, coefficient of B is 1 1: {‘C’: 1} # second reaction, coefficient of C is 1
}
stoch_var (numpy.ndarray): stoichiometric matrix. For example
- stoch_var = np.array([
[ -1, 0 ] # species A [ 1, -1 ] # species B [ 0, 1 ] # species C
#1st rxn 2nd rxn
])
- del_coef (float, optional): factor for modifying time steps used
in the integration/propagation of ODE. Defaults to 10.
- lna_solve (bool, optional): if True, proceed to linar noise
approximation calculations. Defaults to False.
- items (list, optional): 3 item list of [canvas, scroll_x,
scroll_y], Defaults to None.
- implicit (bool, optional): True means report in time intervals
similar to the input time intervals even if actual step is more or less. Defaults to False.
- molar (bool, optional): True if concentration or amount is in
molar and you want to use macroscopic equations otherwise it should be False and using microscopic equations. Defaults to False.
rfile (str): file name of BioSANS topology file.
- Returns:
tuple: (time, trajectory)
- BioSANS2020.propagation.deterministic.euler_mod.euler2_model(sp_comp, ks_dict, conc, r_dict, p_dict, stch_var, molar=False)¶
[summary]
- Args:
- sp_comp (dict): dictionary of appearance or position of species
or component in the reaction tag of BioSANS topology file.
For example;
#REACTIONS A => B, -kf1 # negative means to be estimated B => C, kf2
The value of sp_comp is
sp_comp = {‘A’: {0}, ‘B’: {0, 1}, ‘C’: {1}}
A appears in first reaction with index 0 B appears in first and second reaction with index 0, 1 C appears in second reaction with index 1
- ks_dict (dict): dictionary of rate constant that appear in each
reactions.
For example;
#REACTIONS A => B , 0.3 # first reaction B <=> C, 0.1, 0.2 # second reaction
The value of ks_dict is
- ks_dict = {
0 : [0.3], # first reaction 1 : [0.1, 0.2] # second reaction
}
conc (dict): dictionary of initial concentration.
For example;
{‘A’: 100.0, ‘B’: -1.0, ‘C’: 0.0} negative means unknown or for estimation
r_dict (dict): dictionary of reactant stoichiometry. For example
- r_dict = {
0: {‘A’: 1}, # first reaction, coefficient of A is 1 1: {‘B’: 1} # second reaction, coefficient of B is 1
}
p_dict (dict): dictionary of product stoichiometry. For example
- p_dict = {
0: {‘B’: 1}, # first reaction, coefficient of B is 1 1: {‘C’: 1} # second reaction, coefficient of C is 1
}
stoch_var (numpy.ndarray): stoichiometric matrix. For example
- stoch_var = np.array([
[ -1, 0 ] # species A [ 1, -1 ] # species B [ 0, 1 ] # species C
#1st rxn 2nd rxn
])
- molar (bool, optional): True if concentration or amount is in
molar and you want to use macroscopic equations otherwise it should be False and using microscopic equations. Defaults to False.
- Returns:
np.ndarray: derivative of components with respect to time at a particular time or instant based on the current state of the inputs.
- BioSANS2020.propagation.deterministic.euler_mod.euler_wer_est(h_var, sp_comp, ks_dict, conc, r_dict, p_dict, stch_var, molar)¶
This function serves to do some part of the task in euler_help and euler2_int.
- BioSANS2020.propagation.deterministic.euler_mod.euler_help(htry, eps, yscal, sp_comp, ks_dict, conc, r_dict, p_dict, stch_var, molar)¶
This function serves to do some part of the task in euler2_int.
- BioSANS2020.propagation.deterministic.euler_mod.euler2_int(t_var, sp_comp, ks_dict, conc, r_dict, p_dict, stch_var, yscal=10, lna_solve=False, items=None, implicit=False, molar=False, rfile='')¶
This function performs tau-adpative euler integration. The tau is adjusted to limit the error in each integration step as compared to what a second order runge-kutta would have predicted.
- Args:
t_var (list): list of time points in the simulation sp_comp (dict): dictionary of appearance or position of species
or component in the reaction tag of BioSANS topology file.
For example;
#REACTIONS A => B, -kf1 # negative means to be estimated B => C, kf2
The value of sp_comp is
sp_comp = {‘A’: {0}, ‘B’: {0, 1}, ‘C’: {1}}
A appears in first reaction with index 0 B appears in first and second reaction with index 0, 1 C appears in second reaction with index 1
- ks_dict (dict): dictionary of rate constant that appear in each
reactions.
For example;
#REACTIONS A => B , 0.3 # first reaction B <=> C, 0.1, 0.2 # second reaction
The value of ks_dict is
- ks_dict = {
0 : [0.3], # first reaction 1 : [0.1, 0.2] # second reaction
}
sconc (dict): dictionary of initial concentration.
For example;
{‘A’: 100.0, ‘B’: -1.0, ‘C’: 0.0} negative means unknown or for estimation
r_dict (dict): dictionary of reactant stoichiometry. For example
- r_dict = {
0: {‘A’: 1}, # first reaction, coefficient of A is 1 1: {‘B’: 1} # second reaction, coefficient of B is 1
}
p_dict (dict): dictionary of product stoichiometry. For example
- p_dict = {
0: {‘B’: 1}, # first reaction, coefficient of B is 1 1: {‘C’: 1} # second reaction, coefficient of C is 1
}
stoch_var (numpy.ndarray): stoichiometric matrix. For example
- stoch_var = np.array([
[ -1, 0 ] # species A [ 1, -1 ] # species B [ 0, 1 ] # species C
#1st rxn 2nd rxn
])
- yscal (float, optional): factor for modifying time steps used
in the integration/propagation of ODE. Defaults to 10.
- lna_solve (bool, optional): if True, proceed to linar noise
approximation calculations. Defaults to False.
- items (list, optional): 3 item list of [canvas, scroll_x,
scroll_y], Defaults to None.
- implicit (bool, optional): True means report in time intervals
similar to the input time intervals even if actual step is more or less. Defaults to False.
- molar (bool, optional): True if concentration or amount is in
molar and you want to use macroscopic equations otherwise it should be False and using microscopic equations. Defaults to False.
rfile (str): file name of BioSANS topology file.
- Returns:
tuple: (time, trajectory)