:py:mod:`BioSANS2020.propagation.deterministic.lna_approx` ========================================================== .. py:module:: BioSANS2020.propagation.deterministic.lna_approx .. autoapi-nested-parse:: This is the lna_approx module This module performs numerical linear noise approximation or LNA by exploiting the following relationship. AC + CA.T + BB = 0 where A is defined as d(S*f)/dx where S is the stoichiometric matrix, f are the propensities or fluxes, and x are the components or species. The flux is a function of x and rate constant k. BB is the diffusion matrix equivalent to S*diag(f)*S.T where diag(f) is a square matrix with zero non-diagonal elements and f[i] in each diagonal elements. The following are the list of function for this module. 1. rem_rowcol_zero 2. lna_ss_jacobian 3. lna_model_ss 4. lna_steady_state Module Contents --------------- Functions ~~~~~~~~~ .. autoapisummary:: BioSANS2020.propagation.deterministic.lna_approx.rem_rowcol_zero BioSANS2020.propagation.deterministic.lna_approx.lna_ss_jacobian BioSANS2020.propagation.deterministic.lna_approx.lna_model_ss BioSANS2020.propagation.deterministic.lna_approx.lna_steady_state .. py:function:: rem_rowcol_zero(a_mat) This function removes rows and columns without non-zero entries. Args: a_mat (np.ndarray): numpy matrix of A or d(S*f)/dx as described in the module docstring. Returns: np.ndarray: numpy matrix with no rows and columns without non- zero entries. .. py:function:: lna_ss_jacobian(model, zlist, sp_comp, stch_var, ks_dict, r_dict, p_dict) This function calculataes the jacobian of the model ODE with respect to the list of species concentration zlist. Args: model (function): the ODE model returning derivative of species or components as a function of time zlist (list): list of components or species amounts 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 stch_var (np.ndarray): stoichiometric matrix 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 } 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 } Returns: np.ndarray: jacobian matrix or d(S*f)/dx or A .. py:function:: lna_model_ss(zlist, sp_comp, ks_dict, r_dict, p_dict, stch_var) This function returns the derivative of components with respect to time at a particular state of the system based on the inputs. Args: zlist (list): list of components or species amounts 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 } 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 (np.ndarray): stoichiometric matrix Returns: np.ndarray: derivative of species with respect to time.d(S*f)/dt .. py:function:: lna_steady_state(t_var, sp_comp, ks_dict, conc, r_dict, p_dict, stch_var, items=None) [summary] Args: t_var (list): time stamp 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 (np.ndarray): stoichiometric matrix items (tuplel): (canvas, scroll_x, scroll_y). Defaults to None. Returns: [type]: [description]