SensitivityAnalysis module¶
- SensitivityAnalysis.five_point_diff(r, parameter, variable, step, parameter_init)¶
Returns the derivative of a function based on the five point numerical differentiation method.
- Parameters
r (An Extended RoadRunner object) – A roadrunner object representing a function or metabolic pathway
parameter (str) – The id of the independent parameter, for example a kinetic constant or boundary species
variable (str) – The id of a dependent variable of the coefficient, for example a reaction or species concentration.
step (a float) – The step size to use to compute Newton’s difference quotient.
parameter_init (a float) – Initial variable value to compute control coefficients for, set to “current” as default
- Returns
deriv – The one point derivative of the variable with respect to the parameter
- Return type
double
- SensitivityAnalysis.five_point_diff_EE(r, parameter, variable, step, parameter_init)¶
Returns the derivative of a function based on the five point numerical differentiation method.
- Parameters
r (An Extended RoadRunner object) – A roadrunner object representing a function or metabolic pathway
parameter (str) – The id of the independent parameter, for example a kinetic constant or boundary species
variable (str) – The id of a dependent variable of the coefficient, for example a reaction or species concentration.
step (a float) – The step size to use to compute Newton’s difference quotient.
parameter_init (a float) – Initial variable value to compute control coefficients for, set to “current” as default
- Returns
deriv – The five point derivative of the variable with respect to the parameter
- Return type
double
- SensitivityAnalysis.getCC(r, parameter, variable, initial_step_size=0.001, parameter_init='current', reduction_factor=1.4, error_init=1e+30, ntab=10, safe=2.0, method='RichardsonExtrapolation')¶
Compute the scaled control coefficients of a roadrunner model given a parameter to perturb and a variable to observe.
Returns the derivative and estimated error values via the default method Richardson Extrapolation or alternatively Newton’s difference quotient (“OnePoint”) or symmetric difference quotient (“TwoPoint”)
- Parameters
r (ExtendedRoadRunner object) – A roadrunner object representing a function or metabolic pathway
parameter (str) – The id of the independent parameter, for example a kinetic constant or boundary species
variable (str) – The id of a dependent variable of the coefficient, for example a reaction or species concentration
initial_step_size (float) – Initial stepsize, default value is 0.001. Decrease for increased accuracy.
parameter_init (float) – Initial parameter value to compute control coefficients for, set to “current” as default
reduction_factor (float) – Stepsize is decreased by reduction_factor each iteration. Default is 1.4
error_init (float) – the initial starting error of the richardson algorithm, default is 1.0e30
ntab (int) – Sets the maximum size of Neville tableau, if error is still large increase ntab, default is 10
safe (float) – Return when error becomes ‘safe’ worse than the lowest error so far. Default safe is 2.0.
method (str) – Possible differentiation methods are “RichardsonExtrapolation”, “OnePoint” (Newton’s difference quotient), and “TwoPoint” (symmetric difference quotient). Note that “RichardsonExtrapolation” utilizes the method of symmetric
- Returns
deriv (float) – the value of the scaled control coefficient
error (float) – Returns an estimation of the error
- SensitivityAnalysis.getEE(r, parameter, variable, initial_step_size=0.001, parameter_init='current', reduction_factor=1.4, error_init=1e+30, ntab=10, safe=2.0, method='RichardsonExtrapolation')¶
Compute the single scaled elasticity coefficient with respect to a global parameter; reaction speed with respect to a global parameter.
Returns the derivative and estimated error values via the default method Richardson Extrapolation or alternatively Newton’s difference quotient (“OnePoint”) or symmetric difference quotient (“TwoPoint”)
- Parameters
r (ExtendedRoadRunner object) – A roadrunner object representing a function or metabolic pathway
parameter (str) – The id of the independent parameter, for example a kinetic constant or boundary species
variable (str) – The id of a dependent variable of the coefficient, for example a reaction or species concentration
initial_step_size (float) – Initial stepsize, default value is 0.001. Decrease for increased accuracy.
parameter_init (float) – Initial parameter value to compute elasticity coefficient for, set to “current” as default
reduction_factor (float) – Stepsize is decreased by reduction_factor each iteration. Default is 1.4
error_init (float) – the initial starting error of the richardson algorithm, default is 1.0e30
ntab (int) – Sets the maximum size of Neville tableau, if error is still large increase ntab, default is 10
safe (float) – Return when error becomes ‘safe’ worse than the lowest error so far. Default safe is 2.0.
method (str) – Possible differentiation methods are “RichardsonExtrapolation”, “OnePoint” (Newton’s difference quotient), and “TwoPoint” (symmetric difference quotient). Note that “RichardsonExtrapolation” utilizes the method of symmetric
- Returns
deriv (float) – the value of the scaled elasticity coefficient
error (float) – Returns an estimation of the error
- SensitivityAnalysis.getuCC(r, parameter, variable, initial_step_size=0.001, parameter_init='current', reduction_factor=1.4, error_init=1e+30, ntab=10, safe=2.0, method='RichardsonExtrapolation')¶
Compute the unscaled control coefficients of a roadrunner model given a parameter to perturb and a variable to observe.
Returns the derivative and estimated error values via the default method Richardson Extrapolation or alternatively Newton’s difference quotient (“OnePoint”) or symmetric difference quotient (“TwoPoint”)
- Parameters
r (ExtendedRoadRunner object) – A roadrunner object representing a function or metabolic pathway
parameter (str) – The id of the independent parameter, for example a kinetic constant or boundary species
variable (str) – The id of a dependent variable of the coefficient, for example a reaction or species concentration
initial_step_size (float) – Initial stepsize, default value is 0.001. Decrease for increased accuracy.
parameter_init (float) – Initial parameter value to compute control coefficients for, set to “current” as default
reduction_factor (float) – Stepsize is decreased by reduction_factor each iteration. Default is 1.4
error_init (float) – the initial starting error of the richardson algorithm, default is 1.0e30
ntab (int) – Sets the maximum size of Neville tableau, if error is still large increase ntab, default is 10
safe (float) – Return when error becomes ‘safe’ worse than the lowest error so far. Default safe is 2.0.
method (str) – Possible differentiation methods are “RichardsonExtrapolation”, “OnePoint” (Newton’s difference quotient), and “TwoPoint” (symmetric difference quotient). Note that “RichardsonExtrapolation” utilizes the method of symmetric
- Returns
deriv (float) – the value of the unscaled control coefficient
error (float) – Returns an estimation of the error
- SensitivityAnalysis.getuEE(r, parameter, variable, initial_step_size=0.001, parameter_init='current', reduction_factor=1.4, error_init=1e+30, ntab=10, safe=2.0, method='RichardsonExtrapolation')¶
Compute the single unscaled elasticity coefficient with respect to a global parameter; reaction speed with respect to a global parameter.
Returns the derivative and estimated error values via the default method Richardson Extrapolation or alternatively Newton’s difference quotient (“OnePoint”) or symmetric difference quotient (“TwoPoint”)
- Parameters
r (ExtendedRoadRunner object) – A roadrunner object representing a function or metabolic pathway
parameter (str) – The id of the independent parameter, for example a kinetic constant or boundary species
variable (str) – The id of a dependent variable of the coefficient, for example a reaction or species concentration
initial_step_size (float) – Initial stepsize, default value is 0.001. Decrease for increased accuracy.
parameter_init (float) – Initial parameter value to compute elasticity coefficient for, set to “current” as default
reduction_factor (float) – Stepsize is decreased by reduction_factor each iteration. Default is 1.4
error_init (float) – the initial starting error of the richardson algorithm, default is 1.0e30
ntab (int) – Sets the maximum size of Neville tableau, if error is still large increase ntab, default is 10
safe (float) – Return when error becomes ‘safe’ worse than the lowest error so far. Default safe is 2.0.
method (str) – Possible differentiation methods are “RichardsonExtrapolation”, “OnePoint” (Newton’s difference quotient), and “TwoPoint” (symmetric difference quotient). Note that “RichardsonExtrapolation” utilizes the method of symmetric
- Returns
deriv (float) – the value of the unscaled elasticity coefficient
error (float) – Returns an estimation of the error
- SensitivityAnalysis.one_point_diff(r, parameter, variable, step, parameter_init)¶
Returns the derivative of a function based on the one point numerical differentiation method. Also known as Newton’s Difference Quotient
- Parameters
r (An Extended RoadRunner object) –
parameter (str) – The id of the independent parameter, for example a kinetic constant or boundary species
variable (str) – The id of a dependent variable of the coefficient, for example a reaction or species concentration.
step (a float) – The step size to use to compute Newton’s difference quotient.
parameter_init (a float) – Initial variable value to compute control coefficients for, set to “current” as default
- Returns
deriv – The one point derivative of the variable with respect to the parameter
- Return type
double
- SensitivityAnalysis.one_point_diff_EE(r, parameter, variable, step, parameter_init)¶
Returns the derivative of a function based on the one point numerical differentiation method. Also known as Newton’s Difference Quotient
- Parameters
r (An Extended RoadRunner object) – A roadrunner object representing a function or metabolic pathway
parameter (str) – The id of the independent parameter, for example a kinetic constant or boundary species
variable (str) – The id of a dependent variable of the coefficient, for example a reaction or species concentration.
step (a float) – The step size to use to compute Newton’s difference quotient.
parameter_init (a float) – Initial variable value to compute control coefficients for, set to “current” as default
Returns –
deriv (double) – the one point derivative of the variable with respect to the parameter
- SensitivityAnalysis.richardson_extrapolation(r, parameter, variable, initial_step_size, parameter_init, reduction_factor=1.4, error_init=1e+30, ntab=10, safe=2.0)¶
Returns the derivative of a function, f, at a point parameter by Ridders’ method of polynomial extrapolation. The value h is as an estimated initial step size; it should be an increment in parameter over which func changes substantially. An estimate of the error is returned as err.
- SensitivityAnalysis.richardson_extrapolation_EE(r, parameter, variable, initial_step_size, parameter_init, reduction_factor=1.4, error_init=1e+30, ntab=10, safe=2.0)¶
Returns the derivative of a function, f, at a point parameter by Ridders’ method of polynomial extrapolation. The value h is as an estimated initial step size; it should be an increment in parameter over which func changes substantially. An estimate of the error is returned as err.
- SensitivityAnalysis.test_cubic_polynomial()¶
Tests if the estimated derivative of richardson_extrapolation function given a cubic polynomial (s^3 + 2*s^2 - 3*s) is close to the derivative of the function (3*s^2 + 4*s) evaluated from -6 to 6.
- SensitivityAnalysis.test_exponential()¶
Tests if the estimated derivative of richardson_extrapolation function given an exponential f(x) = exp(x^2) is close to the derivative of the function f(x) = 2*x*exp(x^2) evaluated from -3 to 3.
- SensitivityAnalysis.test_inverse()¶
Tests if the estimated derivative of richardson_extrapolation function given an inverse function f(x) = 1/x is close to the derivative of the function, f’(x) = -1/x^2 evaluated from 0.005 to 1.
- SensitivityAnalysis.test_log()¶
Tests if the estimated derivative of richardson_extrapolation function given an inverse function f(x) = ln(x + sqrt(1 + x^2)) is close to the derivative of the function, f’(x) = -1/x^2 evaluated from 0.005 to 1.
- SensitivityAnalysis.test_richardson_extrapolation()¶
- SensitivityAnalysis.test_sinc()¶
Tests if the estimated derivative of richardson_extrapolation function given a sinc function is close to a cosine function evaluated from a range of 0 to 4 pi radians
- SensitivityAnalysis.test_sine()¶
Tests if the estimated derivative of richardson_extrapolation function given a sine function is close to a cosine function evaluated from a range of 0 to 4 pi radians
- SensitivityAnalysis.test_sine_x_squared()¶
Tests if the estimated derivative of richardson_extrapolation function given a function f(x) = sin(x^2) is close to the derivative of the function, f’(x) = 2x*cos(x^2) evaluated from -4 pi to 4 pi.
- SensitivityAnalysis.test_square_root()¶
Tests if the estimated derivative of richardson_extrapolation function given a square root function f(x) = sqrt(x) is close to the derivative of the function f’(x) = 1/sqrt(x) evaluated from 10^-10 to 1000.
- SensitivityAnalysis.test_x_squared_cosine()¶
Tests if the estimated derivative of richardson_extrapolation function given an inverse function f(x) = x^2*cos(2*x) is close to the derivative of the function, f’(x) = -2x(xsin(2x) - cos(2x)) evaluated from -4 pi to 4 pi.
- SensitivityAnalysis.two_point_diff(r, parameter, variable, step, parameter_init, output)¶
Returns the derivative of a function based on the two point numerical differentiation method also known as the symmetric difference quotient. If output parameter is assigned to ‘Points’, then P1 and P2 are returned.
- Parameters
r (An Extended RoadRunner object) – A roadrunner object representing a function or metabolic pathway
parameter (str) – The id of the independent parameter, for example a kinetic constant or boundary species
variable (str) – The id of a dependent variable of the coefficient, for example a reaction or species concentration.
step (a float) – The step size to use to compute Newton’s difference quotient.
parameter_init (a float) – Initial variable value to compute control coefficients for, set to “current” as default
output (str) – specifies the desired return output, “Points” or “Derivative”
- Returns
P1 (double) – The first perturbed point P1 (f(x-h))
P2 (double) – The second perturbed point P2 (f(x+h)).
deriv (double) – The one point derivative of the variable with respect to the parameter
- SensitivityAnalysis.two_point_diff_EE(r, parameter, variable, step, parameter_init, output)¶
Returns the derivative of a function based on the two point numerical differentiation method also known as the symmetric difference quotient. If output parameter is assigned to ‘Points’, then P1 and P2 are returned.
- Parameters
r (An Extended RoadRunner object) – A roadrunner object representing a function or metabolic pathway
parameter (str) – The id of the independent parameter, for example a kinetic constant or boundary species
variable (str) – The id of a dependent variable of the coefficient, for example a reaction or species concentration.
step (a float) – The step size to use to compute Newton’s difference quotient.
parameter_init (a float) – Initial variable value to compute control coefficients for, set to “current” as default
output (str) – specifies the desired return output, “Points” or “Derivative”
- Returns
deriv – the two point derivative of the variable with respect to the parameter
- Return type
double