Generated by Cython 0.24.1
Yellow lines hint at Python interaction.
Click on a line that starts with a "+
" to see the C code that Cython generated for it.
Raw output: odes.c
+0001: # distutils: extra_compile_args = -fopenmp
__pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
0002: # distutils: extra_link_args = -fopenmp
0003: #cython: boundscheck=False
0004: #cython: wraparound=False
0005: #cython: cdivision=True
0006: ##cython: profile=True
0007:
0008: from cython_gsl cimport *
0009: from libc.stdlib cimport malloc, free
0010: import cython
0011: from libc.stdio cimport printf
+0012: import collections
__pyx_t_1 = __Pyx_Import(__pyx_n_s_collections, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 12, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_collections, __pyx_t_1) < 0) __PYX_ERR(0, 12, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
0013: from cython cimport parallel
0014: from cpython.mem cimport PyMem_Malloc, PyMem_Realloc, PyMem_Free
0015: cimport numpy as np
+0016: import numpy as np
__pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 16, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
0017:
0018:
0019: '''
0020: Logical structure of ode creation:
0021:
0022: 1) parsing starts at the highest level construct that is passed from the Python
0023: main loop: an EvoSystem instance. This will be passed to the constructor of the
0024: SYSTEM extension type.
0025:
0026: 2) every substructure has (in principle) its own matching cython extension type,
0027: that will be used to further construct the ode system, by deconstructing the
0028: substructure instance (eg Population) into its sub-components, via matching
0029: cython extenion types.
0030:
0031: 3) A caveat of this approach is that the cython extension types cannot have
0032: containers holding extension types as attributes: because extension types are in
0033: essence c-structs, whose size must be known at compile time, variable length
0034: arrays of unknown size are not allowed.
0035:
0036: 4) To circumvent the caveat, the extension types will be used to allocate memory
0037: for and instantiate accompanying c-structs that will hold the actual data needed
0038: for the ode integration.
0039:
0040: 5) A master equation will eventually be passed to the integrator and loop over
0041: all the data in structs, updating variables of the system.
0042: '''
0043:
+0044: cdef void convert(double vars[], double derivs[], enzyme_str * enzyme,
static void __pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_convert(double *__pyx_v_vars, double *__pyx_v_derivs, struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_enzyme_str *__pyx_v_enzyme, CYTHON_UNUSED double __pyx_v_cell_volume, double __pyx_v_volume_limitation) { int __pyx_v_i; int __pyx_v_j; double __pyx_v_rate; double __pyx_v_nume; double __pyx_v_denom; struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_enzyme_params_str *__pyx_v_eparams; double __pyx_v_enzyme_conc; struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_reactant_str *__pyx_v_reac; struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_product_str *__pyx_v_prod; double __pyx_v_total_rate; double __pyx_v_V_max; double __pyx_v_rate_scaling; /* … */ /* function exit code */ }
0045: double cell_volume, double volume_limitation) nogil:
0046: '''
0047: skeleton for conversion equation; takes in a set of variables and an enzyme
0048: parameter struct from which a conversion rate will be computed. This function
0049: needs to be nogil to be parallellizable, and therefore cannot manipulate or
0050: use any python objects.
0051: '''
0052: cdef int i, j
0053: cdef double rate, nume, denom
0054: cdef enzyme_params_str * eparams
+0055: cdef double enzyme_conc = vars[enzyme.variable]
__pyx_v_enzyme_conc = (__pyx_v_vars[__pyx_v_enzyme->variable]);
0056: cdef reactant_str * reac
0057: cdef product_str * prod
+0058: cdef double total_rate = 0.
__pyx_v_total_rate = 0.;
+0059: cdef double V_max = enzyme.v_max * enzyme_conc
__pyx_v_V_max = (__pyx_v_enzyme->v_max * __pyx_v_enzyme_conc);
+0060: for i in range(enzyme.nr_equations):
__pyx_t_1 = __pyx_v_enzyme->nr_equations; for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2;
+0061: eparams = &enzyme.params[i]
__pyx_v_eparams = (&(__pyx_v_enzyme->params[__pyx_v_i]));
+0062: nume = enzyme.v_max * enzyme_conc
__pyx_v_nume = (__pyx_v_enzyme->v_max * __pyx_v_enzyme_conc);
+0063: denom = 1.
__pyx_v_denom = 1.;
+0064: for j in range(eparams.nr_reactants):
__pyx_t_3 = __pyx_v_eparams->nr_reactants; for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_j = __pyx_t_4;
+0065: reac = &eparams.reactants[j]
__pyx_v_reac = (&(__pyx_v_eparams->reactants[__pyx_v_j]));
+0066: nume *= pow(vars[reac.var], reac.stoi)
__pyx_v_nume = (__pyx_v_nume * pow((__pyx_v_vars[__pyx_v_reac->var]), __pyx_v_reac->stoi));
+0067: denom *= pow((vars[reac.var] + reac.k_bind), reac.stoi)
__pyx_v_denom = (__pyx_v_denom * pow(((__pyx_v_vars[__pyx_v_reac->var]) + __pyx_v_reac->k_bind), __pyx_v_reac->stoi)); }
0068:
+0069: rate = (nume / denom )
__pyx_v_rate = (__pyx_v_nume / __pyx_v_denom);
+0070: if volume_limitation > 0.0:
__pyx_t_5 = ((__pyx_v_volume_limitation > 0.0) != 0); if (__pyx_t_5) { /* … */ }
+0071: rate *= volume_limitation
__pyx_v_rate = (__pyx_v_rate * __pyx_v_volume_limitation);
0072:
+0073: total_rate += rate
__pyx_v_total_rate = (__pyx_v_total_rate + __pyx_v_rate);
+0074: enzyme.params[i].sub_reac_rate = rate
(__pyx_v_enzyme->params[__pyx_v_i]).sub_reac_rate = __pyx_v_rate; }
0075:
+0076: cdef double rate_scaling = 1.
__pyx_v_rate_scaling = 1.;
+0077: if total_rate > V_max:
__pyx_t_5 = ((__pyx_v_total_rate > __pyx_v_V_max) != 0); if (__pyx_t_5) { /* … */ }
+0078: rate_scaling = V_max / total_rate
__pyx_v_rate_scaling = (__pyx_v_V_max / __pyx_v_total_rate);
+0079: for i in range(enzyme.nr_equations):
__pyx_t_1 = __pyx_v_enzyme->nr_equations; for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2;
+0080: eparams = &enzyme.params[i]
__pyx_v_eparams = (&(__pyx_v_enzyme->params[__pyx_v_i]));
+0081: for j in range(eparams.nr_reactants):
__pyx_t_3 = __pyx_v_eparams->nr_reactants; for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_j = __pyx_t_4;
+0082: reac = &eparams.reactants[j]
__pyx_v_reac = (&(__pyx_v_eparams->reactants[__pyx_v_j]));
+0083: derivs[reac.var] -= reac.stoi * (eparams.sub_reac_rate * rate_scaling) #/ cell_volume
__pyx_t_6 = __pyx_v_reac->var; (__pyx_v_derivs[__pyx_t_6]) = ((__pyx_v_derivs[__pyx_t_6]) - (__pyx_v_reac->stoi * (__pyx_v_eparams->sub_reac_rate * __pyx_v_rate_scaling))); }
+0084: for j in range(eparams.nr_products):
__pyx_t_3 = __pyx_v_eparams->nr_products; for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_j = __pyx_t_4;
+0085: prod = &eparams.products[j]
__pyx_v_prod = (&(__pyx_v_eparams->products[__pyx_v_j]));
+0086: derivs[prod.var] += prod.stoi * (eparams.sub_reac_rate * rate_scaling) #/ cell_volume
__pyx_t_6 = __pyx_v_prod->var; (__pyx_v_derivs[__pyx_t_6]) = ((__pyx_v_derivs[__pyx_t_6]) + (__pyx_v_prod->stoi * (__pyx_v_eparams->sub_reac_rate * __pyx_v_rate_scaling))); } }
0087:
+0088: cdef void converting(double vars[], double derivs[], cell_str * cell, double volume_occupancy_constant = 0.0) nogil:
static void __pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_converting(double *__pyx_v_vars, double *__pyx_v_derivs, struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_cell_str *__pyx_v_cell, struct __pyx_opt_args_15VirtualMicrobes_20cython_gsl_interface_4odes_converting *__pyx_optional_args) { double __pyx_v_volume_occupancy_constant = ((double)0.0); int __pyx_v_i; double __pyx_v_total_enzyme_concentration; double __pyx_v_volume_limitation; if (__pyx_optional_args) { if (__pyx_optional_args->__pyx_n > 0) { __pyx_v_volume_occupancy_constant = __pyx_optional_args->volume_occupancy_constant; } } /* … */ /* function exit code */ } /* … */ struct __pyx_opt_args_15VirtualMicrobes_20cython_gsl_interface_4odes_converting { int __pyx_n; double volume_occupancy_constant; };
0089: cdef int i
+0090: cdef double total_enzyme_concentration = 0.0
__pyx_v_total_enzyme_concentration = 0.0;
0091:
+0092: for i in range(cell.genome.nr_enzymes):
__pyx_t_1 = __pyx_v_cell->genome.nr_enzymes; for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2;
+0093: total_enzyme_concentration += vars[cell.genome.enzymes[i].variable]
__pyx_v_total_enzyme_concentration = (__pyx_v_total_enzyme_concentration + (__pyx_v_vars[(__pyx_v_cell->genome.enzymes[__pyx_v_i])->variable])); }
0094:
+0095: cdef double volume_limitation = 0.0
__pyx_v_volume_limitation = 0.0;
+0096: if volume_occupancy_constant > 0.0:
__pyx_t_3 = ((__pyx_v_volume_occupancy_constant > 0.0) != 0); if (__pyx_t_3) { /* … */ }
+0097: volume_limitation = pow(volume_occupancy_constant,2)/(pow(total_enzyme_concentration,2)+pow(volume_occupancy_constant,2))
__pyx_v_volume_limitation = (pow(__pyx_v_volume_occupancy_constant, 2.0) / (pow(__pyx_v_total_enzyme_concentration, 2.0) + pow(__pyx_v_volume_occupancy_constant, 2.0)));
0098:
+0099: for i in range(cell.genome.nr_enzymes):
__pyx_t_1 = __pyx_v_cell->genome.nr_enzymes; for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2;
+0100: convert(vars, derivs, cell.genome.enzymes[i] , vars[cell.cell_size_s.var], volume_limitation)
__pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_convert(__pyx_v_vars, __pyx_v_derivs, (__pyx_v_cell->genome.enzymes[__pyx_v_i]), (__pyx_v_vars[__pyx_v_cell->cell_size_s.var]), __pyx_v_volume_limitation); }
0101:
+0102: cdef double membrane_area(double volume, double N=0.7) nogil:
static double __pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_membrane_area(double __pyx_v_volume, struct __pyx_opt_args_15VirtualMicrobes_20cython_gsl_interface_4odes_membrane_area *__pyx_optional_args) { double __pyx_v_N = ((double)0.7); double __pyx_r; if (__pyx_optional_args) { if (__pyx_optional_args->__pyx_n > 0) { __pyx_v_N = __pyx_optional_args->N; } } /* … */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* … */ struct __pyx_opt_args_15VirtualMicrobes_20cython_gsl_interface_4odes_membrane_area { int __pyx_n; double N; };
0103: ''' Calculates a membrane area, based on the cell volume for scaling the efficiency
0104: of transport and diffusion reactions.
0105: '''
+0106: return pow(volume, N)
__pyx_r = pow(__pyx_v_volume, __pyx_v_N); goto __pyx_L0;
0107:
+0108: cdef void transport(double vars[], double derivs[], pump_str * pump,
static void __pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_transport(double *__pyx_v_vars, double *__pyx_v_derivs, struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_pump_str *__pyx_v_pump, double __pyx_v_volume_out, CYTHON_UNUSED double __pyx_v_cell_volume, double __pyx_v_membrane_limitation) { double __pyx_v_rate; double __pyx_v_rate_scaling; int __pyx_v_sub_in; int __pyx_v_sub_out; int __pyx_v_en; double __pyx_v_pump_conc; double __pyx_v_direction; struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_pump_params_str *__pyx_v_pparams; double __pyx_v_total_rate; double __pyx_v_V_max; int __pyx_v_i; double __pyx_v_sub_reaction_rate_scaling; /* … */ /* function exit code */ }
0109: double volume_out, double cell_volume,
0110: double membrane_limitation) nogil:
0111: '''
0112: skeleton for pumping equation; takes in a set of variables and a pump
0113: parameter struct from which a pumping rate will be computed. This function
0114: needs to be nogil, hence, cannot manipulate or use any python objects.
0115: '''
0116: cdef double rate, rate_scaling
0117: cdef int sub_in, sub_out, en
+0118: cdef double pump_conc = vars[pump.variable]
__pyx_v_pump_conc = (__pyx_v_vars[__pyx_v_pump->variable]);
+0119: cdef double direction = pump.direction
__pyx_t_1 = __pyx_v_pump->direction; __pyx_v_direction = __pyx_t_1;
0120: cdef pump_params_str * pparams
+0121: cdef double total_rate = 0.
__pyx_v_total_rate = 0.;
+0122: cdef double V_max = pump.v_max * pump_conc
__pyx_v_V_max = (__pyx_v_pump->v_max * __pyx_v_pump_conc);
+0123: for i in range(pump.nr_equations):
__pyx_t_2 = __pyx_v_pump->nr_equations; for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3;
+0124: pparams = &pump.params[i]
__pyx_v_pparams = (&(__pyx_v_pump->params[__pyx_v_i]));
+0125: sub_in = pparams.substrate_in
__pyx_t_4 = __pyx_v_pparams->substrate_in; __pyx_v_sub_in = __pyx_t_4;
+0126: sub_out = pparams.substrate_out
__pyx_t_4 = __pyx_v_pparams->substrate_out; __pyx_v_sub_out = __pyx_t_4;
+0127: en = pparams.energy_mol
__pyx_t_4 = __pyx_v_pparams->energy_mol; __pyx_v_en = __pyx_t_4;
+0128: if direction > 0.:
__pyx_t_5 = ((__pyx_v_direction > 0.) != 0); if (__pyx_t_5) { /* … */ goto __pyx_L5; }
0129: rate = (vars[sub_out] * vars[en] * pump.v_max * pump_conc
+0130: / ((vars[sub_out] + pparams.k_sub) * (vars[en] + pparams.k_ene)))
__pyx_v_rate = (((((__pyx_v_vars[__pyx_v_sub_out]) * (__pyx_v_vars[__pyx_v_en])) * __pyx_v_pump->v_max) * __pyx_v_pump_conc) / (((__pyx_v_vars[__pyx_v_sub_out]) + __pyx_v_pparams->k_sub) * ((__pyx_v_vars[__pyx_v_en]) + __pyx_v_pparams->k_ene)));
0131: else:
0132: rate = (vars[sub_in] * vars[en] * pump.v_max * pump_conc
+0133: / ((vars[sub_in] + pparams.k_sub) * (vars[en] + pparams.k_ene)))
/*else*/ { /* … */ __pyx_v_rate = (((((__pyx_v_vars[__pyx_v_sub_in]) * (__pyx_v_vars[__pyx_v_en])) * __pyx_v_pump->v_max) * __pyx_v_pump_conc) / (((__pyx_v_vars[__pyx_v_sub_in]) + __pyx_v_pparams->k_sub) * ((__pyx_v_vars[__pyx_v_en]) + __pyx_v_pparams->k_ene))); } __pyx_L5:;
+0134: pump.params[i].sub_reac_rate = rate
(__pyx_v_pump->params[__pyx_v_i]).sub_reac_rate = __pyx_v_rate;
+0135: total_rate+=rate
__pyx_v_total_rate = (__pyx_v_total_rate + __pyx_v_rate); }
0136:
+0137: cdef double sub_reaction_rate_scaling = 1.
__pyx_v_sub_reaction_rate_scaling = 1.;
+0138: if total_rate > V_max:
__pyx_t_5 = ((__pyx_v_total_rate > __pyx_v_V_max) != 0); if (__pyx_t_5) { /* … */ }
+0139: sub_reaction_rate_scaling = V_max / total_rate
__pyx_v_sub_reaction_rate_scaling = (__pyx_v_V_max / __pyx_v_total_rate);
+0140: rate_scaling = sub_reaction_rate_scaling * membrane_limitation
__pyx_v_rate_scaling = (__pyx_v_sub_reaction_rate_scaling * __pyx_v_membrane_limitation);
+0141: for i in range(pump.nr_equations):
__pyx_t_2 = __pyx_v_pump->nr_equations; for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3;
+0142: pparams = &pump.params[i]
__pyx_v_pparams = (&(__pyx_v_pump->params[__pyx_v_i]));
+0143: sub_in = pparams.substrate_in
__pyx_t_4 = __pyx_v_pparams->substrate_in; __pyx_v_sub_in = __pyx_t_4;
+0144: sub_out = pparams.substrate_out
__pyx_t_4 = __pyx_v_pparams->substrate_out; __pyx_v_sub_out = __pyx_t_4;
+0145: en = pparams.energy_mol
__pyx_t_4 = __pyx_v_pparams->energy_mol; __pyx_v_en = __pyx_t_4;
+0146: derivs[sub_out] -= direction * (pparams.sub_reac_rate * rate_scaling) / volume_out
__pyx_t_4 = __pyx_v_sub_out; (__pyx_v_derivs[__pyx_t_4]) = ((__pyx_v_derivs[__pyx_t_4]) - ((__pyx_v_direction * (__pyx_v_pparams->sub_reac_rate * __pyx_v_rate_scaling)) / __pyx_v_volume_out));
+0147: derivs[sub_in] += direction * (pparams.sub_reac_rate * rate_scaling) #/ cell_volume
__pyx_t_4 = __pyx_v_sub_in; (__pyx_v_derivs[__pyx_t_4]) = ((__pyx_v_derivs[__pyx_t_4]) + (__pyx_v_direction * (__pyx_v_pparams->sub_reac_rate * __pyx_v_rate_scaling)));
+0148: derivs[en] -= pparams.ene_cost * (pparams.sub_reac_rate * rate_scaling) #/ cell_volume
__pyx_t_4 = __pyx_v_en; (__pyx_v_derivs[__pyx_t_4]) = ((__pyx_v_derivs[__pyx_t_4]) - (__pyx_v_pparams->ene_cost * (__pyx_v_pparams->sub_reac_rate * __pyx_v_rate_scaling))); }
0149: #printf("rate=%f, deriv_out=%f, deriv_in=%f, deriv_ene=%f\n",rate,derivs[sub_out],derivs[sub_in],derivs[en])
0150:
+0151: cdef void transporting(double vars[], double derivs[], cell_str * cell, double env_volume,
static void __pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_transporting(double *__pyx_v_vars, double *__pyx_v_derivs, struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_cell_str *__pyx_v_cell, double __pyx_v_env_volume, struct __pyx_opt_args_15VirtualMicrobes_20cython_gsl_interface_4odes_transporting *__pyx_optional_args) { double __pyx_v_membrane_occupancy_constant = ((double).1); int __pyx_v_i; double __pyx_v_area; double __pyx_v_volume; double __pyx_v_av_ratio; double __pyx_v_membrane_limitation; double __pyx_v_total_pump_concentration; if (__pyx_optional_args) { if (__pyx_optional_args->__pyx_n > 0) { __pyx_v_membrane_occupancy_constant = __pyx_optional_args->membrane_occupancy_constant; } } /* … */ /* function exit code */ } /* … */ struct __pyx_opt_args_15VirtualMicrobes_20cython_gsl_interface_4odes_transporting { int __pyx_n; double membrane_occupancy_constant; };
0152: double membrane_occupancy_constant = .1) nogil:
0153: '''
0154: :param membrane_occupancy_constant: occupancy of transport enzymes per unit area
0155: '''
0156: cdef int i
0157: cdef double area, volume, av_ratio
+0158: cdef double membrane_limitation = 1.
__pyx_v_membrane_limitation = 1.;
+0159: cdef double total_pump_concentration = 0.
__pyx_v_total_pump_concentration = 0.;
0160:
+0161: if membrane_occupancy_constant > 0.:
__pyx_t_1 = ((__pyx_v_membrane_occupancy_constant > 0.) != 0); if (__pyx_t_1) { /* … */ }
+0162: volume = vars[cell.cell_size_s.var]
__pyx_v_volume = (__pyx_v_vars[__pyx_v_cell->cell_size_s.var]);
+0163: area = membrane_area(volume)
__pyx_v_area = __pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_membrane_area(__pyx_v_volume, NULL);
+0164: av_ratio = area / volume
__pyx_v_av_ratio = (__pyx_v_area / __pyx_v_volume);
+0165: for i in range(cell.genome.nr_pumps):
__pyx_t_2 = __pyx_v_cell->genome.nr_pumps; for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3;
+0166: total_pump_concentration += vars[cell.genome.pumps[i].variable]
__pyx_v_total_pump_concentration = (__pyx_v_total_pump_concentration + (__pyx_v_vars[(__pyx_v_cell->genome.pumps[__pyx_v_i])->variable])); }
+0167: membrane_limitation = av_ratio / ( membrane_occupancy_constant * total_pump_concentration + av_ratio )
__pyx_v_membrane_limitation = (__pyx_v_av_ratio / ((__pyx_v_membrane_occupancy_constant * __pyx_v_total_pump_concentration) + __pyx_v_av_ratio));
+0168: for i in range(cell.genome.nr_pumps):
__pyx_t_2 = __pyx_v_cell->genome.nr_pumps; for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3;
+0169: transport(vars, derivs, cell.genome.pumps[i] , env_volume, vars[cell.cell_size_s.var], membrane_limitation)
__pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_transport(__pyx_v_vars, __pyx_v_derivs, (__pyx_v_cell->genome.pumps[__pyx_v_i]), __pyx_v_env_volume, (__pyx_v_vars[__pyx_v_cell->cell_size_s.var]), __pyx_v_membrane_limitation); }
0170:
+0171: cdef void diffusing(double vars[], double derivs[], cell_str * cell, double env_volume) nogil:
static void __pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_diffusing(double *__pyx_v_vars, double *__pyx_v_derivs, struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_cell_str *__pyx_v_cell, double __pyx_v_env_volume) { int __pyx_v_i; int __pyx_v_mol_int_var; int __pyx_v_mol_ext_var; double __pyx_v_rate; double __pyx_v_cell_volume; double __pyx_v_cell_area; struct mol_str *__pyx_v_mol_s; /* … */ /* function exit code */ }
0172: cdef int i
0173: cdef int mol_int_var, mol_ext_var
0174: cdef double rate, cell_volume, cell_area
0175: cdef mol_str * mol_s
+0176: cell_volume = vars[cell.cell_size_s.var]
__pyx_v_cell_volume = (__pyx_v_vars[__pyx_v_cell->cell_size_s.var]);
+0177: cell_area = membrane_area(cell_volume)
__pyx_v_cell_area = __pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_membrane_area(__pyx_v_cell_volume, NULL);
+0178: for i in range(cell.nr_small_mols):
__pyx_t_1 = __pyx_v_cell->nr_small_mols; for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2;
+0179: mol_s = cell.small_mols[i]
__pyx_v_mol_s = (__pyx_v_cell->small_mols[__pyx_v_i]);
+0180: mol_int_var = mol_s.variable
__pyx_t_3 = __pyx_v_mol_s->variable; __pyx_v_mol_int_var = __pyx_t_3;
+0181: mol_ext_var = mol_s.diff_external_var
__pyx_t_3 = __pyx_v_mol_s->diff_external_var; __pyx_v_mol_ext_var = __pyx_t_3;
+0182: rate = (vars[mol_int_var] - vars[mol_ext_var]) * mol_s.diff_const * cell_area # molecules per second over the membrane
__pyx_v_rate = ((((__pyx_v_vars[__pyx_v_mol_int_var]) - (__pyx_v_vars[__pyx_v_mol_ext_var])) * __pyx_v_mol_s->diff_const) * __pyx_v_cell_area);
+0183: derivs[mol_int_var] -= rate / cell_volume
__pyx_t_3 = __pyx_v_mol_int_var; (__pyx_v_derivs[__pyx_t_3]) = ((__pyx_v_derivs[__pyx_t_3]) - (__pyx_v_rate / __pyx_v_cell_volume));
+0184: derivs[mol_ext_var] += rate / env_volume
__pyx_t_3 = __pyx_v_mol_ext_var; (__pyx_v_derivs[__pyx_t_3]) = ((__pyx_v_derivs[__pyx_t_3]) + (__pyx_v_rate / __pyx_v_env_volume)); }
0185:
+0186: cdef void degrading(double vars[], double derivs[], cell_str * cell) nogil:
static void __pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_degrading(double *__pyx_v_vars, double *__pyx_v_derivs, struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_cell_str *__pyx_v_cell) { int __pyx_v_i; double __pyx_v_rate; struct mol_str *__pyx_v_mol_s; struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_pump_str *__pyx_v_pump_s; struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_enzyme_str *__pyx_v_enzyme_s; struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_tf_str *__pyx_v_tf_s; double __pyx_v_mu; /* … */ /* function exit code */ }
0187: """
0188: Degradation and dilution of internal molecules. Molecules degrade with a
0189: fixed rate per molecule. In addition, molecule concentrations dilute due to
0190: cell volume increase (and shrinking) as determined by the cell growth_rate.
0191: """
0192:
0193: cdef int i
0194: cdef double rate
0195: cdef mol_str * mol_s
0196: cdef pump_str * pump_s
0197: cdef enzyme_str * enzyme_s
0198: cdef tf_str * tf_s
+0199: cdef double mu = cell.cell_size_s.growth_rate - cell.cell_size_s.shrink_rate
__pyx_v_mu = (__pyx_v_cell->cell_size_s.growth_rate - __pyx_v_cell->cell_size_s.shrink_rate);
+0200: for i in range(cell.nr_small_mols):
__pyx_t_1 = __pyx_v_cell->nr_small_mols; for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2;
+0201: mol_s = cell.small_mols[i]
__pyx_v_mol_s = (__pyx_v_cell->small_mols[__pyx_v_i]);
+0202: rate = vars[mol_s.variable] * ( mol_s.degr_const + mu)
__pyx_v_rate = ((__pyx_v_vars[__pyx_v_mol_s->variable]) * (__pyx_v_mol_s->degr_const + __pyx_v_mu));
+0203: derivs[mol_s.variable] -= rate
__pyx_t_3 = __pyx_v_mol_s->variable; (__pyx_v_derivs[__pyx_t_3]) = ((__pyx_v_derivs[__pyx_t_3]) - __pyx_v_rate); }
+0204: for i in range(cell.genome.nr_pumps):
__pyx_t_1 = __pyx_v_cell->genome.nr_pumps; for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2;
+0205: pump_s = cell.genome.pumps[i]
__pyx_v_pump_s = (__pyx_v_cell->genome.pumps[__pyx_v_i]);
+0206: rate = vars[pump_s.variable] * ( pump_s.degr_const + mu )
__pyx_v_rate = ((__pyx_v_vars[__pyx_v_pump_s->variable]) * (__pyx_v_pump_s->degr_const + __pyx_v_mu));
+0207: derivs[pump_s.variable] -= rate
__pyx_t_3 = __pyx_v_pump_s->variable; (__pyx_v_derivs[__pyx_t_3]) = ((__pyx_v_derivs[__pyx_t_3]) - __pyx_v_rate); }
+0208: for i in range(cell.genome.nr_enzymes):
__pyx_t_1 = __pyx_v_cell->genome.nr_enzymes; for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2;
+0209: enzyme_s = cell.genome.enzymes[i]
__pyx_v_enzyme_s = (__pyx_v_cell->genome.enzymes[__pyx_v_i]);
+0210: rate = vars[enzyme_s.variable] * ( enzyme_s.degr_const + mu )
__pyx_v_rate = ((__pyx_v_vars[__pyx_v_enzyme_s->variable]) * (__pyx_v_enzyme_s->degr_const + __pyx_v_mu));
+0211: derivs[enzyme_s.variable] -= rate
__pyx_t_3 = __pyx_v_enzyme_s->variable; (__pyx_v_derivs[__pyx_t_3]) = ((__pyx_v_derivs[__pyx_t_3]) - __pyx_v_rate); }
+0212: for i in range(cell.genome.nr_tfs):
__pyx_t_1 = __pyx_v_cell->genome.nr_tfs; for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2;
+0213: tf_s = cell.genome.tfs[i]
__pyx_v_tf_s = (__pyx_v_cell->genome.tfs[__pyx_v_i]);
+0214: rate = vars[tf_s.variable] * ( tf_s.degr_const + mu )
__pyx_v_rate = ((__pyx_v_vars[__pyx_v_tf_s->variable]) * (__pyx_v_tf_s->degr_const + __pyx_v_mu));
+0215: derivs[tf_s.variable] -= rate
__pyx_t_3 = __pyx_v_tf_s->variable; (__pyx_v_derivs[__pyx_t_3]) = ((__pyx_v_derivs[__pyx_t_3]) - __pyx_v_rate); }
+0216: derivs[cell.production_s.variable] -= vars[cell.production_s.variable] * (cell.production_s.degr_const + mu)
__pyx_t_1 = __pyx_v_cell->production_s.variable; (__pyx_v_derivs[__pyx_t_1]) = ((__pyx_v_derivs[__pyx_t_1]) - ((__pyx_v_vars[__pyx_v_cell->production_s.variable]) * (__pyx_v_cell->production_s.degr_const + __pyx_v_mu)));
0217:
+0218: cdef void env_degrading(double vars[], double derivs[], env_str * env) nogil:
static void __pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_env_degrading(double *__pyx_v_vars, double *__pyx_v_derivs, struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_env_str *__pyx_v_env) { int __pyx_v_i; double __pyx_v_rate; struct mol_str *__pyx_v_mol_s; /* … */ /* function exit code */ }
0219: cdef int i
0220: cdef double rate
0221: cdef mol_str * mol_s
+0222: for i in range(env.nr_small_mols):
__pyx_t_1 = __pyx_v_env->nr_small_mols; for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2;
+0223: mol_s = env.small_mols[i]
__pyx_v_mol_s = (__pyx_v_env->small_mols[__pyx_v_i]);
+0224: rate = vars[mol_s.variable] * mol_s.degr_const
__pyx_v_rate = ((__pyx_v_vars[__pyx_v_mol_s->variable]) * __pyx_v_mol_s->degr_const);
+0225: derivs[mol_s.variable] -= rate
__pyx_t_3 = __pyx_v_mol_s->variable; (__pyx_v_derivs[__pyx_t_3]) = ((__pyx_v_derivs[__pyx_t_3]) - __pyx_v_rate); }
0226:
+0227: cdef double transcription_rate(double vars[], reg_seq_str * reg_seq) nogil:
static double __pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_transcription_rate(double *__pyx_v_vars, struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_reg_seq_str *__pyx_v_reg_seq) { int __pyx_v_i; double __pyx_v_tf_conc; double __pyx_v_fract_apo; double __pyx_v_binding_rate; double __pyx_v_total_frac_bound_nume; double __pyx_v_reg; struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_binding_tf_str *__pyx_v_binding_tf; double __pyx_v_total_frac_bound_denom; double __pyx_r; /* … */ /* function exit code */ __pyx_L0:; return __pyx_r; }
0228: """
0229: Calculate the rate of transcription for a gene. The function sums the
0230: regulatory effects of tfs bound to the gene's operator by multiplying the
0231: occupancy rate of the tf in its ligand bound and ligand free state with the
0232: binding_score and intrinsic binding affinity of the tf for its recognized
0233: operator and the respective regulatory effects: eff_bound and eff_apo. The
0234: fractions of the tf that are in apo and bound state have been determined by
0235: the tfs_states function. Binding of the tfs is a function of their
0236: concentration and the binding_score and affinity for the operator.
0237:
0238: from Neyfakh et al. (2006)
0239:
0240: V = [TF in a particular form] × K_b /binding polynomial
0241:
0242: where binding polynomial is 1 plus the sum of [TF in a particular form] ×
0243: K_b terms for all TFs which can bind the operator
0244:
0245: Reg = Σ V_i × E_i
0246:
0247: where V i is the fraction of time the operator is in a particular state (i.
0248: e., unbound or bound by a particular TF, in either apo or ligand-bound form;
0249: Σ V_i = 1), and E_i is the effect of the corresponding state on the rate of
0250: transcrip- tion (i. e., 1 or either EffApo or EffBound, for the
0251: corresponding TFs).
0252:
0253: N.B. we use k_bind_op = 1/ K_b to mirror semantics of K terms in enzymatic
0254: rate reactions, i.e. lower K terms mean saturation at lower TF
0255: concentrations
0256: """
0257:
0258: cdef int i
0259: cdef double tf_conc, fract_apo, binding_rate
+0260: cdef double total_frac_bound_nume = 0.
__pyx_v_total_frac_bound_nume = 0.;
+0261: cdef double reg = 0.
__pyx_v_reg = 0.;
0262: cdef binding_tf_str * binding_tf
+0263: for i in range(reg_seq.nr_binding_tfs): #first, sum all binding factors (building up numerator)
__pyx_t_1 = __pyx_v_reg_seq->nr_binding_tfs; for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2;
+0264: binding_tf = ®_seq.binding_tfs[i]
__pyx_v_binding_tf = (&(__pyx_v_reg_seq->binding_tfs[__pyx_v_i]));
+0265: tf_conc = vars[binding_tf.tf.variable]
__pyx_v_tf_conc = (__pyx_v_vars[__pyx_v_binding_tf->tf->variable]);
+0266: binding_rate = pow((tf_conc * binding_tf.score) / binding_tf.tf.k_bind_op, binding_tf.tf.coop)
__pyx_v_binding_rate = pow(((__pyx_v_tf_conc * __pyx_v_binding_tf->score) / __pyx_v_binding_tf->tf->k_bind_op), __pyx_v_binding_tf->tf->coop);
+0267: total_frac_bound_nume += binding_rate
__pyx_v_total_frac_bound_nume = (__pyx_v_total_frac_bound_nume + __pyx_v_binding_rate); }
+0268: cdef double total_frac_bound_denom = 1 + total_frac_bound_nume
__pyx_v_total_frac_bound_denom = (1.0 + __pyx_v_total_frac_bound_nume);
0269: # ---uncomment to print regulatory effects---
0270: #cdef double bound_tot = 0
+0271: for i in range(reg_seq.nr_binding_tfs): #now calculate the regulatory effects (building up denominator)
__pyx_t_1 = __pyx_v_reg_seq->nr_binding_tfs; for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2;
+0272: binding_tf = ®_seq.binding_tfs[i]
__pyx_v_binding_tf = (&(__pyx_v_reg_seq->binding_tfs[__pyx_v_i]));
+0273: tf_conc = vars[binding_tf.tf.variable]
__pyx_v_tf_conc = (__pyx_v_vars[__pyx_v_binding_tf->tf->variable]);
+0274: fract_apo = binding_tf.tf.w_tf_apo
__pyx_t_3 = __pyx_v_binding_tf->tf->w_tf_apo; __pyx_v_fract_apo = __pyx_t_3;
0275: # ---uncomment to print regulatory effects---
0276: #bound_tot += (1-fract_apo)
+0277: binding_rate = pow((tf_conc * binding_tf.score) / binding_tf.tf.k_bind_op, binding_tf.tf.coop) # rate of binding of tf to operator
__pyx_v_binding_rate = pow(((__pyx_v_tf_conc * __pyx_v_binding_tf->score) / __pyx_v_binding_tf->tf->k_bind_op), __pyx_v_binding_tf->tf->coop);
+0278: reg += fract_apo * binding_tf.tf.eff_apo * binding_rate / total_frac_bound_denom # regulation effect of ligand_free tf-form
__pyx_v_reg = (__pyx_v_reg + (((__pyx_v_fract_apo * __pyx_v_binding_tf->tf->eff_apo) * __pyx_v_binding_rate) / __pyx_v_total_frac_bound_denom));
+0279: reg += (1 - fract_apo) * binding_tf.tf.eff_bound * binding_rate / total_frac_bound_denom # regulation effect of ligand bound tf-form
__pyx_v_reg = (__pyx_v_reg + ((((1.0 - __pyx_v_fract_apo) * __pyx_v_binding_tf->tf->eff_bound) * __pyx_v_binding_rate) / __pyx_v_total_frac_bound_denom)); }
+0280: reg += 1 - (total_frac_bound_nume/ total_frac_bound_denom) # expression effect of unbound operator ( is scaled to 1)
__pyx_v_reg = (__pyx_v_reg + (1.0 - (__pyx_v_total_frac_bound_nume / __pyx_v_total_frac_bound_denom)));
0281: # ---uncomment to print regulatory effects---
0282: #===========================================================================
0283: # frac_reg = (total_frac_bound_nume/ total_frac_bound_denom)
0284: # if reg_seq.nr_binding_tfs > 0 and frac_reg > 0.5:
0285: # frac_bound = bound_tot/ reg_seq.nr_binding_tfs
0286: # if frac_bound > 0.1:
0287: # printf('fract_tf_reg: %f , fract_bound: %f reg: %f\n', frac_reg, frac_bound, reg)
0288: #===========================================================================
+0289: return reg * reg_seq.pr_str
__pyx_r = (__pyx_v_reg * __pyx_v_reg_seq->pr_str); goto __pyx_L0;
0290:
+0291: cdef void transcription(double vars[], double derivs[], cell_str * cell, double product_scaling,
static void __pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_transcription(double *__pyx_v_vars, double *__pyx_v_derivs, struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_cell_str *__pyx_v_cell, double __pyx_v_product_scaling, double __pyx_v_scaling_power) { int __pyx_v_i; int __pyx_v_j; int __pyx_v_ene_var; double __pyx_v_rate; double __pyx_v_ene_conc_tot; struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_pump_str *__pyx_v_pump_s; struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_enzyme_str *__pyx_v_enzyme_s; struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_tf_str *__pyx_v_tf_s; double __pyx_v_production; double __pyx_v_scaled_production; double __pyx_v_base_rate; int __pyx_v_prod_cost; int __pyx_v_energy_cost; double __pyx_v_energy_constraint; double __pyx_v_ene_conc; /* … */ /* function exit code */ }
0292: double scaling_power) nogil:
0293: '''
0294: Transcription (+translation) of genes is a function of the regulatory
0295: effects, the gene multiplicity and the energy constraint function.
0296: Regulatory effects are the sum of binding activities of all binding TFs in
0297: either ligand bound or ligand free states and the remaining basal
0298: transcription rate (fraction of time that the regulatory region is not bound
0299: by TF). The energy constraint function is a saturation function on the rate
0300: of transcription depending on the energy level of the cell. Transcription rate
0301: decreases with decreasing energy. There is also a (small) energetic cost to
0302: transcription.
0303: '''
0304: cdef int i,j, ene_var
0305: cdef double rate, ene_fract
+0306: cdef double ene_conc_tot = 0.
__pyx_v_ene_conc_tot = 0.;
0307: cdef pump_str * pump_s
0308: cdef enzyme_str * enzyme_s
0309: cdef tf_str * tf_s
+0310: cdef double production = vars[cell.production_s.variable]
__pyx_v_production = (__pyx_v_vars[__pyx_v_cell->production_s.variable]);
+0311: cdef double scaled_production = 0.
__pyx_v_scaled_production = 0.;
+0312: cdef double base_rate = 1.
__pyx_v_base_rate = 1.;
+0313: cdef bint prod_cost = False
__pyx_v_prod_cost = 0;
+0314: cdef bint energy_cost = False
__pyx_v_energy_cost = 0;
+0315: if cell.trans_cost > 0:
__pyx_t_1 = ((__pyx_v_cell->trans_cost > 0.0) != 0); if (__pyx_t_1) { /* … */ }
+0316: prod_cost = True
__pyx_v_prod_cost = 1;
+0317: if cell.ene_trans_cost > 0:
__pyx_t_1 = ((__pyx_v_cell->ene_trans_cost > 0.0) != 0); if (__pyx_t_1) { /* … */ }
+0318: energy_cost = True
__pyx_v_energy_cost = 1;
+0319: if prod_cost:
__pyx_t_1 = (__pyx_v_prod_cost != 0); if (__pyx_t_1) { /* … */ }
+0320: if product_scaling == 0:
__pyx_t_1 = ((__pyx_v_product_scaling == 0.0) != 0); if (__pyx_t_1) { /* … */ }
+0321: product_scaling = production
__pyx_v_product_scaling = __pyx_v_production;
+0322: if production > 0:
__pyx_t_1 = ((__pyx_v_production > 0.0) != 0); if (__pyx_t_1) { /* … */ }
+0323: scaled_production = pow(production, scaling_power) / ( pow(production, scaling_power) +
__pyx_v_scaled_production = (pow(__pyx_v_production, __pyx_v_scaling_power) / (pow(__pyx_v_production, __pyx_v_scaling_power) + pow(__pyx_v_product_scaling, __pyx_v_scaling_power)));
0324: pow(product_scaling, scaling_power))
+0325: base_rate *= scaled_production
__pyx_v_base_rate = (__pyx_v_base_rate * __pyx_v_scaled_production);
+0326: if energy_cost:
__pyx_t_1 = (__pyx_v_energy_cost != 0); if (__pyx_t_1) { /* … */ }
+0327: for j in range(cell.nr_energy_mols):
__pyx_t_2 = __pyx_v_cell->nr_energy_mols; for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_j = __pyx_t_3;
+0328: ene_var = cell.energy_mols[j]
__pyx_v_ene_var = (__pyx_v_cell->energy_mols[__pyx_v_j]);
+0329: ene_conc_tot += vars[ene_var]
__pyx_v_ene_conc_tot = (__pyx_v_ene_conc_tot + (__pyx_v_vars[__pyx_v_ene_var])); }
+0330: energy_constraint = ene_conc_tot / (ene_conc_tot + cell.k_ene_trans)
__pyx_v_energy_constraint = (__pyx_v_ene_conc_tot / (__pyx_v_ene_conc_tot + __pyx_v_cell->k_ene_trans));
+0331: base_rate *= energy_constraint
__pyx_v_base_rate = (__pyx_v_base_rate * __pyx_v_energy_constraint);
0332: #energy_constraint = scaled_production / (scaled_production + cell.k_ene_trans)
0333: #printf("energy_constraint %f\n ", energy_constraint)
+0334: for i in range(cell.genome.nr_pumps):
__pyx_t_2 = __pyx_v_cell->genome.nr_pumps; for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3;
+0335: pump_s = cell.genome.pumps[i]
__pyx_v_pump_s = (__pyx_v_cell->genome.pumps[__pyx_v_i]);
+0336: if pump_s.gene_multiplicity == 0: # if gene copy number == 0, skip transcription
__pyx_t_1 = ((__pyx_v_pump_s->gene_multiplicity == 0.0) != 0); if (__pyx_t_1) { /* … */ }
+0337: continue
goto __pyx_L11_continue;
+0338: rate = base_rate * pump_s.gene_multiplicity * transcription_rate(vars, pump_s.reg_seq)
__pyx_v_rate = ((__pyx_v_base_rate * __pyx_v_pump_s->gene_multiplicity) * __pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_transcription_rate(__pyx_v_vars, __pyx_v_pump_s->reg_seq));
+0339: if rate <= 0.:
__pyx_t_1 = ((__pyx_v_rate <= 0.) != 0); if (__pyx_t_1) { /* … */ }
+0340: continue
goto __pyx_L11_continue;
+0341: derivs[pump_s.variable] += rate
__pyx_t_4 = __pyx_v_pump_s->variable; (__pyx_v_derivs[__pyx_t_4]) = ((__pyx_v_derivs[__pyx_t_4]) + __pyx_v_rate);
+0342: if prod_cost:
__pyx_t_1 = (__pyx_v_prod_cost != 0); if (__pyx_t_1) { /* … */ }
+0343: derivs[cell.production_s.variable] -= cell.trans_cost * rate * vars[cell.production_s.variable]
__pyx_t_4 = __pyx_v_cell->production_s.variable; (__pyx_v_derivs[__pyx_t_4]) = ((__pyx_v_derivs[__pyx_t_4]) - ((__pyx_v_cell->trans_cost * __pyx_v_rate) * (__pyx_v_vars[__pyx_v_cell->production_s.variable])));
+0344: if energy_cost:
__pyx_t_1 = (__pyx_v_energy_cost != 0); if (__pyx_t_1) { /* … */ } __pyx_L11_continue:; }
+0345: for j in range(cell.nr_energy_mols):
__pyx_t_4 = __pyx_v_cell->nr_energy_mols; for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { __pyx_v_j = __pyx_t_5;
+0346: ene_var = cell.energy_mols[j]
__pyx_v_ene_var = (__pyx_v_cell->energy_mols[__pyx_v_j]);
+0347: ene_conc = vars[ene_var]
__pyx_v_ene_conc = (__pyx_v_vars[__pyx_v_ene_var]);
+0348: derivs[ene_var] -= cell.ene_trans_cost * rate * ene_conc / ene_conc_tot
__pyx_t_6 = __pyx_v_ene_var; (__pyx_v_derivs[__pyx_t_6]) = ((__pyx_v_derivs[__pyx_t_6]) - (((__pyx_v_cell->ene_trans_cost * __pyx_v_rate) * __pyx_v_ene_conc) / __pyx_v_ene_conc_tot)); }
0349:
+0350: for i in range(cell.genome.nr_enzymes):
__pyx_t_2 = __pyx_v_cell->genome.nr_enzymes; for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3;
+0351: enzyme_s = cell.genome.enzymes[i]
__pyx_v_enzyme_s = (__pyx_v_cell->genome.enzymes[__pyx_v_i]);
+0352: if enzyme_s.gene_multiplicity == 0:
__pyx_t_1 = ((__pyx_v_enzyme_s->gene_multiplicity == 0.0) != 0); if (__pyx_t_1) { /* … */ }
+0353: continue
goto __pyx_L19_continue;
+0354: rate = base_rate * enzyme_s.gene_multiplicity * transcription_rate(vars, enzyme_s.reg_seq)
__pyx_v_rate = ((__pyx_v_base_rate * __pyx_v_enzyme_s->gene_multiplicity) * __pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_transcription_rate(__pyx_v_vars, __pyx_v_enzyme_s->reg_seq));
+0355: if rate <= 0.:
__pyx_t_1 = ((__pyx_v_rate <= 0.) != 0); if (__pyx_t_1) { /* … */ }
+0356: continue
goto __pyx_L19_continue;
+0357: derivs[enzyme_s.variable] += rate
__pyx_t_4 = __pyx_v_enzyme_s->variable; (__pyx_v_derivs[__pyx_t_4]) = ((__pyx_v_derivs[__pyx_t_4]) + __pyx_v_rate);
+0358: if prod_cost:
__pyx_t_1 = (__pyx_v_prod_cost != 0); if (__pyx_t_1) { /* … */ }
+0359: derivs[cell.production_s.variable] -= cell.trans_cost * rate * vars[cell.production_s.variable]
__pyx_t_4 = __pyx_v_cell->production_s.variable; (__pyx_v_derivs[__pyx_t_4]) = ((__pyx_v_derivs[__pyx_t_4]) - ((__pyx_v_cell->trans_cost * __pyx_v_rate) * (__pyx_v_vars[__pyx_v_cell->production_s.variable])));
+0360: if energy_cost:
__pyx_t_1 = (__pyx_v_energy_cost != 0); if (__pyx_t_1) { /* … */ } __pyx_L19_continue:; }
+0361: for j in range(cell.nr_energy_mols):
__pyx_t_4 = __pyx_v_cell->nr_energy_mols; for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { __pyx_v_j = __pyx_t_5;
+0362: ene_var = cell.energy_mols[j]
__pyx_v_ene_var = (__pyx_v_cell->energy_mols[__pyx_v_j]);
+0363: ene_conc = vars[ene_var]
__pyx_v_ene_conc = (__pyx_v_vars[__pyx_v_ene_var]);
+0364: derivs[ene_var] -= cell.ene_trans_cost * rate * ene_conc / ene_conc_tot
__pyx_t_6 = __pyx_v_ene_var; (__pyx_v_derivs[__pyx_t_6]) = ((__pyx_v_derivs[__pyx_t_6]) - (((__pyx_v_cell->ene_trans_cost * __pyx_v_rate) * __pyx_v_ene_conc) / __pyx_v_ene_conc_tot)); }
0365:
+0366: for i in range(cell.genome.nr_tfs):
__pyx_t_2 = __pyx_v_cell->genome.nr_tfs; for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3;
+0367: tf_s = cell.genome.tfs[i]
__pyx_v_tf_s = (__pyx_v_cell->genome.tfs[__pyx_v_i]);
+0368: if tf_s.gene_multiplicity == 0:
__pyx_t_1 = ((__pyx_v_tf_s->gene_multiplicity == 0.0) != 0); if (__pyx_t_1) { /* … */ }
+0369: continue
goto __pyx_L27_continue;
+0370: rate = base_rate * tf_s.gene_multiplicity * transcription_rate(vars, tf_s.reg_seq)
__pyx_v_rate = ((__pyx_v_base_rate * __pyx_v_tf_s->gene_multiplicity) * __pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_transcription_rate(__pyx_v_vars, __pyx_v_tf_s->reg_seq));
+0371: if rate <= 0.:
__pyx_t_1 = ((__pyx_v_rate <= 0.) != 0); if (__pyx_t_1) { /* … */ }
+0372: continue
goto __pyx_L27_continue;
+0373: derivs[tf_s.variable] += rate
__pyx_t_4 = __pyx_v_tf_s->variable; (__pyx_v_derivs[__pyx_t_4]) = ((__pyx_v_derivs[__pyx_t_4]) + __pyx_v_rate);
+0374: if prod_cost:
__pyx_t_1 = (__pyx_v_prod_cost != 0); if (__pyx_t_1) { /* … */ }
+0375: derivs[cell.production_s.variable] -= cell.trans_cost * rate * vars[cell.production_s.variable]
__pyx_t_4 = __pyx_v_cell->production_s.variable; (__pyx_v_derivs[__pyx_t_4]) = ((__pyx_v_derivs[__pyx_t_4]) - ((__pyx_v_cell->trans_cost * __pyx_v_rate) * (__pyx_v_vars[__pyx_v_cell->production_s.variable])));
+0376: if energy_cost:
__pyx_t_1 = (__pyx_v_energy_cost != 0); if (__pyx_t_1) { /* … */ } __pyx_L27_continue:; }
+0377: for j in range(cell.nr_energy_mols):
__pyx_t_4 = __pyx_v_cell->nr_energy_mols; for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { __pyx_v_j = __pyx_t_5;
+0378: ene_var = cell.energy_mols[j]
__pyx_v_ene_var = (__pyx_v_cell->energy_mols[__pyx_v_j]);
+0379: ene_conc = vars[ene_var]
__pyx_v_ene_conc = (__pyx_v_vars[__pyx_v_ene_var]);
+0380: derivs[ene_var] -= cell.ene_trans_cost * rate * ene_conc / ene_conc_tot
__pyx_t_6 = __pyx_v_ene_var; (__pyx_v_derivs[__pyx_t_6]) = ((__pyx_v_derivs[__pyx_t_6]) - (((__pyx_v_cell->ene_trans_cost * __pyx_v_rate) * __pyx_v_ene_conc) / __pyx_v_ene_conc_tot)); }
0381:
0382:
+0383: cdef double tf_states(double vars[], tf_str * tf) nogil:
static double __pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_tf_states(double *__pyx_v_vars, struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_tf_str *__pyx_v_tf) { double __pyx_v_p_unbound; double __pyx_v_p_bound; double __pyx_v_ligand_conc; double __pyx_v_ligand_coop; int __pyx_v_i; double __pyx_v_ligand_k; double __pyx_r; /* … */ /* function exit code */ __pyx_L0:; return __pyx_r; }
0384: '''
0385: Calculate the chance that this TF remains unbound by a ligand as
0386: p_unbound = Product<1,i>( (1 - p_bound_ligand_i) ) for i in {binding ligands}
0387: '''
+0388: cdef double p_unbound = 1.
__pyx_v_p_unbound = 1.;
0389: cdef double p_bound, ligand_conc, ligand_coop, k_bind
0390: cdef int i
+0391: for i in range(tf.nr_ligands):
__pyx_t_1 = __pyx_v_tf->nr_ligands; for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2;
+0392: ligand_conc = vars[tf.ligands[i].variable]
__pyx_v_ligand_conc = (__pyx_v_vars[(__pyx_v_tf->ligands[__pyx_v_i]).variable]);
+0393: ligand_coop = tf.ligands[i].coop
__pyx_t_3 = (__pyx_v_tf->ligands[__pyx_v_i]).coop; __pyx_v_ligand_coop = __pyx_t_3;
+0394: ligand_k = tf.ligands[i].k_bind
__pyx_t_3 = (__pyx_v_tf->ligands[__pyx_v_i]).k_bind; __pyx_v_ligand_k = __pyx_t_3;
+0395: p_bound = ( pow(ligand_conc, ligand_coop) /
__pyx_v_p_bound = (pow(__pyx_v_ligand_conc, __pyx_v_ligand_coop) / (pow(__pyx_v_ligand_k, __pyx_v_ligand_coop) + pow(__pyx_v_ligand_conc, __pyx_v_ligand_coop)));
0396: (pow(ligand_k, ligand_coop) + pow(ligand_conc, ligand_coop) ))
+0397: p_unbound *= (1 - p_bound)
__pyx_v_p_unbound = (__pyx_v_p_unbound * (1.0 - __pyx_v_p_bound)); }
+0398: return p_unbound
__pyx_r = __pyx_v_p_unbound; goto __pyx_L0;
0399:
+0400: cdef void tfs_states(double vars[], tf_str ** tfs, int nr_tfs) nogil:
static void __pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_tfs_states(double *__pyx_v_vars, struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_tf_str **__pyx_v_tfs, int __pyx_v_nr_tfs) { int __pyx_v_i; /* … */ /* function exit code */ }
0401: cdef int i
0402: cdef double eff_apo
+0403: for i in range(nr_tfs):
__pyx_t_1 = __pyx_v_nr_tfs; for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2;
+0404: tfs[i].w_tf_apo = tf_states(vars, tfs[i])
(__pyx_v_tfs[__pyx_v_i])->w_tf_apo = __pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_tf_states(__pyx_v_vars, (__pyx_v_tfs[__pyx_v_i])); }
0405:
+0406: cdef void production(double vars[], double derivs[], cell_str * cell) nogil:
static void __pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_production(double *__pyx_v_vars, double *__pyx_v_derivs, struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_cell_str *__pyx_v_cell) { int __pyx_v_i; int __pyx_v_ene_var; struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_production_str *__pyx_v_production_s; struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_building_block_str *__pyx_v_block_s; double __pyx_v_ene_conc; double __pyx_v_rate; double __pyx_v_bb_avrg; double __pyx_v_abs_conc_diff; double __pyx_v_tot_conc; CYTHON_UNUSED double __pyx_v_old_rate; /* … */ /* function exit code */ }
0407: cdef int i, ene_var
+0408: cdef production_str * production_s = &cell.production_s
__pyx_v_production_s = (&__pyx_v_cell->production_s);
0409: cdef building_block_str * block_s
+0410: cdef double ene_conc = 0.
__pyx_v_ene_conc = 0.;
+0411: cdef double rate = production_s.v_max
__pyx_t_1 = __pyx_v_production_s->v_max; __pyx_v_rate = __pyx_t_1;
0412: cdef double bb_conc, bb_avrg
+0413: cdef double abs_conc_diff = 0
__pyx_v_abs_conc_diff = 0.0;
+0414: cdef double tot_conc = 0
__pyx_v_tot_conc = 0.0;
0415:
+0416: if production_s.energy:
__pyx_t_2 = (__pyx_v_production_s->energy != 0); if (__pyx_t_2) { /* … */ }
+0417: for i in range(cell.nr_energy_mols):
__pyx_t_3 = __pyx_v_cell->nr_energy_mols; for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_i = __pyx_t_4;
+0418: ene_var = cell.energy_mols[i]
__pyx_v_ene_var = (__pyx_v_cell->energy_mols[__pyx_v_i]);
+0419: ene_conc += vars[ene_var]
__pyx_v_ene_conc = (__pyx_v_ene_conc + (__pyx_v_vars[__pyx_v_ene_var])); }
+0420: rate *= ene_conc
__pyx_v_rate = (__pyx_v_rate * __pyx_v_ene_conc);
0421:
+0422: for i in range(production_s.nr_building_blocks):
__pyx_t_3 = __pyx_v_production_s->nr_building_blocks; for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_i = __pyx_t_4;
+0423: block_s = production_s.building_blocks[i]
__pyx_v_block_s = (__pyx_v_production_s->building_blocks[__pyx_v_i]);
+0424: tot_conc += vars[block_s.var]
__pyx_v_tot_conc = (__pyx_v_tot_conc + (__pyx_v_vars[__pyx_v_block_s->var]));
+0425: rate *= pow(vars[block_s.var], block_s.stoi)
__pyx_v_rate = (__pyx_v_rate * pow((__pyx_v_vars[__pyx_v_block_s->var]), __pyx_v_block_s->stoi)); }
0426:
+0427: bb_avrg = tot_conc / <double>production_s.nr_building_blocks
__pyx_v_bb_avrg = (__pyx_v_tot_conc / ((double)__pyx_v_production_s->nr_building_blocks));
+0428: for i in range(production_s.nr_building_blocks):
__pyx_t_3 = __pyx_v_production_s->nr_building_blocks; for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_i = __pyx_t_4;
+0429: block_s = production_s.building_blocks[i]
__pyx_v_block_s = (__pyx_v_production_s->building_blocks[__pyx_v_i]);
+0430: abs_conc_diff += fabs(bb_avrg - vars[block_s.var])
__pyx_v_abs_conc_diff = (__pyx_v_abs_conc_diff + fabs((__pyx_v_bb_avrg - (__pyx_v_vars[__pyx_v_block_s->var])))); }
+0431: cdef double old_rate = rate
__pyx_v_old_rate = __pyx_v_rate;
+0432: if bb_avrg > 1e-30:
__pyx_t_2 = ((__pyx_v_bb_avrg > 1e-30) != 0); if (__pyx_t_2) { /* … */ }
+0433: rate = rate / (1 + abs_conc_diff * cell.h_homeostatic_bb/ bb_avrg)
__pyx_v_rate = (__pyx_v_rate / (1.0 + ((__pyx_v_abs_conc_diff * __pyx_v_cell->h_homeostatic_bb) / __pyx_v_bb_avrg)));
+0434: for i in range(production_s.nr_building_blocks):
__pyx_t_3 = __pyx_v_production_s->nr_building_blocks; for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_i = __pyx_t_4;
+0435: block_s = production_s.building_blocks[i]
__pyx_v_block_s = (__pyx_v_production_s->building_blocks[__pyx_v_i]);
+0436: derivs[block_s.var] -= (rate * block_s.stoi)
__pyx_t_5 = __pyx_v_block_s->var; (__pyx_v_derivs[__pyx_t_5]) = ((__pyx_v_derivs[__pyx_t_5]) - (__pyx_v_rate * __pyx_v_block_s->stoi)); }
0437:
+0438: if production_s.energy:
__pyx_t_2 = (__pyx_v_production_s->energy != 0); if (__pyx_t_2) { /* … */ }
+0439: for i in range(cell.nr_energy_mols):
__pyx_t_3 = __pyx_v_cell->nr_energy_mols; for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_i = __pyx_t_4;
+0440: ene_var = cell.energy_mols[i]
__pyx_v_ene_var = (__pyx_v_cell->energy_mols[__pyx_v_i]);
+0441: derivs[ene_var] -= rate * vars[ene_var]
__pyx_t_5 = __pyx_v_ene_var; (__pyx_v_derivs[__pyx_t_5]) = ((__pyx_v_derivs[__pyx_t_5]) - (__pyx_v_rate * (__pyx_v_vars[__pyx_v_ene_var]))); }
0442:
+0443: cell.production_s.pos_production = rate
__pyx_v_cell->production_s.pos_production = __pyx_v_rate;
+0444: derivs[production_s.variable] += rate
__pyx_t_3 = __pyx_v_production_s->variable; (__pyx_v_derivs[__pyx_t_3]) = ((__pyx_v_derivs[__pyx_t_3]) + __pyx_v_rate);
0445:
+0446: cdef void calc_growth_rate(double vars[], cell_str * cell, double product_scaling, double scaling_power) nogil:
static void __pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_calc_growth_rate(double *__pyx_v_vars, struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_cell_str *__pyx_v_cell, double __pyx_v_product_scaling, double __pyx_v_scaling_power) { double __pyx_v_production; double __pyx_v_V; double __pyx_v_scaled_production; double __pyx_v_v_max; /* … */ /* function exit code */ }
0447: """
0448: Calculate the growth (and shrink) rate of a cell.
0449:
0450: Growth depends on available production and the cell volume, whereas
0451: shrinking is an intrinsic process that is only proportional to cell volume.
0452: Rates are stored in the cell_str struct for subsequent use.
0453:
0454: Parameters
0455: ----------
0456: cell : cell_str
0457: the cell
0458: product_scaling : double
0459: measure of relative production in the population to scale this cells
0460: growth rate
0461: """
+0462: cdef double production = vars[cell.production_s.variable]
__pyx_v_production = (__pyx_v_vars[__pyx_v_cell->production_s.variable]);
+0463: cdef double V = vars[cell.cell_size_s.var]
__pyx_v_V = (__pyx_v_vars[__pyx_v_cell->cell_size_s.var]);
+0464: cdef double scaled_production = 0.
__pyx_v_scaled_production = 0.;
+0465: if product_scaling == 0:
__pyx_t_1 = ((__pyx_v_product_scaling == 0.0) != 0); if (__pyx_t_1) { /* … */ }
+0466: product_scaling = production
__pyx_v_product_scaling = __pyx_v_production;
+0467: if production > 0:
__pyx_t_1 = ((__pyx_v_production > 0.0) != 0); if (__pyx_t_1) { /* … */ }
+0468: scaled_production = pow(production, scaling_power) / ( pow(production, scaling_power) +
__pyx_v_scaled_production = (pow(__pyx_v_production, __pyx_v_scaling_power) / (pow(__pyx_v_production, __pyx_v_scaling_power) + pow(__pyx_v_product_scaling, __pyx_v_scaling_power)));
0469: pow(product_scaling, scaling_power))
+0470: cdef double v_max = cell.cell_size_s.growth_const * scaled_production
__pyx_v_v_max = (__pyx_v_cell->cell_size_s.growth_const * __pyx_v_scaled_production);
+0471: cell.cell_size_s.growth_rate = v_max * V * ( 1. - V / cell.cell_size_s.max_size )
__pyx_v_cell->cell_size_s.growth_rate = ((__pyx_v_v_max * __pyx_v_V) * (1. - (__pyx_v_V / __pyx_v_cell->cell_size_s.max_size)));
+0472: cell.cell_size_s.shrink_rate = V * cell.cell_size_s.shrink_const
__pyx_v_cell->cell_size_s.shrink_rate = (__pyx_v_V * __pyx_v_cell->cell_size_s.shrink_const);
0473:
+0474: cdef void cell_growth(double vars[], double derivs[], cell_str * cell) nogil:
static void __pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_cell_growth(double *__pyx_v_vars, double *__pyx_v_derivs, struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_cell_str *__pyx_v_cell) { struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_cell_size_str *__pyx_v_cell_size_s; /* … */ /* function exit code */ }
0475: """
0476: Change the cell volume.
0477:
0478: growth is proportional to the Production (Prod), the cell Volume and the
0479: distance of Volume to max-cell-Volume:
0480:
0481: growth_rate = growth_const * ( Prod / ( Prod + prod_scaling) ) * V * ( 1 - V/ max_V)
0482:
0483: dV/dt = growth_rate - shrink_rate
0484: dProd/dt = - cost * growth_rate * Prod
0485: """
+0486: cdef cell_size_str * cell_size_s = &cell.cell_size_s
/* "VirtualMicrobes/cython_gsl_interface/odes.pyx":486 * dProd/dt = - cost * growth_rate * Prod * """ * cdef cell_size_str * cell_size_s = &cell.cell_size_s # <<<<<<<<<<<<<< * derivs[cell_size_s.var] += cell_size_s.growth_rate - cell_size_s.shrink_rate * derivs[cell.production_s.variable] -= ( cell_size_s.growth_cost * */ __pyx_v_cell_size_s = (&__pyx_v_cell->cell_size_s);
+0487: derivs[cell_size_s.var] += cell_size_s.growth_rate - cell_size_s.shrink_rate
/* "VirtualMicrobes/cython_gsl_interface/odes.pyx":487 * """ * cdef cell_size_str * cell_size_s = &cell.cell_size_s * derivs[cell_size_s.var] += cell_size_s.growth_rate - cell_size_s.shrink_rate # <<<<<<<<<<<<<< * derivs[cell.production_s.variable] -= ( cell_size_s.growth_cost * * cell_size_s.growth_rate * */ __pyx_t_1 = __pyx_v_cell_size_s->var; (__pyx_v_derivs[__pyx_t_1]) = ((__pyx_v_derivs[__pyx_t_1]) + (__pyx_v_cell_size_s->growth_rate - __pyx_v_cell_size_s->shrink_rate));
+0488: derivs[cell.production_s.variable] -= ( cell_size_s.growth_cost *
__pyx_t_1 = __pyx_v_cell->production_s.variable; /* … */ (__pyx_v_derivs[__pyx_t_1]) = ((__pyx_v_derivs[__pyx_t_1]) - ((__pyx_v_cell_size_s->growth_cost * __pyx_v_cell_size_s->growth_rate) * (__pyx_v_vars[__pyx_v_cell->production_s.variable])));
0489: cell_size_s.growth_rate *
0490: vars[cell.production_s.variable] )
0491:
+0492: cdef void toxicity(double vars[], double derivs[], cell_str * cell) nogil:
static void __pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_toxicity(double *__pyx_v_vars, double *__pyx_v_derivs, struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_cell_str *__pyx_v_cell) { int __pyx_v_i; struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_toxicity_str __pyx_v_toxicity_s; struct mol_str *__pyx_v_small_mol; double __pyx_v_toxic_effect; double __pyx_v_toxic_level; /* … */ /* function exit code */ }
0493: cdef int i
+0494: cdef toxicity_str toxicity_s = cell.toxicity_s
__pyx_t_1 = __pyx_v_cell->toxicity_s; __pyx_v_toxicity_s = __pyx_t_1;
0495: cdef mol_str * small_mol
0496: cdef double toxic_effect, toxic_level
+0497: for i in range(toxicity_s.nr_internal_mols):
__pyx_t_2 = __pyx_v_toxicity_s.nr_internal_mols; for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3;
+0498: small_mol = toxicity_s.internal_mols[i]
__pyx_v_small_mol = (__pyx_v_toxicity_s.internal_mols[__pyx_v_i]);
+0499: toxic_level = small_mol.toxic_level
__pyx_t_4 = __pyx_v_small_mol->toxic_level; __pyx_v_toxic_level = __pyx_t_4;
+0500: toxic_effect = 0.
__pyx_v_toxic_effect = 0.;
+0501: if toxic_level > 0.:
__pyx_t_5 = ((__pyx_v_toxic_level > 0.) != 0); if (__pyx_t_5) { /* … */ }
+0502: toxic_effect = max(0, (vars[small_mol.variable] - toxic_level)/ toxic_level)
__pyx_t_4 = (((__pyx_v_vars[__pyx_v_small_mol->variable]) - __pyx_v_toxic_level) / __pyx_v_toxic_level); __pyx_t_6 = 0; if (((__pyx_t_4 > __pyx_t_6) != 0)) { __pyx_t_7 = __pyx_t_4; } else { __pyx_t_7 = __pyx_t_6; } __pyx_v_toxic_effect = __pyx_t_7;
+0503: derivs[toxicity_s.variable] += toxic_effect
__pyx_t_8 = __pyx_v_toxicity_s.variable; (__pyx_v_derivs[__pyx_t_8]) = ((__pyx_v_derivs[__pyx_t_8]) + __pyx_v_toxic_effect); }
0504:
+0505: cdef void cell_odes(double vars[], double derivs[], cell_str * cell,
static void __pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_cell_odes(double *__pyx_v_vars, double *__pyx_v_derivs, struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_cell_str *__pyx_v_cell, double __pyx_v_env_volume, double __pyx_v_membrane_occupancy_constant, double __pyx_v_volume_occupancy_constant, double __pyx_v_product_scaling, double __pyx_v_scaling_power) { /* … */ /* function exit code */ }
0506: double env_volume, double membrane_occupancy_constant,
0507: double volume_occupancy_constant,
0508: double product_scaling, double scaling_power) nogil:
0509:
+0510: calc_growth_rate(vars, cell, product_scaling, scaling_power)
__pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_calc_growth_rate(__pyx_v_vars, __pyx_v_cell, __pyx_v_product_scaling, __pyx_v_scaling_power);
+0511: tfs_states(vars, cell.genome.tfs, cell.genome.nr_tfs)
__pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_tfs_states(__pyx_v_vars, __pyx_v_cell->genome.tfs, __pyx_v_cell->genome.nr_tfs);
+0512: transcription(vars, derivs, cell, product_scaling, scaling_power)
__pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_transcription(__pyx_v_vars, __pyx_v_derivs, __pyx_v_cell, __pyx_v_product_scaling, __pyx_v_scaling_power);
+0513: transporting(vars, derivs, cell, env_volume, membrane_occupancy_constant)
__pyx_t_1.__pyx_n = 1; __pyx_t_1.membrane_occupancy_constant = __pyx_v_membrane_occupancy_constant; __pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_transporting(__pyx_v_vars, __pyx_v_derivs, __pyx_v_cell, __pyx_v_env_volume, &__pyx_t_1);
+0514: converting(vars, derivs, cell, volume_occupancy_constant)
__pyx_t_2.__pyx_n = 1; __pyx_t_2.volume_occupancy_constant = __pyx_v_volume_occupancy_constant; __pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_converting(__pyx_v_vars, __pyx_v_derivs, __pyx_v_cell, &__pyx_t_2);
+0515: degrading(vars, derivs, cell)
__pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_degrading(__pyx_v_vars, __pyx_v_derivs, __pyx_v_cell);
+0516: diffusing(vars, derivs, cell, env_volume)
__pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_diffusing(__pyx_v_vars, __pyx_v_derivs, __pyx_v_cell, __pyx_v_env_volume);
+0517: production(vars, derivs, cell)
__pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_production(__pyx_v_vars, __pyx_v_derivs, __pyx_v_cell);
+0518: cell_growth(vars, derivs, cell)
__pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_cell_growth(__pyx_v_vars, __pyx_v_derivs, __pyx_v_cell);
+0519: toxicity(vars, derivs, cell)
__pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_toxicity(__pyx_v_vars, __pyx_v_derivs, __pyx_v_cell);
0520:
+0521: cdef void pop_odes(double vars[], double derivs[], population_str * pop,
static void __pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_pop_odes(double *__pyx_v_vars, double *__pyx_v_derivs, struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_population_str *__pyx_v_pop, double __pyx_v_env_volume, double __pyx_v_membrane_occupancy_constant, double __pyx_v_volume_occupancy_constant, CYTHON_UNUSED int __pyx_v_num_threads) { int __pyx_v_i; /* … */ /* function exit code */ }
0522: double env_volume, double membrane_occupancy_constant,
0523: double volume_occupancy_constant, int num_threads) nogil:
0524: cdef int i
+0525: for i in range(pop.nr_cells): #parallel.prange(pop.nr_cells, schedule='guided', num_threads=num_threads):
__pyx_t_1 = __pyx_v_pop->nr_cells; for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2;
+0526: cell_odes(vars, derivs, pop.cells[i], env_volume, membrane_occupancy_constant,
__pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_cell_odes(__pyx_v_vars, __pyx_v_derivs, (__pyx_v_pop->cells[__pyx_v_i]), __pyx_v_env_volume, __pyx_v_membrane_occupancy_constant, __pyx_v_volume_occupancy_constant, __pyx_v_pop->product_scaling, __pyx_v_pop->product_scaling_power); }
0527: volume_occupancy_constant, pop.product_scaling, pop.product_scaling_power)
0528:
+0529: cdef void influx(double vars[], double derivs[], env_str * env) nogil:
static void __pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_influx(CYTHON_UNUSED double *__pyx_v_vars, double *__pyx_v_derivs, struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_env_str *__pyx_v_env) { int __pyx_v_i; double __pyx_v_rate; struct mol_str *__pyx_v_mol_s; /* … */ /* function exit code */ }
0530: cdef int i
0531: cdef double rate
0532: cdef mol_str * mol_s
+0533: for i in range(env.nr_small_mols):
__pyx_t_1 = __pyx_v_env->nr_small_mols; for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2;
+0534: mol_s = env.small_mols[i]
__pyx_v_mol_s = (__pyx_v_env->small_mols[__pyx_v_i]);
0535: #rate = vars[mol_s.variable] * mol_s.influx_const Leave as a reminder of what a stupid small mistake looks like
+0536: rate = mol_s.influx_const
__pyx_t_3 = __pyx_v_mol_s->influx_const; __pyx_v_rate = __pyx_t_3;
+0537: derivs[mol_s.variable] += rate #/ env.volume
__pyx_t_4 = __pyx_v_mol_s->variable; (__pyx_v_derivs[__pyx_t_4]) = ((__pyx_v_derivs[__pyx_t_4]) + __pyx_v_rate); }
0538:
+0539: cdef void derivs_zero(double derivs[], int dim) nogil:
static void __pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_derivs_zero(double *__pyx_v_derivs, int __pyx_v_dim) { int __pyx_v_i; /* … */ /* function exit code */ }
0540: cdef int i
+0541: for i in range(dim):
__pyx_t_1 = __pyx_v_dim; for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2;
+0542: derivs[i] = 0.
(__pyx_v_derivs[__pyx_v_i]) = 0.; }
0543:
+0544: cdef int master_eq_function(double time, double vars[], double derivs[], void *params) nogil:
static int __pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_master_eq_function(CYTHON_UNUSED double __pyx_v_time, double *__pyx_v_vars, double *__pyx_v_derivs, void *__pyx_v_params) { struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_system_str *__pyx_v_system; CYTHON_UNUSED double __pyx_v_volume_out; CYTHON_UNUSED struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_population_str *__pyx_v_the_population; CYTHON_UNUSED int __pyx_v_len; int __pyx_r; /* … */ /* function exit code */ __pyx_L0:; return __pyx_r; }
+0545: cdef system_str * system = (<system_str *>params)
__pyx_v_system = ((struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_system_str *)__pyx_v_params);
+0546: cdef double volume_out = system.environment.volume
__pyx_t_1 = __pyx_v_system->environment->volume; __pyx_v_volume_out = __pyx_t_1;
+0547: cdef population_str * the_population = system.population
__pyx_t_2 = __pyx_v_system->population; __pyx_v_the_population = __pyx_t_2;
+0548: cdef int len = sizeof(derivs)/sizeof(double)
__pyx_v_len = ((sizeof(__pyx_v_derivs)) / (sizeof(double)));
+0549: derivs_zero(derivs, system.dimension)
__pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_derivs_zero(__pyx_v_derivs, __pyx_v_system->dimension);
+0550: influx(vars, derivs, system.environment)
__pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_influx(__pyx_v_vars, __pyx_v_derivs, __pyx_v_system->environment);
+0551: env_degrading(vars, derivs, system.environment)
__pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_env_degrading(__pyx_v_vars, __pyx_v_derivs, __pyx_v_system->environment);
+0552: pop_odes(vars, derivs, system.population, system.environment.volume,
__pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_pop_odes(__pyx_v_vars, __pyx_v_derivs, __pyx_v_system->population, __pyx_v_system->environment->volume, __pyx_v_system->membrane_occupancy_constant, __pyx_v_system->volume_occupancy_constant, __pyx_v_system->num_threads);
0553: system.membrane_occupancy_constant, system.volume_occupancy_constant,
0554: system.num_threads)
+0555: return GSL_SUCCESS
__pyx_r = __pyx_e_10cython_gsl_GSL_SUCCESS; goto __pyx_L0;
0556:
+0557: cdef void store_cell_state(double vars[], cell_str * cell, double time) nogil:
static void __pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_store_cell_state(double *__pyx_v_vars, struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_cell_str *__pyx_v_cell, double __pyx_v_time) {
int __pyx_v_index;
int __pyx_v_i;
/* … */
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_WriteUnraisable("VirtualMicrobes.cython_gsl_interface.odes.store_cell_state", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 1);
__pyx_L0:;
}
+0558: cdef int index = cell.nr_time_points_stored
__pyx_t_1 = __pyx_v_cell->nr_time_points_stored; __pyx_v_index = __pyx_t_1;
0559: cdef int i
+0560: cell.time_points[index] = time
if (unlikely(!__pyx_v_cell->time_points.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 560, __pyx_L1_error)}
__pyx_t_2 = __pyx_v_index;
*((double *) ( /* dim=0 */ (__pyx_v_cell->time_points.data + __pyx_t_2 * __pyx_v_cell->time_points.strides[0]) )) = __pyx_v_time;
+0561: for i in range(cell.nr_small_mols):
__pyx_t_1 = __pyx_v_cell->nr_small_mols; for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_1; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3;
+0562: cell.small_mols[i].time_concentration_vector[index] = vars[cell.small_mols[i].variable]
if (unlikely(!(__pyx_v_cell->small_mols[__pyx_v_i])->time_concentration_vector.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 562, __pyx_L1_error)}
__pyx_t_4 = __pyx_v_index;
*((double *) ( /* dim=0 */ ((__pyx_v_cell->small_mols[__pyx_v_i])->time_concentration_vector.data + __pyx_t_4 * (__pyx_v_cell->small_mols[__pyx_v_i])->time_concentration_vector.strides[0]) )) = (__pyx_v_vars[(__pyx_v_cell->small_mols[__pyx_v_i])->variable]);
}
+0563: for i in range(cell.genome.nr_pumps):
__pyx_t_1 = __pyx_v_cell->genome.nr_pumps; for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_1; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3;
+0564: cell.genome.pumps[i].time_concentration_vector[index] = vars[cell.genome.pumps[i].variable]
if (unlikely(!(__pyx_v_cell->genome.pumps[__pyx_v_i])->time_concentration_vector.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 564, __pyx_L1_error)}
__pyx_t_5 = __pyx_v_index;
*((double *) ( /* dim=0 */ ((__pyx_v_cell->genome.pumps[__pyx_v_i])->time_concentration_vector.data + __pyx_t_5 * (__pyx_v_cell->genome.pumps[__pyx_v_i])->time_concentration_vector.strides[0]) )) = (__pyx_v_vars[(__pyx_v_cell->genome.pumps[__pyx_v_i])->variable]);
}
+0565: for i in range(cell.genome.nr_enzymes):
__pyx_t_1 = __pyx_v_cell->genome.nr_enzymes; for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_1; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3;
+0566: cell.genome.enzymes[i].time_concentration_vector[index] = vars[cell.genome.enzymes[i].variable]
if (unlikely(!(__pyx_v_cell->genome.enzymes[__pyx_v_i])->time_concentration_vector.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 566, __pyx_L1_error)}
__pyx_t_6 = __pyx_v_index;
*((double *) ( /* dim=0 */ ((__pyx_v_cell->genome.enzymes[__pyx_v_i])->time_concentration_vector.data + __pyx_t_6 * (__pyx_v_cell->genome.enzymes[__pyx_v_i])->time_concentration_vector.strides[0]) )) = (__pyx_v_vars[(__pyx_v_cell->genome.enzymes[__pyx_v_i])->variable]);
}
+0567: for i in range(cell.genome.nr_tfs):
__pyx_t_1 = __pyx_v_cell->genome.nr_tfs; for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_1; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3;
+0568: cell.genome.tfs[i].time_concentration_vector[index] = vars[cell.genome.tfs[i].variable]
if (unlikely(!(__pyx_v_cell->genome.tfs[__pyx_v_i])->time_concentration_vector.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 568, __pyx_L1_error)}
__pyx_t_7 = __pyx_v_index;
*((double *) ( /* dim=0 */ ((__pyx_v_cell->genome.tfs[__pyx_v_i])->time_concentration_vector.data + __pyx_t_7 * (__pyx_v_cell->genome.tfs[__pyx_v_i])->time_concentration_vector.strides[0]) )) = (__pyx_v_vars[(__pyx_v_cell->genome.tfs[__pyx_v_i])->variable]);
}
+0569: cell.production_s.time_production_vector[index] = vars[cell.production_s.variable]
if (unlikely(!__pyx_v_cell->production_s.time_production_vector.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 569, __pyx_L1_error)}
__pyx_t_8 = __pyx_v_index;
*((double *) ( /* dim=0 */ (__pyx_v_cell->production_s.time_production_vector.data + __pyx_t_8 * __pyx_v_cell->production_s.time_production_vector.strides[0]) )) = (__pyx_v_vars[__pyx_v_cell->production_s.variable]);
+0570: cell.toxicity_s.time_toxicity_vector[index] = vars[cell.toxicity_s.variable]
if (unlikely(!__pyx_v_cell->toxicity_s.time_toxicity_vector.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 570, __pyx_L1_error)}
__pyx_t_9 = __pyx_v_index;
*((double *) ( /* dim=0 */ (__pyx_v_cell->toxicity_s.time_toxicity_vector.data + __pyx_t_9 * __pyx_v_cell->toxicity_s.time_toxicity_vector.strides[0]) )) = (__pyx_v_vars[__pyx_v_cell->toxicity_s.variable]);
+0571: cell.cell_size_s.time_cell_size_vector[index] = vars[cell.cell_size_s.var]
if (unlikely(!__pyx_v_cell->cell_size_s.time_cell_size_vector.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 571, __pyx_L1_error)}
__pyx_t_10 = __pyx_v_index;
*((double *) ( /* dim=0 */ (__pyx_v_cell->cell_size_s.time_cell_size_vector.data + __pyx_t_10 * __pyx_v_cell->cell_size_s.time_cell_size_vector.strides[0]) )) = (__pyx_v_vars[__pyx_v_cell->cell_size_s.var]);
+0572: cell.production_s.time_pos_prod_vector[index] = cell.production_s.pos_production
__pyx_t_11 = __pyx_v_cell->production_s.pos_production;
if (unlikely(!__pyx_v_cell->production_s.time_pos_prod_vector.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 572, __pyx_L1_error)}
__pyx_t_12 = __pyx_v_index;
*((double *) ( /* dim=0 */ (__pyx_v_cell->production_s.time_pos_prod_vector.data + __pyx_t_12 * __pyx_v_cell->production_s.time_pos_prod_vector.strides[0]) )) = __pyx_t_11;
+0573: cell.nr_time_points_stored += 1
__pyx_v_cell->nr_time_points_stored = (__pyx_v_cell->nr_time_points_stored + 1);
0574:
+0575: cdef void store_pop_state(double vars[], population_str * pop, int num_threads, double time) nogil:
static void __pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_store_pop_state(double *__pyx_v_vars, struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_population_str *__pyx_v_pop, CYTHON_UNUSED int __pyx_v_num_threads, double __pyx_v_time) { int __pyx_v_i; /* … */ /* function exit code */ }
0576: '''
0577: Stores the computed values of all variables in the corresponding c_structs,
0578: so that they become known to the C-extension classes.
0579: '''
0580: cdef int i
+0581: for i in range(pop.nr_cells): #parallel.prange(pop.nr_cells, schedule='static', num_threads=num_threads ):
__pyx_t_1 = __pyx_v_pop->nr_cells; for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2;
+0582: store_cell_state(vars, pop.cells[i], time)
__pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_store_cell_state(__pyx_v_vars, (__pyx_v_pop->cells[__pyx_v_i]), __pyx_v_time); }
0583:
+0584: cdef void store_env_state(double vars[], env_str * env, int num_threads, double time) nogil:
static void __pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_store_env_state(double *__pyx_v_vars, struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_env_str *__pyx_v_env, CYTHON_UNUSED int __pyx_v_num_threads, double __pyx_v_time) {
int __pyx_v_index;
int __pyx_v_i;
/* … */
/* function exit code */
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_WriteUnraisable("VirtualMicrobes.cython_gsl_interface.odes.store_env_state", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 1);
__pyx_L0:;
}
+0585: cdef int index = env.nr_time_points_stored
__pyx_t_1 = __pyx_v_env->nr_time_points_stored; __pyx_v_index = __pyx_t_1;
0586: cdef int i
+0587: env.time_points[index] = time
if (unlikely(!__pyx_v_env->time_points.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 587, __pyx_L1_error)}
__pyx_t_2 = __pyx_v_index;
*((double *) ( /* dim=0 */ (__pyx_v_env->time_points.data + __pyx_t_2 * __pyx_v_env->time_points.strides[0]) )) = __pyx_v_time;
+0588: for i in range(env.nr_small_mols): #parallel.prange(env.nr_small_mols, schedule='static', num_threads=num_threads):
__pyx_t_1 = __pyx_v_env->nr_small_mols; for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_1; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3;
+0589: env.small_mols[i].time_concentration_vector[index] = vars[env.small_mols[i].variable]
if (unlikely(!(__pyx_v_env->small_mols[__pyx_v_i])->time_concentration_vector.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(0, 589, __pyx_L1_error)}
__pyx_t_4 = __pyx_v_index;
*((double *) ( /* dim=0 */ ((__pyx_v_env->small_mols[__pyx_v_i])->time_concentration_vector.data + __pyx_t_4 * (__pyx_v_env->small_mols[__pyx_v_i])->time_concentration_vector.strides[0]) )) = (__pyx_v_vars[(__pyx_v_env->small_mols[__pyx_v_i])->variable]);
}
+0590: env.nr_time_points_stored += 1
__pyx_v_env->nr_time_points_stored = (__pyx_v_env->nr_time_points_stored + 1);
0591:
+0592: cdef void store_state_nogil(system_str * sys_s, double time) nogil:
static void __pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_store_state_nogil(struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_system_str *__pyx_v_sys_s, double __pyx_v_time) { /* … */ /* function exit code */ }
0593: '''
0594: Store the computed values of system variables in the corresponding c_structs.
0595: '''
+0596: store_pop_state(sys_s.vars, sys_s.population, sys_s.num_threads, time)
__pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_store_pop_state(__pyx_v_sys_s->vars, __pyx_v_sys_s->population, __pyx_v_sys_s->num_threads, __pyx_v_time);
+0597: store_env_state(sys_s.vars, sys_s.environment, sys_s.num_threads, time)
__pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_store_env_state(__pyx_v_sys_s->vars, __pyx_v_sys_s->environment, __pyx_v_sys_s->num_threads, __pyx_v_time);
0598:
+0599: cdef void print_vars(system_str * sys_s) nogil:
static void __pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_print_vars(struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_system_str *__pyx_v_sys_s) { int __pyx_v_i; /* … */ /* function exit code */ }
0600: cdef int i
+0601: printf('vars: ')
printf(((char const *)"vars: "));
+0602: for i in range(sys_s.dimension):
__pyx_t_1 = __pyx_v_sys_s->dimension; for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2;
+0603: printf("var %d: %f ",i, sys_s.vars[i])
printf(((char const *)"var %d: %f "), __pyx_v_i, (__pyx_v_sys_s->vars[__pyx_v_i])); }
+0604: printf('\n')
printf(((char const *)"\n"));
0605:
+0606: cdef class ENZYME:
struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_ENZYME { int (*get_var)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_ENZYME *); PyObject *(*set_reg_seq)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_ENZYME *, PyObject *, PyObject *, PyObject *, PyObject *); PyObject *(*set_degradation)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_ENZYME *, PyObject *); PyObject *(*add_params)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_ENZYME *, PyObject *, PyObject *, int, PyObject *, PyObject *); PyObject *(*set_time_course_view)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_ENZYME *, PyObject *); }; static struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_ENZYME *__pyx_vtabptr_15VirtualMicrobes_20cython_gsl_interface_4odes_ENZYME;
+0607: def __cinit__(self, enzyme, cell, var_map):
/* Python wrapper */ static int __pyx_pw_15VirtualMicrobes_20cython_gsl_interface_4odes_6ENZYME_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_15VirtualMicrobes_20cython_gsl_interface_4odes_6ENZYME_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_enzyme = 0; PyObject *__pyx_v_cell = 0; PyObject *__pyx_v_var_map = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_enzyme,&__pyx_n_s_cell,&__pyx_n_s_var_map,0}; PyObject* values[3] = {0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_enzyme)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_cell)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, 1); __PYX_ERR(0, 607, __pyx_L3_error) } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_var_map)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, 2); __PYX_ERR(0, 607, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 607, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); } __pyx_v_enzyme = values[0]; __pyx_v_cell = values[1]; __pyx_v_var_map = values[2]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 607, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("VirtualMicrobes.cython_gsl_interface.odes.ENZYME.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_15VirtualMicrobes_20cython_gsl_interface_4odes_6ENZYME___cinit__(((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_ENZYME *)__pyx_v_self), __pyx_v_enzyme, __pyx_v_cell, __pyx_v_var_map); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_15VirtualMicrobes_20cython_gsl_interface_4odes_6ENZYME___cinit__(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_ENZYME *__pyx_v_self, PyObject *__pyx_v_enzyme, PyObject *__pyx_v_cell, PyObject *__pyx_v_var_map) { PyObject *__pyx_v_params_list = 0; PyObject *__pyx_v_params = 0; PyObject *__pyx_v_subs_kss = NULL; int __pyx_v_i; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__", 0); /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("VirtualMicrobes.cython_gsl_interface.odes.ENZYME.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_XDECREF(__pyx_v_params_list); __Pyx_XDECREF(__pyx_v_params); __Pyx_XDECREF(__pyx_v_subs_kss); __Pyx_RefNannyFinishContext(); return __pyx_r; }
0608: cdef object params_list, subskss, params
+0609: params_list, subs_kss = enzyme.ode_params()
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_enzyme, __pyx_n_s_ode_params); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 609, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } if (__pyx_t_3) { __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 609, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else { __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 609, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { PyObject* sequence = __pyx_t_1; #if CYTHON_COMPILING_IN_CPYTHON Py_ssize_t size = Py_SIZE(sequence); #else Py_ssize_t size = PySequence_Size(sequence); #endif if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); __PYX_ERR(0, 609, __pyx_L1_error) } #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); } else { __pyx_t_2 = PyList_GET_ITEM(sequence, 0); __pyx_t_3 = PyList_GET_ITEM(sequence, 1); } __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); #else __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 609, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 609, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } else { Py_ssize_t index = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 609, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext; index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed; __Pyx_GOTREF(__pyx_t_2); index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed; __Pyx_GOTREF(__pyx_t_3); if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) __PYX_ERR(0, 609, __pyx_L1_error) __pyx_t_5 = NULL; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L4_unpacking_done; __pyx_L3_unpacking_failed:; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_5 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); __PYX_ERR(0, 609, __pyx_L1_error) __pyx_L4_unpacking_done:; } __pyx_v_params_list = __pyx_t_2; __pyx_t_2 = 0; __pyx_v_subs_kss = __pyx_t_3; __pyx_t_3 = 0;
+0610: self.py_enzyme = enzyme
__Pyx_INCREF(__pyx_v_enzyme); __Pyx_GIVEREF(__pyx_v_enzyme); __Pyx_GOTREF(__pyx_v_self->py_enzyme); __Pyx_DECREF(__pyx_v_self->py_enzyme); __pyx_v_self->py_enzyme = __pyx_v_enzyme;
+0611: self.enzyme_s.v_max = enzyme['v_max']
__pyx_t_1 = PyObject_GetItem(__pyx_v_enzyme, __pyx_n_s_v_max); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 611, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 611, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->enzyme_s.v_max = __pyx_t_6;
+0612: self.enzyme_s.gene_multiplicity = cell.molecules["gene_products"][enzyme].multiplicity
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_cell, __pyx_n_s_molecules); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 612, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = PyObject_GetItem(__pyx_t_1, __pyx_n_s_gene_products); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 612, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyObject_GetItem(__pyx_t_3, __pyx_v_enzyme); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 612, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_multiplicity); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 612, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 612, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_self->enzyme_s.gene_multiplicity = __pyx_t_6;
+0613: self.set_degradation(cell)
__pyx_t_3 = ((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_ENZYME *)__pyx_v_self->__pyx_vtab)->set_degradation(__pyx_v_self, __pyx_v_cell); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 613, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+0614: self.enzyme_s.nr_equations = len(params_list)
__pyx_t_7 = PyObject_Length(__pyx_v_params_list); if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(0, 614, __pyx_L1_error)
__pyx_v_self->enzyme_s.nr_equations = __pyx_t_7;
+0615: self.enzyme_s.variable = var_map["gene_products"][cell][enzyme]
__pyx_t_3 = PyObject_GetItem(__pyx_v_var_map, __pyx_n_s_gene_products); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 615, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = PyObject_GetItem(__pyx_t_3, __pyx_v_cell); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 615, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_GetItem(__pyx_t_1, __pyx_v_enzyme); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 615, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 615, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_self->enzyme_s.variable = __pyx_t_8;
+0616: self.enzyme_s.params = <enzyme_params_str *>PyMem_Malloc(self.enzyme_s.nr_equations
__pyx_v_self->enzyme_s.params = ((struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_enzyme_params_str *)PyMem_Malloc((__pyx_v_self->enzyme_s.nr_equations * (sizeof(struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_enzyme_params_str)))));
0617: * sizeof(enzyme_params_str))
0618: cdef int i
+0619: for i, params in enumerate(params_list):
__pyx_t_8 = 0; if (likely(PyList_CheckExact(__pyx_v_params_list)) || PyTuple_CheckExact(__pyx_v_params_list)) { __pyx_t_3 = __pyx_v_params_list; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0; __pyx_t_9 = NULL; } else { __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_params_list); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 619, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_9 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 619, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_9)) { if (likely(PyList_CheckExact(__pyx_t_3))) { if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 619, __pyx_L1_error) #else __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 619, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } else { if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 619, __pyx_L1_error) #else __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 619, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } } else { __pyx_t_1 = __pyx_t_9(__pyx_t_3); if (unlikely(!__pyx_t_1)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 619, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_1); } __Pyx_XDECREF_SET(__pyx_v_params, __pyx_t_1); __pyx_t_1 = 0; __pyx_v_i = __pyx_t_8; __pyx_t_8 = (__pyx_t_8 + 1); /* … */ } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+0620: self.add_params(params,subs_kss, i, cell, var_map)
__pyx_t_1 = ((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_ENZYME *)__pyx_v_self->__pyx_vtab)->add_params(__pyx_v_self, __pyx_v_params, __pyx_v_subs_kss, __pyx_v_i, __pyx_v_cell, __pyx_v_var_map); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 620, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
0621:
+0622: cdef set_time_course_view(self, py_cell):
static PyObject *__pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_6ENZYME_set_time_course_view(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_ENZYME *__pyx_v_self, PyObject *__pyx_v_py_cell) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_time_course_view", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __PYX_XDEC_MEMVIEW(&__pyx_t_3, 1); __Pyx_AddTraceback("VirtualMicrobes.cython_gsl_interface.odes.ENZYME.set_time_course_view", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0623: self.enzyme_s.time_concentration_vector = py_cell.molecules["gene_products"][self.py_enzyme].time_course
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_py_cell, __pyx_n_s_molecules); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 623, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_n_s_gene_products); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 623, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyObject_GetItem(__pyx_t_2, __pyx_v_self->py_enzyme); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 623, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_time_course); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 623, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_2); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 623, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_XDEC_MEMVIEW(&__pyx_v_self->enzyme_s.time_concentration_vector, 0); __pyx_v_self->enzyme_s.time_concentration_vector = __pyx_t_3; __pyx_t_3.memview = NULL; __pyx_t_3.data = NULL;
0624:
+0625: cdef set_reg_seq(self, prom, op, genome, tfs_c_dict):
static PyObject *__pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_6ENZYME_set_reg_seq(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_ENZYME *__pyx_v_self, PyObject *__pyx_v_prom, PyObject *__pyx_v_op, PyObject *__pyx_v_genome, PyObject *__pyx_v_tfs_c_dict) { PyObject *__pyx_v_binding_tfs_scores = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_reg_seq", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("VirtualMicrobes.cython_gsl_interface.odes.ENZYME.set_reg_seq", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_binding_tfs_scores); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
0626: cdef object binding_tfs_scores
+0627: binding_tfs_scores = genome.binding_tfs_scores(op)
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_genome, __pyx_n_s_binding_tfs_scores); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 627, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } if (!__pyx_t_3) { __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_op); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 627, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } else { __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 627, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL; __Pyx_INCREF(__pyx_v_op); __Pyx_GIVEREF(__pyx_v_op); PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_op); __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 627, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_binding_tfs_scores = __pyx_t_1; __pyx_t_1 = 0;
+0628: self.reg_seq_c = REG_SEQ.__new__(REG_SEQ, prom, op, binding_tfs_scores, tfs_c_dict)
__pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 628, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_prom); __Pyx_GIVEREF(__pyx_v_prom); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_prom); __Pyx_INCREF(__pyx_v_op); __Pyx_GIVEREF(__pyx_v_op); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_op); __Pyx_INCREF(__pyx_v_binding_tfs_scores); __Pyx_GIVEREF(__pyx_v_binding_tfs_scores); PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_binding_tfs_scores); __Pyx_INCREF(__pyx_v_tfs_c_dict); __Pyx_GIVEREF(__pyx_v_tfs_c_dict); PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_tfs_c_dict); __pyx_t_2 = __pyx_tp_new_15VirtualMicrobes_20cython_gsl_interface_4odes_REG_SEQ(((PyTypeObject *)__pyx_ptype_15VirtualMicrobes_20cython_gsl_interface_4odes_REG_SEQ), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 628, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (!(likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_15VirtualMicrobes_20cython_gsl_interface_4odes_REG_SEQ)))) __PYX_ERR(0, 628, __pyx_L1_error) __Pyx_GIVEREF(__pyx_t_2); __Pyx_GOTREF(__pyx_v_self->reg_seq_c); __Pyx_DECREF(((PyObject *)__pyx_v_self->reg_seq_c)); __pyx_v_self->reg_seq_c = ((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_REG_SEQ *)__pyx_t_2); __pyx_t_2 = 0;
+0629: self.enzyme_s.reg_seq = &(self.reg_seq_c.reg_seq_s)
__pyx_v_self->enzyme_s.reg_seq = (&__pyx_v_self->reg_seq_c->reg_seq_s);
0630:
+0631: cdef set_degradation(self, cell):
static PyObject *__pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_6ENZYME_set_degradation(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_ENZYME *__pyx_v_self, PyObject *__pyx_v_cell) { double __pyx_v_constant; CYTHON_UNUSED PyObject *__pyx_v_reaction = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_degradation", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("VirtualMicrobes.cython_gsl_interface.odes.ENZYME.set_degradation", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_reaction); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
0632: cdef double constant
0633: cdef object reaction
+0634: reaction, constant = cell.molecules["gene_products"][self.py_enzyme].degradation
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_cell, __pyx_n_s_molecules); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 634, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_n_s_gene_products); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 634, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyObject_GetItem(__pyx_t_2, __pyx_v_self->py_enzyme); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 634, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_degradation); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 634, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) { PyObject* sequence = __pyx_t_2; #if CYTHON_COMPILING_IN_CPYTHON Py_ssize_t size = Py_SIZE(sequence); #else Py_ssize_t size = PySequence_Size(sequence); #endif if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); __PYX_ERR(0, 634, __pyx_L1_error) } #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); } else { __pyx_t_1 = PyList_GET_ITEM(sequence, 0); __pyx_t_3 = PyList_GET_ITEM(sequence, 1); } __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(__pyx_t_3); #else __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 634, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 634, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else { Py_ssize_t index = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 634, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext; index = 0; __pyx_t_1 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed; __Pyx_GOTREF(__pyx_t_1); index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed; __Pyx_GOTREF(__pyx_t_3); if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) __PYX_ERR(0, 634, __pyx_L1_error) __pyx_t_5 = NULL; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L4_unpacking_done; __pyx_L3_unpacking_failed:; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_5 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); __PYX_ERR(0, 634, __pyx_L1_error) __pyx_L4_unpacking_done:; } __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 634, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_reaction = __pyx_t_1; __pyx_t_1 = 0; __pyx_v_constant = __pyx_t_6;
+0635: self.enzyme_s.degr_const = constant
__pyx_v_self->enzyme_s.degr_const = __pyx_v_constant;
0636:
+0637: cdef add_params(self, params, subs_kss, int eq_nr, cell, var_map):
static PyObject *__pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_6ENZYME_add_params(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_ENZYME *__pyx_v_self, PyObject *__pyx_v_params, PyObject *__pyx_v_subs_kss, int __pyx_v_eq_nr, PyObject *__pyx_v_cell, PyObject *__pyx_v_var_map) { int __pyx_v_nr_reactants; int __pyx_v_nr_products; struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_enzyme_params_str __pyx_v_enz_pars; PyObject *__pyx_v_mol = 0; PyObject *__pyx_v_re = 0; PyObject *__pyx_v_p = 0; int __pyx_v_i; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("add_params", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("VirtualMicrobes.cython_gsl_interface.odes.ENZYME.add_params", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_mol); __Pyx_XDECREF(__pyx_v_re); __Pyx_XDECREF(__pyx_v_p); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0638: cdef int nr_reactants = len(params["reactants"])
__pyx_t_1 = PyObject_GetItem(__pyx_v_params, __pyx_n_s_reactants); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 638, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(0, 638, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_nr_reactants = __pyx_t_2;
+0639: cdef int nr_products = len(params["products"])
__pyx_t_1 = PyObject_GetItem(__pyx_v_params, __pyx_n_s_products); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 639, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(0, 639, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_nr_products = __pyx_t_2;
0640: cdef enzyme_params_str enz_pars
0641: cdef object mol, re, p
+0642: enz_pars.reactants = <reactant_str *> PyMem_Malloc(nr_reactants
__pyx_v_enz_pars.reactants = ((struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_reactant_str *)PyMem_Malloc((__pyx_v_nr_reactants * (sizeof(struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_reactant_str)))));
0643: * sizeof(reactant_str))
+0644: enz_pars.products = <product_str *> PyMem_Malloc(nr_products
__pyx_v_enz_pars.products = ((struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_product_str *)PyMem_Malloc((__pyx_v_nr_products * (sizeof(struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_product_str)))));
0645: * sizeof(product_str))
+0646: enz_pars.nr_reactants = len(params["reactants"])
__pyx_t_1 = PyObject_GetItem(__pyx_v_params, __pyx_n_s_reactants); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 646, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(0, 646, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_enz_pars.nr_reactants = __pyx_t_2;
+0647: enz_pars.nr_products = len(params["products"])
__pyx_t_1 = PyObject_GetItem(__pyx_v_params, __pyx_n_s_products); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 647, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(0, 647, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_enz_pars.nr_products = __pyx_t_2;
0648: cdef int i
+0649: for i, re in enumerate(params["reactants"]):
__pyx_t_3 = 0; __pyx_t_1 = PyObject_GetItem(__pyx_v_params, __pyx_n_s_reactants); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 649, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { __pyx_t_4 = __pyx_t_1; __Pyx_INCREF(__pyx_t_4); __pyx_t_2 = 0; __pyx_t_5 = NULL; } else { __pyx_t_2 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 649, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 649, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; for (;;) { if (likely(!__pyx_t_5)) { if (likely(PyList_CheckExact(__pyx_t_4))) { if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_4)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 649, __pyx_L1_error) #else __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 649, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } else { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_4)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 649, __pyx_L1_error) #else __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 649, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } } else { __pyx_t_1 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_1)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 649, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_1); } __Pyx_XDECREF_SET(__pyx_v_re, __pyx_t_1); __pyx_t_1 = 0; __pyx_v_i = __pyx_t_3; __pyx_t_3 = (__pyx_t_3 + 1); /* … */ } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+0650: mol = re["mol"]
__pyx_t_1 = PyObject_GetItem(__pyx_v_re, __pyx_n_s_mol); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 650, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_XDECREF_SET(__pyx_v_mol, __pyx_t_1); __pyx_t_1 = 0;
+0651: enz_pars.reactants[i].var = var_map["small_molecules"][cell][mol]
__pyx_t_1 = PyObject_GetItem(__pyx_v_var_map, __pyx_n_s_small_molecules); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 651, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_6 = PyObject_GetItem(__pyx_t_1, __pyx_v_cell); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 651, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyObject_GetItem(__pyx_t_6, __pyx_v_mol); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 651, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 651, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; (__pyx_v_enz_pars.reactants[__pyx_v_i]).var = __pyx_t_7;
+0652: if re["stoi"] < 1:
__pyx_t_1 = PyObject_GetItem(__pyx_v_re, __pyx_n_s_stoi); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 652, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_6 = PyObject_RichCompare(__pyx_t_1, __pyx_int_1, Py_LT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 652, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 652, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (__pyx_t_8) { /* … */ }
+0653: raise Exception("stoi should be > 1", cell, params, re)
__pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 653, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_INCREF(__pyx_kp_s_stoi_should_be_1); __Pyx_GIVEREF(__pyx_kp_s_stoi_should_be_1); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_kp_s_stoi_should_be_1); __Pyx_INCREF(__pyx_v_cell); __Pyx_GIVEREF(__pyx_v_cell); PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_cell); __Pyx_INCREF(__pyx_v_params); __Pyx_GIVEREF(__pyx_v_params); PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_params); __Pyx_INCREF(__pyx_v_re); __Pyx_GIVEREF(__pyx_v_re); PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_v_re); __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 653, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 653, __pyx_L1_error)
+0654: enz_pars.reactants[i].stoi = re["stoi"]
__pyx_t_1 = PyObject_GetItem(__pyx_v_re, __pyx_n_s_stoi); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 654, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 654, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; (__pyx_v_enz_pars.reactants[__pyx_v_i]).stoi = __pyx_t_7;
+0655: enz_pars.reactants[i].k_bind = subs_kss[mol]
__pyx_t_1 = PyObject_GetItem(__pyx_v_subs_kss, __pyx_v_mol); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 655, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 655, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; (__pyx_v_enz_pars.reactants[__pyx_v_i]).k_bind = __pyx_t_9;
+0656: for i, p in enumerate(params["products"]):
__pyx_t_3 = 0; __pyx_t_4 = PyObject_GetItem(__pyx_v_params, __pyx_n_s_products); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 656, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) { __pyx_t_1 = __pyx_t_4; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; __pyx_t_5 = NULL; } else { __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 656, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 656, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; for (;;) { if (likely(!__pyx_t_5)) { if (likely(PyList_CheckExact(__pyx_t_1))) { if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 656, __pyx_L1_error) #else __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 656, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #endif } else { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 656, __pyx_L1_error) #else __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 656, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #endif } } else { __pyx_t_4 = __pyx_t_5(__pyx_t_1); if (unlikely(!__pyx_t_4)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 656, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_4); } __Pyx_XDECREF_SET(__pyx_v_p, __pyx_t_4); __pyx_t_4 = 0; __pyx_v_i = __pyx_t_3; __pyx_t_3 = (__pyx_t_3 + 1); /* … */ } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+0657: mol = p["mol"]
__pyx_t_4 = PyObject_GetItem(__pyx_v_p, __pyx_n_s_mol); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 657, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_XDECREF_SET(__pyx_v_mol, __pyx_t_4); __pyx_t_4 = 0;
+0658: if p["stoi"] < 1:
__pyx_t_4 = PyObject_GetItem(__pyx_v_p, __pyx_n_s_stoi); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 658, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_6 = PyObject_RichCompare(__pyx_t_4, __pyx_int_1, Py_LT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 658, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 658, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (__pyx_t_8) { /* … */ }
+0659: raise Exception("stoi should be > 1", cell, params, p)
__pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 659, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_INCREF(__pyx_kp_s_stoi_should_be_1); __Pyx_GIVEREF(__pyx_kp_s_stoi_should_be_1); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_kp_s_stoi_should_be_1); __Pyx_INCREF(__pyx_v_cell); __Pyx_GIVEREF(__pyx_v_cell); PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_cell); __Pyx_INCREF(__pyx_v_params); __Pyx_GIVEREF(__pyx_v_params); PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_params); __Pyx_INCREF(__pyx_v_p); __Pyx_GIVEREF(__pyx_v_p); PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_v_p); __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 659, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __PYX_ERR(0, 659, __pyx_L1_error)
+0660: enz_pars.products[i].var = var_map["small_molecules"][cell][mol]
__pyx_t_4 = PyObject_GetItem(__pyx_v_var_map, __pyx_n_s_small_molecules); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 660, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_6 = PyObject_GetItem(__pyx_t_4, __pyx_v_cell); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 660, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyObject_GetItem(__pyx_t_6, __pyx_v_mol); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 660, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 660, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; (__pyx_v_enz_pars.products[__pyx_v_i]).var = __pyx_t_7;
+0661: enz_pars.products[i].stoi = p["stoi"]
__pyx_t_4 = PyObject_GetItem(__pyx_v_p, __pyx_n_s_stoi); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 661, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 661, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; (__pyx_v_enz_pars.products[__pyx_v_i]).stoi = __pyx_t_7;
+0662: self.enzyme_s.params[eq_nr] = enz_pars
(__pyx_v_self->enzyme_s.params[__pyx_v_eq_nr]) = __pyx_v_enz_pars;
0663:
+0664: cdef int get_var(self):
static int __pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_6ENZYME_get_var(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_ENZYME *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_var", 0); /* … */ /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0665: return self.enzyme_s.variable
__pyx_r = __pyx_v_self->enzyme_s.variable; goto __pyx_L0;
0666:
0667:
+0668: def __dealloc__(self):
/* Python wrapper */ static void __pyx_pw_15VirtualMicrobes_20cython_gsl_interface_4odes_6ENZYME_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ static void __pyx_pw_15VirtualMicrobes_20cython_gsl_interface_4odes_6ENZYME_3__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); __pyx_pf_15VirtualMicrobes_20cython_gsl_interface_4odes_6ENZYME_2__dealloc__(((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_ENZYME *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); } static void __pyx_pf_15VirtualMicrobes_20cython_gsl_interface_4odes_6ENZYME_2__dealloc__(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_ENZYME *__pyx_v_self) { int __pyx_v_i; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); /* … */ /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __PYX_XDEC_MEMVIEW(&__pyx_t_3, 1); __Pyx_WriteUnraisable("VirtualMicrobes.cython_gsl_interface.odes.ENZYME.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0); __pyx_L0:; __Pyx_RefNannyFinishContext(); }
+0669: for i in range(self.enzyme_s.nr_equations):
__pyx_t_1 = __pyx_v_self->enzyme_s.nr_equations; for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2;
+0670: PyMem_Free(self.enzyme_s.params[i].reactants)
PyMem_Free((__pyx_v_self->enzyme_s.params[__pyx_v_i]).reactants);
+0671: PyMem_Free(self.enzyme_s.params[i].products)
PyMem_Free((__pyx_v_self->enzyme_s.params[__pyx_v_i]).products);
}
+0672: PyMem_Free(self.enzyme_s.params)
PyMem_Free(__pyx_v_self->enzyme_s.params);
+0673: self.enzyme_s.time_concentration_vector = None
__pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(Py_None);
if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 673, __pyx_L1_error)
__PYX_XDEC_MEMVIEW(&__pyx_v_self->enzyme_s.time_concentration_vector, 0);
__pyx_v_self->enzyme_s.time_concentration_vector = __pyx_t_3;
__pyx_t_3.memview = NULL;
__pyx_t_3.data = NULL;
+0674: self.enzyme_s.time_change_rate_vector = None
__pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(Py_None);
if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 674, __pyx_L1_error)
__PYX_XDEC_MEMVIEW(&__pyx_v_self->enzyme_s.time_change_rate_vector, 0);
__pyx_v_self->enzyme_s.time_change_rate_vector = __pyx_t_3;
__pyx_t_3.memview = NULL;
__pyx_t_3.data = NULL;
0675:
+0676: cdef class PUMP:
struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_PUMP { int (*get_var)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_PUMP *); PyObject *(*set_reg_seq)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_PUMP *, PyObject *, PyObject *, PyObject *, PyObject *); PyObject *(*set_degradation)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_PUMP *, PyObject *); PyObject *(*add_params)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_PUMP *, PyObject *, PyObject *, PyObject *, int, PyObject *, PyObject *, PyObject *); PyObject *(*set_time_course_view)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_PUMP *, PyObject *); }; static struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_PUMP *__pyx_vtabptr_15VirtualMicrobes_20cython_gsl_interface_4odes_PUMP;
0677:
+0678: def __cinit__(self, pump, cell, env, var_map):
/* Python wrapper */ static int __pyx_pw_15VirtualMicrobes_20cython_gsl_interface_4odes_4PUMP_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_15VirtualMicrobes_20cython_gsl_interface_4odes_4PUMP_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_pump = 0; PyObject *__pyx_v_cell = 0; PyObject *__pyx_v_env = 0; PyObject *__pyx_v_var_map = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pump,&__pyx_n_s_cell,&__pyx_n_s_env,&__pyx_n_s_var_map,0}; PyObject* values[4] = {0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pump)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_cell)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, 1); __PYX_ERR(0, 678, __pyx_L3_error) } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_env)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, 2); __PYX_ERR(0, 678, __pyx_L3_error) } case 3: if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_var_map)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, 3); __PYX_ERR(0, 678, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 678, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); values[3] = PyTuple_GET_ITEM(__pyx_args, 3); } __pyx_v_pump = values[0]; __pyx_v_cell = values[1]; __pyx_v_env = values[2]; __pyx_v_var_map = values[3]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 678, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("VirtualMicrobes.cython_gsl_interface.odes.PUMP.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_15VirtualMicrobes_20cython_gsl_interface_4odes_4PUMP___cinit__(((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_PUMP *)__pyx_v_self), __pyx_v_pump, __pyx_v_cell, __pyx_v_env, __pyx_v_var_map); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_15VirtualMicrobes_20cython_gsl_interface_4odes_4PUMP___cinit__(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_PUMP *__pyx_v_self, PyObject *__pyx_v_pump, PyObject *__pyx_v_cell, PyObject *__pyx_v_env, PyObject *__pyx_v_var_map) { PyObject *__pyx_v_params_list = 0; PyObject *__pyx_v_subs_kss = 0; PyObject *__pyx_v_ene_kss = 0; PyObject *__pyx_v_params = 0; int __pyx_v_i; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__", 0); /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("VirtualMicrobes.cython_gsl_interface.odes.PUMP.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_XDECREF(__pyx_v_params_list); __Pyx_XDECREF(__pyx_v_subs_kss); __Pyx_XDECREF(__pyx_v_ene_kss); __Pyx_XDECREF(__pyx_v_params); __Pyx_RefNannyFinishContext(); return __pyx_r; }
0679: cdef object params_list, subs_kss, ene_kss, params
+0680: params_list, subs_kss, ene_kss = pump.ode_params()
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_pump, __pyx_n_s_ode_params); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 680, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } if (__pyx_t_3) { __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 680, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else { __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 680, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { PyObject* sequence = __pyx_t_1; #if CYTHON_COMPILING_IN_CPYTHON Py_ssize_t size = Py_SIZE(sequence); #else Py_ssize_t size = PySequence_Size(sequence); #endif if (unlikely(size != 3)) { if (size > 3) __Pyx_RaiseTooManyValuesError(3); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); __PYX_ERR(0, 680, __pyx_L1_error) } #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2); } else { __pyx_t_2 = PyList_GET_ITEM(sequence, 0); __pyx_t_3 = PyList_GET_ITEM(sequence, 1); __pyx_t_4 = PyList_GET_ITEM(sequence, 2); } __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); #else __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 680, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 680, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 680, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } else { Py_ssize_t index = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 680, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext; index = 0; __pyx_t_2 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed; __Pyx_GOTREF(__pyx_t_2); index = 1; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed; __Pyx_GOTREF(__pyx_t_3); index = 2; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L3_unpacking_failed; __Pyx_GOTREF(__pyx_t_4); if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 3) < 0) __PYX_ERR(0, 680, __pyx_L1_error) __pyx_t_6 = NULL; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; goto __pyx_L4_unpacking_done; __pyx_L3_unpacking_failed:; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); __PYX_ERR(0, 680, __pyx_L1_error) __pyx_L4_unpacking_done:; } __pyx_v_params_list = __pyx_t_2; __pyx_t_2 = 0; __pyx_v_subs_kss = __pyx_t_3; __pyx_t_3 = 0; __pyx_v_ene_kss = __pyx_t_4; __pyx_t_4 = 0;
+0681: self.py_pump = pump
__Pyx_INCREF(__pyx_v_pump); __Pyx_GIVEREF(__pyx_v_pump); __Pyx_GOTREF(__pyx_v_self->py_pump); __Pyx_DECREF(__pyx_v_self->py_pump); __pyx_v_self->py_pump = __pyx_v_pump;
+0682: self.pump_s.v_max = pump['v_max']
__pyx_t_1 = PyObject_GetItem(__pyx_v_pump, __pyx_n_s_v_max); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 682, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 682, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->pump_s.v_max = __pyx_t_7;
+0683: self.pump_s.gene_multiplicity = cell.molecules["gene_products"][pump].multiplicity
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_cell, __pyx_n_s_molecules); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 683, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = PyObject_GetItem(__pyx_t_1, __pyx_n_s_gene_products); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 683, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyObject_GetItem(__pyx_t_4, __pyx_v_pump); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 683, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_multiplicity); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 683, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 683, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_v_self->pump_s.gene_multiplicity = __pyx_t_7;
+0684: self.pump_s.direction = -1 if pump.params['exporting'] else 1.
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_pump, __pyx_n_s_params); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 684, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_1 = PyObject_GetItem(__pyx_t_4, __pyx_n_s_exporting); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 684, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 684, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_8) { __pyx_t_7 = -1.0; } else { __pyx_t_7 = 1.; } __pyx_v_self->pump_s.direction = __pyx_t_7;
+0685: self.set_degradation(cell)
__pyx_t_1 = ((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_PUMP *)__pyx_v_self->__pyx_vtab)->set_degradation(__pyx_v_self, __pyx_v_cell); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 685, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+0686: self.pump_s.nr_equations = len(params_list)
__pyx_t_9 = PyObject_Length(__pyx_v_params_list); if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(0, 686, __pyx_L1_error)
__pyx_v_self->pump_s.nr_equations = __pyx_t_9;
+0687: self.pump_s.variable = var_map["gene_products"][cell][pump]
__pyx_t_1 = PyObject_GetItem(__pyx_v_var_map, __pyx_n_s_gene_products); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 687, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = PyObject_GetItem(__pyx_t_1, __pyx_v_cell); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 687, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyObject_GetItem(__pyx_t_4, __pyx_v_pump); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 687, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 687, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->pump_s.variable = __pyx_t_10;
+0688: self.pump_s.params = <pump_params_str *>PyMem_Malloc(self.pump_s.nr_equations
__pyx_v_self->pump_s.params = ((struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_pump_params_str *)PyMem_Malloc((__pyx_v_self->pump_s.nr_equations * (sizeof(struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_pump_params_str)))));
0689: * sizeof(pump_params_str))
0690: cdef int i
+0691: for i, params in enumerate(params_list):
__pyx_t_10 = 0; if (likely(PyList_CheckExact(__pyx_v_params_list)) || PyTuple_CheckExact(__pyx_v_params_list)) { __pyx_t_1 = __pyx_v_params_list; __Pyx_INCREF(__pyx_t_1); __pyx_t_9 = 0; __pyx_t_11 = NULL; } else { __pyx_t_9 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_params_list); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 691, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_11 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 691, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_11)) { if (likely(PyList_CheckExact(__pyx_t_1))) { if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_1)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_9); __Pyx_INCREF(__pyx_t_4); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 691, __pyx_L1_error) #else __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 691, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #endif } else { if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_1)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_9); __Pyx_INCREF(__pyx_t_4); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 691, __pyx_L1_error) #else __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 691, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #endif } } else { __pyx_t_4 = __pyx_t_11(__pyx_t_1); if (unlikely(!__pyx_t_4)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 691, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_4); } __Pyx_XDECREF_SET(__pyx_v_params, __pyx_t_4); __pyx_t_4 = 0; __pyx_v_i = __pyx_t_10; __pyx_t_10 = (__pyx_t_10 + 1); /* … */ } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+0692: self.add_params(params, subs_kss, ene_kss, i, cell, env,var_map)
__pyx_t_4 = ((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_PUMP *)__pyx_v_self->__pyx_vtab)->add_params(__pyx_v_self, __pyx_v_params, __pyx_v_subs_kss, __pyx_v_ene_kss, __pyx_v_i, __pyx_v_cell, __pyx_v_env, __pyx_v_var_map); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 692, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
0693:
+0694: cdef set_time_course_view(self, py_cell):
static PyObject *__pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_4PUMP_set_time_course_view(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_PUMP *__pyx_v_self, PyObject *__pyx_v_py_cell) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_time_course_view", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __PYX_XDEC_MEMVIEW(&__pyx_t_3, 1); __Pyx_AddTraceback("VirtualMicrobes.cython_gsl_interface.odes.PUMP.set_time_course_view", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0695: self.pump_s.time_concentration_vector = py_cell.molecules["gene_products"][self.py_pump].time_course
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_py_cell, __pyx_n_s_molecules); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 695, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_n_s_gene_products); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 695, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyObject_GetItem(__pyx_t_2, __pyx_v_self->py_pump); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 695, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_time_course); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 695, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_2); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 695, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_XDEC_MEMVIEW(&__pyx_v_self->pump_s.time_concentration_vector, 0); __pyx_v_self->pump_s.time_concentration_vector = __pyx_t_3; __pyx_t_3.memview = NULL; __pyx_t_3.data = NULL;
0696:
+0697: cdef set_reg_seq(self, prom, op, genome, tfs_c_dict):
static PyObject *__pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_4PUMP_set_reg_seq(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_PUMP *__pyx_v_self, PyObject *__pyx_v_prom, PyObject *__pyx_v_op, PyObject *__pyx_v_genome, PyObject *__pyx_v_tfs_c_dict) { PyObject *__pyx_v_binding_tfs_scores = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_reg_seq", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("VirtualMicrobes.cython_gsl_interface.odes.PUMP.set_reg_seq", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_binding_tfs_scores); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0698: cdef object binding_tfs_scores = genome.binding_tfs_scores(op)
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_genome, __pyx_n_s_binding_tfs_scores); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 698, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } if (!__pyx_t_3) { __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_op); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 698, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } else { __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 698, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL; __Pyx_INCREF(__pyx_v_op); __Pyx_GIVEREF(__pyx_v_op); PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_op); __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 698, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_binding_tfs_scores = __pyx_t_1; __pyx_t_1 = 0;
+0699: self.reg_seq_c = REG_SEQ.__new__(REG_SEQ, prom, op, binding_tfs_scores, tfs_c_dict)
__pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 699, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_prom); __Pyx_GIVEREF(__pyx_v_prom); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_prom); __Pyx_INCREF(__pyx_v_op); __Pyx_GIVEREF(__pyx_v_op); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_op); __Pyx_INCREF(__pyx_v_binding_tfs_scores); __Pyx_GIVEREF(__pyx_v_binding_tfs_scores); PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_binding_tfs_scores); __Pyx_INCREF(__pyx_v_tfs_c_dict); __Pyx_GIVEREF(__pyx_v_tfs_c_dict); PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_tfs_c_dict); __pyx_t_2 = __pyx_tp_new_15VirtualMicrobes_20cython_gsl_interface_4odes_REG_SEQ(((PyTypeObject *)__pyx_ptype_15VirtualMicrobes_20cython_gsl_interface_4odes_REG_SEQ), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 699, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (!(likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_15VirtualMicrobes_20cython_gsl_interface_4odes_REG_SEQ)))) __PYX_ERR(0, 699, __pyx_L1_error) __Pyx_GIVEREF(__pyx_t_2); __Pyx_GOTREF(__pyx_v_self->reg_seq_c); __Pyx_DECREF(((PyObject *)__pyx_v_self->reg_seq_c)); __pyx_v_self->reg_seq_c = ((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_REG_SEQ *)__pyx_t_2); __pyx_t_2 = 0;
+0700: self.pump_s.reg_seq = &(self.reg_seq_c.reg_seq_s)
__pyx_v_self->pump_s.reg_seq = (&__pyx_v_self->reg_seq_c->reg_seq_s);
0701:
+0702: cdef set_degradation(self, cell):
static PyObject *__pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_4PUMP_set_degradation(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_PUMP *__pyx_v_self, PyObject *__pyx_v_cell) { double __pyx_v_constant; CYTHON_UNUSED PyObject *__pyx_v_reaction = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_degradation", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("VirtualMicrobes.cython_gsl_interface.odes.PUMP.set_degradation", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_reaction); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
0703: cdef double constant
0704: cdef object reaction
+0705: reaction, constant = cell.molecules["gene_products"][self.py_pump].degradation
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_cell, __pyx_n_s_molecules); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 705, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_n_s_gene_products); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 705, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyObject_GetItem(__pyx_t_2, __pyx_v_self->py_pump); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 705, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_degradation); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 705, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) { PyObject* sequence = __pyx_t_2; #if CYTHON_COMPILING_IN_CPYTHON Py_ssize_t size = Py_SIZE(sequence); #else Py_ssize_t size = PySequence_Size(sequence); #endif if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); __PYX_ERR(0, 705, __pyx_L1_error) } #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); } else { __pyx_t_1 = PyList_GET_ITEM(sequence, 0); __pyx_t_3 = PyList_GET_ITEM(sequence, 1); } __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(__pyx_t_3); #else __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 705, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 705, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else { Py_ssize_t index = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 705, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext; index = 0; __pyx_t_1 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed; __Pyx_GOTREF(__pyx_t_1); index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed; __Pyx_GOTREF(__pyx_t_3); if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) __PYX_ERR(0, 705, __pyx_L1_error) __pyx_t_5 = NULL; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L4_unpacking_done; __pyx_L3_unpacking_failed:; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_5 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); __PYX_ERR(0, 705, __pyx_L1_error) __pyx_L4_unpacking_done:; } __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 705, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_reaction = __pyx_t_1; __pyx_t_1 = 0; __pyx_v_constant = __pyx_t_6;
+0706: self.pump_s.degr_const = constant
__pyx_v_self->pump_s.degr_const = __pyx_v_constant;
0707:
+0708: cdef add_params(self, params, subs_kss, ene_kss, int eq_nr, cell, env, var_map ):
static PyObject *__pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_4PUMP_add_params(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_PUMP *__pyx_v_self, PyObject *__pyx_v_params, PyObject *__pyx_v_subs_kss, PyObject *__pyx_v_ene_kss, int __pyx_v_eq_nr, PyObject *__pyx_v_cell, PyObject *__pyx_v_env, PyObject *__pyx_v_var_map) { struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_pump_params_str __pyx_v_pparams; PyObject *__pyx_v_substrate = 0; PyObject *__pyx_v_substrate_internal = 0; PyObject *__pyx_v_energy_molecule = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("add_params", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("VirtualMicrobes.cython_gsl_interface.odes.PUMP.add_params", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_substrate); __Pyx_XDECREF(__pyx_v_substrate_internal); __Pyx_XDECREF(__pyx_v_energy_molecule); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
0709: cdef pump_params_str pparams
0710: cdef object substrate, substrate_internal, energy_molecule
+0711: substrate = params["reactants"]["substrate"]["mol"]
__pyx_t_1 = PyObject_GetItem(__pyx_v_params, __pyx_n_s_reactants); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 711, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_n_s_substrate); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 711, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyObject_GetItem(__pyx_t_2, __pyx_n_s_mol); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 711, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_substrate = __pyx_t_1; __pyx_t_1 = 0;
+0712: substrate_internal = params["products"]["substrate"]["mol"]
__pyx_t_1 = PyObject_GetItem(__pyx_v_params, __pyx_n_s_products); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 712, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_n_s_substrate); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 712, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyObject_GetItem(__pyx_t_2, __pyx_n_s_mol); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 712, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_substrate_internal = __pyx_t_1; __pyx_t_1 = 0;
+0713: energy_molecule = params["reactants"]["energy"]["mol"]
__pyx_t_1 = PyObject_GetItem(__pyx_v_params, __pyx_n_s_reactants); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 713, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_n_s_energy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 713, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyObject_GetItem(__pyx_t_2, __pyx_n_s_mol); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 713, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_energy_molecule = __pyx_t_1; __pyx_t_1 = 0;
+0714: pparams.k_sub = subs_kss[substrate] #params["reactants"]["substrate"]["k_bind"]
__pyx_t_1 = PyObject_GetItem(__pyx_v_subs_kss, __pyx_v_substrate); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 714, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 714, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_pparams.k_sub = __pyx_t_3;
+0715: pparams.k_ene = ene_kss[energy_molecule] #params["reactants"]["energy"]["k_bind"]
__pyx_t_1 = PyObject_GetItem(__pyx_v_ene_kss, __pyx_v_energy_molecule); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 715, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 715, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_pparams.k_ene = __pyx_t_3;
+0716: pparams.ene_cost = params["reactants"]["energy"]["stoi"]
__pyx_t_1 = PyObject_GetItem(__pyx_v_params, __pyx_n_s_reactants); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 716, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_n_s_energy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 716, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyObject_GetItem(__pyx_t_2, __pyx_n_s_stoi); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 716, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 716, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_pparams.ene_cost = __pyx_t_3;
+0717: if pparams.ene_cost < 1 :
__pyx_t_4 = ((__pyx_v_pparams.ene_cost < 1.0) != 0); if (__pyx_t_4) { /* … */ }
+0718: raise Exception("stoi should be 1 or higher", params, cell)
__pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 718, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_kp_s_stoi_should_be_1_or_higher); __Pyx_GIVEREF(__pyx_kp_s_stoi_should_be_1_or_higher); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_s_stoi_should_be_1_or_higher); __Pyx_INCREF(__pyx_v_params); __Pyx_GIVEREF(__pyx_v_params); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_params); __Pyx_INCREF(__pyx_v_cell); __Pyx_GIVEREF(__pyx_v_cell); PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_cell); __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 718, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 718, __pyx_L1_error)
+0719: pparams.substrate_out = var_map["small_molecules"][env][substrate]
__pyx_t_2 = PyObject_GetItem(__pyx_v_var_map, __pyx_n_s_small_molecules); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 719, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = PyObject_GetItem(__pyx_t_2, __pyx_v_env); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 719, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_v_substrate); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 719, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 719, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_pparams.substrate_out = __pyx_t_5;
+0720: pparams.energy_mol = var_map["small_molecules"][cell][energy_molecule]
__pyx_t_2 = PyObject_GetItem(__pyx_v_var_map, __pyx_n_s_small_molecules); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 720, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = PyObject_GetItem(__pyx_t_2, __pyx_v_cell); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 720, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_v_energy_molecule); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 720, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 720, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_pparams.energy_mol = __pyx_t_5;
+0721: pparams.substrate_in = var_map["small_molecules"][cell][substrate_internal]
__pyx_t_2 = PyObject_GetItem(__pyx_v_var_map, __pyx_n_s_small_molecules); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 721, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = PyObject_GetItem(__pyx_t_2, __pyx_v_cell); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 721, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_v_substrate_internal); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 721, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 721, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_pparams.substrate_in = __pyx_t_5;
+0722: self.pump_s.params[eq_nr] = pparams
(__pyx_v_self->pump_s.params[__pyx_v_eq_nr]) = __pyx_v_pparams;
0723:
+0724: cdef int get_var(self):
static int __pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_4PUMP_get_var(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_PUMP *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_var", 0); /* … */ /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0725: return self.pump_s.variable
__pyx_r = __pyx_v_self->pump_s.variable; goto __pyx_L0;
0726:
+0727: def __dealloc__(self):
/* Python wrapper */ static void __pyx_pw_15VirtualMicrobes_20cython_gsl_interface_4odes_4PUMP_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ static void __pyx_pw_15VirtualMicrobes_20cython_gsl_interface_4odes_4PUMP_3__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); __pyx_pf_15VirtualMicrobes_20cython_gsl_interface_4odes_4PUMP_2__dealloc__(((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_PUMP *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); } static void __pyx_pf_15VirtualMicrobes_20cython_gsl_interface_4odes_4PUMP_2__dealloc__(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_PUMP *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); /* … */ /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1); __Pyx_WriteUnraisable("VirtualMicrobes.cython_gsl_interface.odes.PUMP.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0); __pyx_L0:; __Pyx_RefNannyFinishContext(); }
+0728: PyMem_Free(self.pump_s.params)
PyMem_Free(__pyx_v_self->pump_s.params);
+0729: self.pump_s.time_concentration_vector = None
__pyx_t_1 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(Py_None);
if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 729, __pyx_L1_error)
__PYX_XDEC_MEMVIEW(&__pyx_v_self->pump_s.time_concentration_vector, 0);
__pyx_v_self->pump_s.time_concentration_vector = __pyx_t_1;
__pyx_t_1.memview = NULL;
__pyx_t_1.data = NULL;
+0730: self.pump_s.time_change_rate_vector = None
__pyx_t_1 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(Py_None);
if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 730, __pyx_L1_error)
__PYX_XDEC_MEMVIEW(&__pyx_v_self->pump_s.time_change_rate_vector, 0);
__pyx_v_self->pump_s.time_change_rate_vector = __pyx_t_1;
__pyx_t_1.memview = NULL;
__pyx_t_1.data = NULL;
0731:
+0732: cdef class TF:
struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_TF { int (*get_var)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_TF *); PyObject *(*set_reg_seq)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_TF *, PyObject *, PyObject *, PyObject *, PyObject *); PyObject *(*set_degradation)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_TF *, PyObject *); PyObject *(*set_ligands)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_TF *, PyObject *, PyObject *, PyObject *); PyObject *(*set_time_course_view)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_TF *, PyObject *); }; static struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_TF *__pyx_vtabptr_15VirtualMicrobes_20cython_gsl_interface_4odes_TF;
+0733: def __cinit__(self,tf, cell, env, var_map):
/* Python wrapper */ static int __pyx_pw_15VirtualMicrobes_20cython_gsl_interface_4odes_2TF_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_15VirtualMicrobes_20cython_gsl_interface_4odes_2TF_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_tf = 0; PyObject *__pyx_v_cell = 0; PyObject *__pyx_v_env = 0; PyObject *__pyx_v_var_map = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tf,&__pyx_n_s_cell,&__pyx_n_s_env,&__pyx_n_s_var_map,0}; PyObject* values[4] = {0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_tf)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_cell)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, 1); __PYX_ERR(0, 733, __pyx_L3_error) } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_env)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, 2); __PYX_ERR(0, 733, __pyx_L3_error) } case 3: if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_var_map)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, 3); __PYX_ERR(0, 733, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 733, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); values[3] = PyTuple_GET_ITEM(__pyx_args, 3); } __pyx_v_tf = values[0]; __pyx_v_cell = values[1]; __pyx_v_env = values[2]; __pyx_v_var_map = values[3]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 733, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("VirtualMicrobes.cython_gsl_interface.odes.TF.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_15VirtualMicrobes_20cython_gsl_interface_4odes_2TF___cinit__(((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_TF *)__pyx_v_self), __pyx_v_tf, __pyx_v_cell, __pyx_v_env, __pyx_v_var_map); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_15VirtualMicrobes_20cython_gsl_interface_4odes_2TF___cinit__(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_TF *__pyx_v_self, PyObject *__pyx_v_tf, PyObject *__pyx_v_cell, PyObject *__pyx_v_env, PyObject *__pyx_v_var_map) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__", 0); /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("VirtualMicrobes.cython_gsl_interface.odes.TF.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0734: self.py_tf = tf
__Pyx_INCREF(__pyx_v_tf); __Pyx_GIVEREF(__pyx_v_tf); __Pyx_GOTREF(__pyx_v_self->py_tf); __Pyx_DECREF(__pyx_v_self->py_tf); __pyx_v_self->py_tf = __pyx_v_tf;
+0735: self.tf_s.gene_multiplicity = cell.molecules["gene_products"][tf].multiplicity
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_cell, __pyx_n_s_molecules); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 735, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_n_s_gene_products); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 735, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyObject_GetItem(__pyx_t_2, __pyx_v_tf); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 735, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_multiplicity); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 735, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 735, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_self->tf_s.gene_multiplicity = __pyx_t_3;
+0736: self.tf_s.eff_apo = self.py_tf["eff_apo"]
__pyx_t_2 = PyObject_GetItem(__pyx_v_self->py_tf, __pyx_n_s_eff_apo); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 736, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 736, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_self->tf_s.eff_apo = __pyx_t_3;
+0737: self.tf_s.eff_bound = self.py_tf["eff_bound"]
__pyx_t_2 = PyObject_GetItem(__pyx_v_self->py_tf, __pyx_n_s_eff_bound); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 737, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 737, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_self->tf_s.eff_bound = __pyx_t_3;
+0738: self.tf_s.k_bind_op = self.py_tf['k_bind_op']
__pyx_t_2 = PyObject_GetItem(__pyx_v_self->py_tf, __pyx_n_s_k_bind_op); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 738, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 738, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_self->tf_s.k_bind_op = __pyx_t_3;
+0739: self.tf_s.coop = self.py_tf['binding_coop']
__pyx_t_2 = PyObject_GetItem(__pyx_v_self->py_tf, __pyx_n_s_binding_coop); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 739, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 739, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_self->tf_s.coop = __pyx_t_3;
+0740: self.set_degradation(cell)
__pyx_t_2 = ((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_TF *)__pyx_v_self->__pyx_vtab)->set_degradation(__pyx_v_self, __pyx_v_cell); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 740, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+0741: self.tf_s.variable = var_map["gene_products"][cell][self.py_tf]
__pyx_t_2 = PyObject_GetItem(__pyx_v_var_map, __pyx_n_s_gene_products); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 741, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = PyObject_GetItem(__pyx_t_2, __pyx_v_cell); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 741, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_v_self->py_tf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 741, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 741, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_self->tf_s.variable = __pyx_t_4;
+0742: self.set_ligands(cell, env, var_map)
__pyx_t_2 = ((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_TF *)__pyx_v_self->__pyx_vtab)->set_ligands(__pyx_v_self, __pyx_v_cell, __pyx_v_env, __pyx_v_var_map); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 742, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
0743:
+0744: cdef set_time_course_view(self, py_cell):
static PyObject *__pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_2TF_set_time_course_view(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_TF *__pyx_v_self, PyObject *__pyx_v_py_cell) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_time_course_view", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __PYX_XDEC_MEMVIEW(&__pyx_t_3, 1); __Pyx_AddTraceback("VirtualMicrobes.cython_gsl_interface.odes.TF.set_time_course_view", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0745: self.tf_s.time_concentration_vector = py_cell.molecules["gene_products"][self.py_tf].time_course
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_py_cell, __pyx_n_s_molecules); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 745, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_n_s_gene_products); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 745, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyObject_GetItem(__pyx_t_2, __pyx_v_self->py_tf); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 745, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_time_course); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 745, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_2); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 745, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_XDEC_MEMVIEW(&__pyx_v_self->tf_s.time_concentration_vector, 0); __pyx_v_self->tf_s.time_concentration_vector = __pyx_t_3; __pyx_t_3.memview = NULL; __pyx_t_3.data = NULL;
0746:
+0747: cdef set_reg_seq(self, prom, op, genome, tfs_c_dict):
static PyObject *__pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_2TF_set_reg_seq(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_TF *__pyx_v_self, PyObject *__pyx_v_prom, PyObject *__pyx_v_op, PyObject *__pyx_v_genome, PyObject *__pyx_v_tfs_c_dict) { PyObject *__pyx_v_binding_tfs_scores = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_reg_seq", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("VirtualMicrobes.cython_gsl_interface.odes.TF.set_reg_seq", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_binding_tfs_scores); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0748: binding_tfs_scores = genome.binding_tfs_scores(op)
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_genome, __pyx_n_s_binding_tfs_scores); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 748, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } if (!__pyx_t_3) { __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_op); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 748, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } else { __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 748, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL; __Pyx_INCREF(__pyx_v_op); __Pyx_GIVEREF(__pyx_v_op); PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_op); __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 748, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_binding_tfs_scores = __pyx_t_1; __pyx_t_1 = 0;
+0749: self.reg_seq_c = REG_SEQ.__new__(REG_SEQ, prom, op, binding_tfs_scores, tfs_c_dict)
__pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 749, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_prom); __Pyx_GIVEREF(__pyx_v_prom); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_prom); __Pyx_INCREF(__pyx_v_op); __Pyx_GIVEREF(__pyx_v_op); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_op); __Pyx_INCREF(__pyx_v_binding_tfs_scores); __Pyx_GIVEREF(__pyx_v_binding_tfs_scores); PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_binding_tfs_scores); __Pyx_INCREF(__pyx_v_tfs_c_dict); __Pyx_GIVEREF(__pyx_v_tfs_c_dict); PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_tfs_c_dict); __pyx_t_2 = __pyx_tp_new_15VirtualMicrobes_20cython_gsl_interface_4odes_REG_SEQ(((PyTypeObject *)__pyx_ptype_15VirtualMicrobes_20cython_gsl_interface_4odes_REG_SEQ), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 749, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (!(likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_15VirtualMicrobes_20cython_gsl_interface_4odes_REG_SEQ)))) __PYX_ERR(0, 749, __pyx_L1_error) __Pyx_GIVEREF(__pyx_t_2); __Pyx_GOTREF(__pyx_v_self->reg_seq_c); __Pyx_DECREF(((PyObject *)__pyx_v_self->reg_seq_c)); __pyx_v_self->reg_seq_c = ((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_REG_SEQ *)__pyx_t_2); __pyx_t_2 = 0;
+0750: self.tf_s.reg_seq = &(self.reg_seq_c.reg_seq_s)
__pyx_v_self->tf_s.reg_seq = (&__pyx_v_self->reg_seq_c->reg_seq_s);
0751:
+0752: cdef set_degradation(self, cell):
static PyObject *__pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_2TF_set_degradation(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_TF *__pyx_v_self, PyObject *__pyx_v_cell) { double __pyx_v_constant; CYTHON_UNUSED PyObject *__pyx_v_reaction = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_degradation", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("VirtualMicrobes.cython_gsl_interface.odes.TF.set_degradation", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_reaction); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
0753: cdef double constant
0754: cdef object reaction
+0755: reaction, constant = cell.molecules["gene_products"][self.py_tf].degradation
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_cell, __pyx_n_s_molecules); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 755, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_n_s_gene_products); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 755, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyObject_GetItem(__pyx_t_2, __pyx_v_self->py_tf); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 755, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_degradation); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 755, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) { PyObject* sequence = __pyx_t_2; #if CYTHON_COMPILING_IN_CPYTHON Py_ssize_t size = Py_SIZE(sequence); #else Py_ssize_t size = PySequence_Size(sequence); #endif if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); __PYX_ERR(0, 755, __pyx_L1_error) } #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); } else { __pyx_t_1 = PyList_GET_ITEM(sequence, 0); __pyx_t_3 = PyList_GET_ITEM(sequence, 1); } __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(__pyx_t_3); #else __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 755, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 755, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else { Py_ssize_t index = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 755, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext; index = 0; __pyx_t_1 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed; __Pyx_GOTREF(__pyx_t_1); index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed; __Pyx_GOTREF(__pyx_t_3); if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) __PYX_ERR(0, 755, __pyx_L1_error) __pyx_t_5 = NULL; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L4_unpacking_done; __pyx_L3_unpacking_failed:; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_5 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); __PYX_ERR(0, 755, __pyx_L1_error) __pyx_L4_unpacking_done:; } __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 755, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_reaction = __pyx_t_1; __pyx_t_1 = 0; __pyx_v_constant = __pyx_t_6;
+0756: self.tf_s.degr_const = constant
__pyx_v_self->tf_s.degr_const = __pyx_v_constant;
0757:
+0758: cdef set_ligands(self, cell, env, var_map):
static PyObject *__pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_2TF_set_ligands(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_TF *__pyx_v_self, PyObject *__pyx_v_cell, PyObject *__pyx_v_env, PyObject *__pyx_v_var_map) { PyObject *__pyx_v_ligand_kss = 0; PyObject *__pyx_v_l = 0; double __pyx_v_ligand_coop; double __pyx_v_k; int __pyx_v_i; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_ligands", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_9); __Pyx_AddTraceback("VirtualMicrobes.cython_gsl_interface.odes.TF.set_ligands", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_ligand_kss); __Pyx_XDECREF(__pyx_v_l); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
0759: cdef object ligand_kss, l
+0760: ligand_kss = self.py_tf['ligand_ks']
__pyx_t_1 = PyObject_GetItem(__pyx_v_self->py_tf, __pyx_n_s_ligand_ks); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 760, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_ligand_kss = __pyx_t_1; __pyx_t_1 = 0;
+0761: cdef double ligand_coop = self.py_tf['ligand_coop']
__pyx_t_1 = PyObject_GetItem(__pyx_v_self->py_tf, __pyx_n_s_ligand_coop); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 761, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 761, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_ligand_coop = __pyx_t_2;
+0762: self.tf_s.nr_ligands = len(ligand_kss)
__pyx_t_3 = PyObject_Length(__pyx_v_ligand_kss); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(0, 762, __pyx_L1_error)
__pyx_v_self->tf_s.nr_ligands = __pyx_t_3;
+0763: self.tf_s.ligands = <ligand_str *> PyMem_Malloc(self.tf_s.nr_ligands
__pyx_v_self->tf_s.ligands = ((struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_ligand_str *)PyMem_Malloc((__pyx_v_self->tf_s.nr_ligands * (sizeof(struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_ligand_str)))));
0764: * sizeof(ligand_str))
0765: cdef double k
0766: cdef int i
+0767: for i,(l,k) in enumerate(ligand_kss.items()):
__pyx_t_4 = 0; __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_ligand_kss, __pyx_n_s_items); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 767, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) { __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); } } if (__pyx_t_6) { __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 767, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } else { __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 767, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { __pyx_t_5 = __pyx_t_1; __Pyx_INCREF(__pyx_t_5); __pyx_t_3 = 0; __pyx_t_7 = NULL; } else { __pyx_t_3 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 767, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_7 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 767, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; for (;;) { if (likely(!__pyx_t_7)) { if (likely(PyList_CheckExact(__pyx_t_5))) { if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_5)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_1 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 767, __pyx_L1_error) #else __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 767, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } else { if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_5)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 767, __pyx_L1_error) #else __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 767, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } } else { __pyx_t_1 = __pyx_t_7(__pyx_t_5); if (unlikely(!__pyx_t_1)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 767, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_1); } if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { PyObject* sequence = __pyx_t_1; #if CYTHON_COMPILING_IN_CPYTHON Py_ssize_t size = Py_SIZE(sequence); #else Py_ssize_t size = PySequence_Size(sequence); #endif if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); __PYX_ERR(0, 767, __pyx_L1_error) } #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); } else { __pyx_t_6 = PyList_GET_ITEM(sequence, 0); __pyx_t_8 = PyList_GET_ITEM(sequence, 1); } __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(__pyx_t_8); #else __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 767, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 767, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } else { Py_ssize_t index = -1; __pyx_t_9 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 767, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_10 = Py_TYPE(__pyx_t_9)->tp_iternext; index = 0; __pyx_t_6 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed; __Pyx_GOTREF(__pyx_t_6); index = 1; __pyx_t_8 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_8)) goto __pyx_L5_unpacking_failed; __Pyx_GOTREF(__pyx_t_8); if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 2) < 0) __PYX_ERR(0, 767, __pyx_L1_error) __pyx_t_10 = NULL; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; goto __pyx_L6_unpacking_done; __pyx_L5_unpacking_failed:; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_10 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); __PYX_ERR(0, 767, __pyx_L1_error) __pyx_L6_unpacking_done:; } __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_8); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 767, __pyx_L1_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_XDECREF_SET(__pyx_v_l, __pyx_t_6); __pyx_t_6 = 0; __pyx_v_k = __pyx_t_2; __pyx_v_i = __pyx_t_4; __pyx_t_4 = (__pyx_t_4 + 1); /* … */ } __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+0768: if self.py_tf['sense_external']:
__pyx_t_1 = PyObject_GetItem(__pyx_v_self->py_tf, __pyx_n_s_sense_external); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 768, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 768, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_11) { /* … */ goto __pyx_L7; }
+0769: self.tf_s.ligands[i].variable = var_map["small_molecules"][env][l.paired]
__pyx_t_1 = PyObject_GetItem(__pyx_v_var_map, __pyx_n_s_small_molecules); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 769, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_8 = PyObject_GetItem(__pyx_t_1, __pyx_v_env); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 769, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_l, __pyx_n_s_paired); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 769, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_6 = PyObject_GetItem(__pyx_t_8, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 769, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_12 = __Pyx_PyInt_As_int(__pyx_t_6); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 769, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; (__pyx_v_self->tf_s.ligands[__pyx_v_i]).variable = __pyx_t_12;
0770: else:
+0771: self.tf_s.ligands[i].variable = var_map["small_molecules"][cell][l]
/*else*/ { __pyx_t_6 = PyObject_GetItem(__pyx_v_var_map, __pyx_n_s_small_molecules); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 771, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_1 = PyObject_GetItem(__pyx_t_6, __pyx_v_cell); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 771, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = PyObject_GetItem(__pyx_t_1, __pyx_v_l); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 771, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_12 = __Pyx_PyInt_As_int(__pyx_t_6); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 771, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; (__pyx_v_self->tf_s.ligands[__pyx_v_i]).variable = __pyx_t_12; } __pyx_L7:;
+0772: self.tf_s.ligands[i].k_bind = k
(__pyx_v_self->tf_s.ligands[__pyx_v_i]).k_bind = __pyx_v_k;
+0773: self.tf_s.ligands[i].coop = ligand_coop
(__pyx_v_self->tf_s.ligands[__pyx_v_i]).coop = __pyx_v_ligand_coop;
0774:
+0775: cdef int get_var(self):
static int __pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_2TF_get_var(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_TF *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_var", 0); /* … */ /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0776: return self.tf_s.variable
__pyx_r = __pyx_v_self->tf_s.variable; goto __pyx_L0;
0777:
+0778: def __dealloc__(self):
/* Python wrapper */ static void __pyx_pw_15VirtualMicrobes_20cython_gsl_interface_4odes_2TF_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ static void __pyx_pw_15VirtualMicrobes_20cython_gsl_interface_4odes_2TF_3__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); __pyx_pf_15VirtualMicrobes_20cython_gsl_interface_4odes_2TF_2__dealloc__(((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_TF *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); } static void __pyx_pf_15VirtualMicrobes_20cython_gsl_interface_4odes_2TF_2__dealloc__(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_TF *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); /* … */ /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1); __Pyx_WriteUnraisable("VirtualMicrobes.cython_gsl_interface.odes.TF.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0); __pyx_L0:; __Pyx_RefNannyFinishContext(); }
+0779: PyMem_Free(self.tf_s.ligands)
PyMem_Free(__pyx_v_self->tf_s.ligands);
+0780: self.tf_s.time_concentration_vector = None
__pyx_t_1 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(Py_None);
if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 780, __pyx_L1_error)
__PYX_XDEC_MEMVIEW(&__pyx_v_self->tf_s.time_concentration_vector, 0);
__pyx_v_self->tf_s.time_concentration_vector = __pyx_t_1;
__pyx_t_1.memview = NULL;
__pyx_t_1.data = NULL;
+0781: self.tf_s.time_change_rate_vector = None
__pyx_t_1 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(Py_None);
if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 781, __pyx_L1_error)
__PYX_XDEC_MEMVIEW(&__pyx_v_self->tf_s.time_change_rate_vector, 0);
__pyx_v_self->tf_s.time_change_rate_vector = __pyx_t_1;
__pyx_t_1.memview = NULL;
__pyx_t_1.data = NULL;
0782:
+0783: cdef class REG_SEQ:
struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_REG_SEQ { PyObject *(*add_binding_tfs)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_REG_SEQ *, PyObject *, PyObject *, PyObject *); }; static struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_REG_SEQ *__pyx_vtabptr_15VirtualMicrobes_20cython_gsl_interface_4odes_REG_SEQ;
+0784: def __cinit__(self, promoter, operator, binding_tfs_scores, tfs_c_dict):
/* Python wrapper */ static int __pyx_pw_15VirtualMicrobes_20cython_gsl_interface_4odes_7REG_SEQ_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_15VirtualMicrobes_20cython_gsl_interface_4odes_7REG_SEQ_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_promoter = 0; PyObject *__pyx_v_operator = 0; PyObject *__pyx_v_binding_tfs_scores = 0; PyObject *__pyx_v_tfs_c_dict = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_promoter,&__pyx_n_s_operator,&__pyx_n_s_binding_tfs_scores,&__pyx_n_s_tfs_c_dict,0}; PyObject* values[4] = {0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_promoter)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_operator)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, 1); __PYX_ERR(0, 784, __pyx_L3_error) } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_binding_tfs_scores)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, 2); __PYX_ERR(0, 784, __pyx_L3_error) } case 3: if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_tfs_c_dict)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, 3); __PYX_ERR(0, 784, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 784, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); values[3] = PyTuple_GET_ITEM(__pyx_args, 3); } __pyx_v_promoter = values[0]; __pyx_v_operator = values[1]; __pyx_v_binding_tfs_scores = values[2]; __pyx_v_tfs_c_dict = values[3]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 784, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("VirtualMicrobes.cython_gsl_interface.odes.REG_SEQ.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_15VirtualMicrobes_20cython_gsl_interface_4odes_7REG_SEQ___cinit__(((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_REG_SEQ *)__pyx_v_self), __pyx_v_promoter, __pyx_v_operator, __pyx_v_binding_tfs_scores, __pyx_v_tfs_c_dict); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_15VirtualMicrobes_20cython_gsl_interface_4odes_7REG_SEQ___cinit__(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_REG_SEQ *__pyx_v_self, PyObject *__pyx_v_promoter, PyObject *__pyx_v_operator, PyObject *__pyx_v_binding_tfs_scores, PyObject *__pyx_v_tfs_c_dict) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__", 0); /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("VirtualMicrobes.cython_gsl_interface.odes.REG_SEQ.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0785: self.reg_seq_s.pr_str = promoter.strength
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_promoter, __pyx_n_s_strength); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 785, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 785, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->reg_seq_s.pr_str = __pyx_t_2;
+0786: self.add_binding_tfs(operator, binding_tfs_scores, tfs_c_dict)
__pyx_t_1 = ((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_REG_SEQ *)__pyx_v_self->__pyx_vtab)->add_binding_tfs(__pyx_v_self, __pyx_v_operator, __pyx_v_binding_tfs_scores, __pyx_v_tfs_c_dict); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 786, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
0787:
+0788: cdef add_binding_tfs(self, op, binding_tfs_scores, tfs_c_dict):
static PyObject *__pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_7REG_SEQ_add_binding_tfs(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_REG_SEQ *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_op, PyObject *__pyx_v_binding_tfs_scores, PyObject *__pyx_v_tfs_c_dict) { PyObject *__pyx_v_tf = 0; int __pyx_v_i; struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_TF *__pyx_v_tf_c = 0; PyObject *__pyx_v_s = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("add_binding_tfs", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("VirtualMicrobes.cython_gsl_interface.odes.REG_SEQ.add_binding_tfs", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_tf); __Pyx_XDECREF((PyObject *)__pyx_v_tf_c); __Pyx_XDECREF(__pyx_v_s); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0789: self.reg_seq_s.nr_binding_tfs = len(binding_tfs_scores)
__pyx_t_1 = PyObject_Length(__pyx_v_binding_tfs_scores); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(0, 789, __pyx_L1_error)
__pyx_v_self->reg_seq_s.nr_binding_tfs = __pyx_t_1;
+0790: self.reg_seq_s.binding_tfs = <binding_tf_str *> PyMem_Malloc(self.reg_seq_s.nr_binding_tfs
__pyx_v_self->reg_seq_s.binding_tfs = ((struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_binding_tf_str *)PyMem_Malloc((__pyx_v_self->reg_seq_s.nr_binding_tfs * (sizeof(struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_binding_tf_str)))));
0791: * sizeof(binding_tf_str))
0792: cdef object tf
0793: cdef int i
0794: cdef TF tf_c
+0795: for i, (tf,s) in enumerate(binding_tfs_scores):
__pyx_t_2 = 0; if (likely(PyList_CheckExact(__pyx_v_binding_tfs_scores)) || PyTuple_CheckExact(__pyx_v_binding_tfs_scores)) { __pyx_t_3 = __pyx_v_binding_tfs_scores; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0; __pyx_t_4 = NULL; } else { __pyx_t_1 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_binding_tfs_scores); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 795, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 795, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_4)) { if (likely(PyList_CheckExact(__pyx_t_3))) { if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_3)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_5 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(0, 795, __pyx_L1_error) #else __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 795, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); #endif } else { if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(0, 795, __pyx_L1_error) #else __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 795, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); #endif } } else { __pyx_t_5 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_5)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 795, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_5); } if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) { PyObject* sequence = __pyx_t_5; #if CYTHON_COMPILING_IN_CPYTHON Py_ssize_t size = Py_SIZE(sequence); #else Py_ssize_t size = PySequence_Size(sequence); #endif if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); __PYX_ERR(0, 795, __pyx_L1_error) } #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); } else { __pyx_t_6 = PyList_GET_ITEM(sequence, 0); __pyx_t_7 = PyList_GET_ITEM(sequence, 1); } __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(__pyx_t_7); #else __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 795, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 795, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); #endif __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else { Py_ssize_t index = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 795, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext; index = 0; __pyx_t_6 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed; __Pyx_GOTREF(__pyx_t_6); index = 1; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L5_unpacking_failed; __Pyx_GOTREF(__pyx_t_7); if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) __PYX_ERR(0, 795, __pyx_L1_error) __pyx_t_9 = NULL; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; goto __pyx_L6_unpacking_done; __pyx_L5_unpacking_failed:; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_9 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); __PYX_ERR(0, 795, __pyx_L1_error) __pyx_L6_unpacking_done:; } __Pyx_XDECREF_SET(__pyx_v_tf, __pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF_SET(__pyx_v_s, __pyx_t_7); __pyx_t_7 = 0; __pyx_v_i = __pyx_t_2; __pyx_t_2 = (__pyx_t_2 + 1); /* … */ } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+0796: tf_c = tfs_c_dict[tf]
__pyx_t_5 = PyObject_GetItem(__pyx_v_tfs_c_dict, __pyx_v_tf); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 796, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_15VirtualMicrobes_20cython_gsl_interface_4odes_TF))))) __PYX_ERR(0, 796, __pyx_L1_error) __Pyx_XDECREF_SET(__pyx_v_tf_c, ((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_TF *)__pyx_t_5)); __pyx_t_5 = 0;
+0797: self.reg_seq_s.binding_tfs[i].score = s
__pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_v_s); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 797, __pyx_L1_error) (__pyx_v_self->reg_seq_s.binding_tfs[__pyx_v_i]).score = __pyx_t_10;
+0798: self.reg_seq_s.binding_tfs[i].tf = &(tf_c.tf_s)
(__pyx_v_self->reg_seq_s.binding_tfs[__pyx_v_i]).tf = (&__pyx_v_tf_c->tf_s);
0799:
+0800: def __dealloc__(self):
/* Python wrapper */ static void __pyx_pw_15VirtualMicrobes_20cython_gsl_interface_4odes_7REG_SEQ_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ static void __pyx_pw_15VirtualMicrobes_20cython_gsl_interface_4odes_7REG_SEQ_3__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); __pyx_pf_15VirtualMicrobes_20cython_gsl_interface_4odes_7REG_SEQ_2__dealloc__(((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_REG_SEQ *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); } static void __pyx_pf_15VirtualMicrobes_20cython_gsl_interface_4odes_7REG_SEQ_2__dealloc__(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_REG_SEQ *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); /* … */ /* function exit code */ __Pyx_RefNannyFinishContext(); }
+0801: PyMem_Free(self.reg_seq_s.binding_tfs)
PyMem_Free(__pyx_v_self->reg_seq_s.binding_tfs);
0802:
+0803: cdef class SMALL_MOL:
struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_SMALL_MOL { int (*get_var)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_SMALL_MOL *); PyObject *(*set_degradation)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_SMALL_MOL *, PyObject *); PyObject *(*set_influx)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_SMALL_MOL *, PyObject *); PyObject *(*set_diffusion)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_SMALL_MOL *, PyObject *, PyObject *, PyObject *); PyObject *(*set_time_course_view)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_SMALL_MOL *, PyObject *); }; static struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_SMALL_MOL *__pyx_vtabptr_15VirtualMicrobes_20cython_gsl_interface_4odes_SMALL_MOL;
+0804: def __cinit__(self, mol, container, var_map,
/* Python wrapper */ static int __pyx_pw_15VirtualMicrobes_20cython_gsl_interface_4odes_9SMALL_MOL_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_15VirtualMicrobes_20cython_gsl_interface_4odes_9SMALL_MOL_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_mol = 0; PyObject *__pyx_v_container = 0; PyObject *__pyx_v_var_map = 0; PyObject *__pyx_v_influx = 0; PyObject *__pyx_v_diffusion_external_env = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mol,&__pyx_n_s_container,&__pyx_n_s_var_map,&__pyx_n_s_influx,&__pyx_n_s_diffusion_external_env,0}; PyObject* values[5] = {0,0,0,0,0}; /* … */ /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_15VirtualMicrobes_20cython_gsl_interface_4odes_9SMALL_MOL___cinit__(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_SMALL_MOL *__pyx_v_self, PyObject *__pyx_v_mol, PyObject *__pyx_v_container, PyObject *__pyx_v_var_map, PyObject *__pyx_v_influx, PyObject *__pyx_v_diffusion_external_env) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__", 0); /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("VirtualMicrobes.cython_gsl_interface.odes.SMALL_MOL.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0805: influx=True, diffusion_external_env=None):
values[3] = ((PyObject *)Py_True); values[4] = ((PyObject *)Py_None); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mol)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_container)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 1); __PYX_ERR(0, 804, __pyx_L3_error) } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_var_map)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 2); __PYX_ERR(0, 804, __pyx_L3_error) } case 3: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_influx); if (value) { values[3] = value; kw_args--; } } case 4: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_diffusion_external_env); if (value) { values[4] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 804, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[0] = PyTuple_GET_ITEM(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_mol = values[0]; __pyx_v_container = values[1]; __pyx_v_var_map = values[2]; __pyx_v_influx = values[3]; __pyx_v_diffusion_external_env = values[4]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 804, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("VirtualMicrobes.cython_gsl_interface.odes.SMALL_MOL.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_15VirtualMicrobes_20cython_gsl_interface_4odes_9SMALL_MOL___cinit__(((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_SMALL_MOL *)__pyx_v_self), __pyx_v_mol, __pyx_v_container, __pyx_v_var_map, __pyx_v_influx, __pyx_v_diffusion_external_env);
+0806: self.py_mol = mol
__Pyx_INCREF(__pyx_v_mol); __Pyx_GIVEREF(__pyx_v_mol); __Pyx_GOTREF(__pyx_v_self->py_mol); __Pyx_DECREF(__pyx_v_self->py_mol); __pyx_v_self->py_mol = __pyx_v_mol;
+0807: self.mol_s.toxic_level = mol.toxic_level
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_mol, __pyx_n_s_toxic_level); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 807, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 807, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->mol_s.toxic_level = __pyx_t_2;
+0808: self.mol_s.variable = var_map["small_molecules"][container][mol]
__pyx_t_1 = PyObject_GetItem(__pyx_v_var_map, __pyx_n_s_small_molecules); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 808, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = PyObject_GetItem(__pyx_t_1, __pyx_v_container); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 808, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyObject_GetItem(__pyx_t_3, __pyx_v_mol); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 808, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 808, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->mol_s.variable = __pyx_t_4;
0809:
+0810: self.set_degradation(container)
__pyx_t_1 = ((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_SMALL_MOL *)__pyx_v_self->__pyx_vtab)->set_degradation(__pyx_v_self, __pyx_v_container); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 810, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+0811: if influx:
__pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_influx); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 811, __pyx_L1_error)
if (__pyx_t_5) {
/* … */
}
+0812: self.set_influx(container)
__pyx_t_1 = ((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_SMALL_MOL *)__pyx_v_self->__pyx_vtab)->set_influx(__pyx_v_self, __pyx_v_container); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 812, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+0813: if diffusion_external_env is not None:
__pyx_t_5 = (__pyx_v_diffusion_external_env != Py_None); __pyx_t_6 = (__pyx_t_5 != 0); if (__pyx_t_6) { /* … */ }
+0814: self.set_diffusion(container, diffusion_external_env, var_map)
__pyx_t_1 = ((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_SMALL_MOL *)__pyx_v_self->__pyx_vtab)->set_diffusion(__pyx_v_self, __pyx_v_container, __pyx_v_diffusion_external_env, __pyx_v_var_map); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 814, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
0815:
+0816: cdef set_time_course_view(self, py_container):
static PyObject *__pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_9SMALL_MOL_set_time_course_view(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_SMALL_MOL *__pyx_v_self, PyObject *__pyx_v_py_container) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_time_course_view", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __PYX_XDEC_MEMVIEW(&__pyx_t_3, 1); __Pyx_AddTraceback("VirtualMicrobes.cython_gsl_interface.odes.SMALL_MOL.set_time_course_view", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0817: self.mol_s.time_concentration_vector = py_container.molecules["small_molecules"][self.py_mol].time_course
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_py_container, __pyx_n_s_molecules); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 817, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_n_s_small_molecules); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 817, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyObject_GetItem(__pyx_t_2, __pyx_v_self->py_mol); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 817, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_time_course); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 817, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_2); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 817, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_XDEC_MEMVIEW(&__pyx_v_self->mol_s.time_concentration_vector, 0); __pyx_v_self->mol_s.time_concentration_vector = __pyx_t_3; __pyx_t_3.memview = NULL; __pyx_t_3.data = NULL;
0818:
+0819: cdef set_degradation(self, container):
static PyObject *__pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_9SMALL_MOL_set_degradation(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_SMALL_MOL *__pyx_v_self, PyObject *__pyx_v_container) { double __pyx_v_constant; CYTHON_UNUSED PyObject *__pyx_v_reaction = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_degradation", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("VirtualMicrobes.cython_gsl_interface.odes.SMALL_MOL.set_degradation", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_reaction); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
0820: cdef double constant
0821: cdef object reaction
+0822: reaction, constant = container.molecules["small_molecules"][self.py_mol].degradation
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_container, __pyx_n_s_molecules); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 822, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_n_s_small_molecules); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 822, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyObject_GetItem(__pyx_t_2, __pyx_v_self->py_mol); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 822, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_degradation); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 822, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) { PyObject* sequence = __pyx_t_2; #if CYTHON_COMPILING_IN_CPYTHON Py_ssize_t size = Py_SIZE(sequence); #else Py_ssize_t size = PySequence_Size(sequence); #endif if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); __PYX_ERR(0, 822, __pyx_L1_error) } #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); } else { __pyx_t_1 = PyList_GET_ITEM(sequence, 0); __pyx_t_3 = PyList_GET_ITEM(sequence, 1); } __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(__pyx_t_3); #else __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 822, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 822, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else { Py_ssize_t index = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 822, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext; index = 0; __pyx_t_1 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed; __Pyx_GOTREF(__pyx_t_1); index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed; __Pyx_GOTREF(__pyx_t_3); if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) __PYX_ERR(0, 822, __pyx_L1_error) __pyx_t_5 = NULL; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L4_unpacking_done; __pyx_L3_unpacking_failed:; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_5 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); __PYX_ERR(0, 822, __pyx_L1_error) __pyx_L4_unpacking_done:; } __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 822, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_reaction = __pyx_t_1; __pyx_t_1 = 0; __pyx_v_constant = __pyx_t_6;
+0823: self.mol_s.degr_const = constant
__pyx_v_self->mol_s.degr_const = __pyx_v_constant;
0824:
+0825: cdef set_influx(self, container):
static PyObject *__pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_9SMALL_MOL_set_influx(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_SMALL_MOL *__pyx_v_self, PyObject *__pyx_v_container) { double __pyx_v_constant; CYTHON_UNUSED PyObject *__pyx_v_reaction = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_influx", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("VirtualMicrobes.cython_gsl_interface.odes.SMALL_MOL.set_influx", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_reaction); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
0826: cdef double constant
0827: cdef object reaction
+0828: reaction, constant = container.molecules["small_molecules"][self.py_mol].influx
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_container, __pyx_n_s_molecules); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 828, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_n_s_small_molecules); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 828, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyObject_GetItem(__pyx_t_2, __pyx_v_self->py_mol); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 828, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_influx); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 828, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) { PyObject* sequence = __pyx_t_2; #if CYTHON_COMPILING_IN_CPYTHON Py_ssize_t size = Py_SIZE(sequence); #else Py_ssize_t size = PySequence_Size(sequence); #endif if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); __PYX_ERR(0, 828, __pyx_L1_error) } #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); } else { __pyx_t_1 = PyList_GET_ITEM(sequence, 0); __pyx_t_3 = PyList_GET_ITEM(sequence, 1); } __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(__pyx_t_3); #else __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 828, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 828, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else { Py_ssize_t index = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 828, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext; index = 0; __pyx_t_1 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed; __Pyx_GOTREF(__pyx_t_1); index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed; __Pyx_GOTREF(__pyx_t_3); if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) __PYX_ERR(0, 828, __pyx_L1_error) __pyx_t_5 = NULL; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L4_unpacking_done; __pyx_L3_unpacking_failed:; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_5 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); __PYX_ERR(0, 828, __pyx_L1_error) __pyx_L4_unpacking_done:; } __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 828, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_reaction = __pyx_t_1; __pyx_t_1 = 0; __pyx_v_constant = __pyx_t_6;
+0829: self.mol_s.influx_const = constant
__pyx_v_self->mol_s.influx_const = __pyx_v_constant;
0830:
+0831: cdef set_diffusion(self, cell, env, var_map):
static PyObject *__pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_9SMALL_MOL_set_diffusion(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_SMALL_MOL *__pyx_v_self, PyObject *__pyx_v_cell, PyObject *__pyx_v_env, PyObject *__pyx_v_var_map) { double __pyx_v_constant; PyObject *__pyx_v_reaction = 0; PyObject *__pyx_v_reaction_dict = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_diffusion", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("VirtualMicrobes.cython_gsl_interface.odes.SMALL_MOL.set_diffusion", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_reaction); __Pyx_XDECREF(__pyx_v_reaction_dict); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
0832: cdef double constant
0833: cdef object reaction
+0834: reaction, constant = cell.molecules["small_molecules"][self.py_mol].diffusion
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_cell, __pyx_n_s_molecules); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 834, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_n_s_small_molecules); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 834, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyObject_GetItem(__pyx_t_2, __pyx_v_self->py_mol); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 834, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_diffusion); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 834, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) { PyObject* sequence = __pyx_t_2; #if CYTHON_COMPILING_IN_CPYTHON Py_ssize_t size = Py_SIZE(sequence); #else Py_ssize_t size = PySequence_Size(sequence); #endif if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); __PYX_ERR(0, 834, __pyx_L1_error) } #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); } else { __pyx_t_1 = PyList_GET_ITEM(sequence, 0); __pyx_t_3 = PyList_GET_ITEM(sequence, 1); } __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(__pyx_t_3); #else __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 834, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 834, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else { Py_ssize_t index = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 834, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext; index = 0; __pyx_t_1 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed; __Pyx_GOTREF(__pyx_t_1); index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed; __Pyx_GOTREF(__pyx_t_3); if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) __PYX_ERR(0, 834, __pyx_L1_error) __pyx_t_5 = NULL; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L4_unpacking_done; __pyx_L3_unpacking_failed:; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_5 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); __PYX_ERR(0, 834, __pyx_L1_error) __pyx_L4_unpacking_done:; } __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 834, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_reaction = __pyx_t_1; __pyx_t_1 = 0; __pyx_v_constant = __pyx_t_6;
+0835: reaction_dict = reaction.reaction_scheme()
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_reaction, __pyx_n_s_reaction_scheme); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 835, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_1)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } if (__pyx_t_1) { __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 835, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } else { __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 835, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_reaction_dict = __pyx_t_2; __pyx_t_2 = 0;
+0836: self.mol_s.diff_external_var = var_map["small_molecules"][env][reaction_dict["external"]]
__pyx_t_2 = PyObject_GetItem(__pyx_v_var_map, __pyx_n_s_small_molecules); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 836, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyObject_GetItem(__pyx_t_2, __pyx_v_env); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 836, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyObject_GetItem(__pyx_v_reaction_dict, __pyx_n_s_external); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 836, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = PyObject_GetItem(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 836, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 836, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->mol_s.diff_external_var = __pyx_t_7;
+0837: self.mol_s.diff_const = constant
__pyx_v_self->mol_s.diff_const = __pyx_v_constant;
0838:
+0839: cdef int get_var(self):
static int __pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_9SMALL_MOL_get_var(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_SMALL_MOL *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_var", 0); /* … */ /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0840: return self.mol_s.variable
__pyx_r = __pyx_v_self->mol_s.variable; goto __pyx_L0;
0841:
+0842: def __dealloc__(self):
/* Python wrapper */ static void __pyx_pw_15VirtualMicrobes_20cython_gsl_interface_4odes_9SMALL_MOL_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ static void __pyx_pw_15VirtualMicrobes_20cython_gsl_interface_4odes_9SMALL_MOL_3__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); __pyx_pf_15VirtualMicrobes_20cython_gsl_interface_4odes_9SMALL_MOL_2__dealloc__(((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_SMALL_MOL *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); } static void __pyx_pf_15VirtualMicrobes_20cython_gsl_interface_4odes_9SMALL_MOL_2__dealloc__(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_SMALL_MOL *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); /* … */ /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1); __Pyx_WriteUnraisable("VirtualMicrobes.cython_gsl_interface.odes.SMALL_MOL.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0); __pyx_L0:; __Pyx_RefNannyFinishContext(); }
+0843: self.mol_s.time_concentration_vector = None
__pyx_t_1 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(Py_None);
if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 843, __pyx_L1_error)
__PYX_XDEC_MEMVIEW(&__pyx_v_self->mol_s.time_concentration_vector, 0);
__pyx_v_self->mol_s.time_concentration_vector = __pyx_t_1;
__pyx_t_1.memview = NULL;
__pyx_t_1.data = NULL;
+0844: self.mol_s.time_change_rate_vector = None
__pyx_t_1 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(Py_None);
if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 844, __pyx_L1_error)
__PYX_XDEC_MEMVIEW(&__pyx_v_self->mol_s.time_change_rate_vector, 0);
__pyx_v_self->mol_s.time_change_rate_vector = __pyx_t_1;
__pyx_t_1.memview = NULL;
__pyx_t_1.data = NULL;
0845:
+0846: cdef class CELL:
struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL { PyObject *(*add_pumps)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *, PyObject *, PyObject *); PyObject *(*add_enzymes)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *, PyObject *); PyObject *(*add_tfs)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *, PyObject *, PyObject *); PyObject *(*add_small_mols)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *, PyObject *, PyObject *); PyObject *(*add_regulation)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *); PyObject *(*add_energy)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *, PyObject *); double (*get_py_mol_conc)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *, PyObject *); double (*get_py_prot_conc)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *, PyObject *); PyObject *(*add_production)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *, PyObject *); double (*get_py_production)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *); int (*get_production_var)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *); PyObject *(*add_toxicity)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *, PyObject *); double (*get_py_toxicity)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *); int (*get_toxicity_var)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *); PyObject *(*add_cell_size)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *, PyObject *); double (*get_py_cell_size)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *); int (*get_cell_size_var)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *); PyObject *(*set_time_course_views)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *); }; static struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *__pyx_vtabptr_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL;
0847: '''CELL is a parallel structure to the python class Cell that is
0848: tasked with generating the set of equations to be solved by integration procedure'''
0849:
+0850: def __cinit__(self, cell,env, var_map):
/* Python wrapper */ static int __pyx_pw_15VirtualMicrobes_20cython_gsl_interface_4odes_4CELL_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_15VirtualMicrobes_20cython_gsl_interface_4odes_4CELL_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_cell = 0; PyObject *__pyx_v_env = 0; PyObject *__pyx_v_var_map = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cell,&__pyx_n_s_env,&__pyx_n_s_var_map,0}; PyObject* values[3] = {0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_cell)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_env)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, 1); __PYX_ERR(0, 850, __pyx_L3_error) } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_var_map)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, 2); __PYX_ERR(0, 850, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 850, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); } __pyx_v_cell = values[0]; __pyx_v_env = values[1]; __pyx_v_var_map = values[2]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 850, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("VirtualMicrobes.cython_gsl_interface.odes.CELL.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_15VirtualMicrobes_20cython_gsl_interface_4odes_4CELL___cinit__(((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *)__pyx_v_self), __pyx_v_cell, __pyx_v_env, __pyx_v_var_map); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_15VirtualMicrobes_20cython_gsl_interface_4odes_4CELL___cinit__(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *__pyx_v_self, PyObject *__pyx_v_cell, PyObject *__pyx_v_env, PyObject *__pyx_v_var_map) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__", 0); /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("VirtualMicrobes.cython_gsl_interface.odes.CELL.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0851: self.py_cell = cell
__Pyx_INCREF(__pyx_v_cell); __Pyx_GIVEREF(__pyx_v_cell); __Pyx_GOTREF(__pyx_v_self->py_cell); __Pyx_DECREF(__pyx_v_self->py_cell); __pyx_v_self->py_cell = __pyx_v_cell;
+0852: self.pumps_c = []
__pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 852, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->pumps_c); __Pyx_DECREF(__pyx_v_self->pumps_c); __pyx_v_self->pumps_c = __pyx_t_1; __pyx_t_1 = 0;
+0853: self.enzymes_c = []
__pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 853, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->enzymes_c); __Pyx_DECREF(__pyx_v_self->enzymes_c); __pyx_v_self->enzymes_c = __pyx_t_1; __pyx_t_1 = 0;
+0854: self.tfs_c = collections.OrderedDict()
__pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_collections); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 854, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_OrderedDict); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 854, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_2)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } if (__pyx_t_2) { __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 854, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else { __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 854, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->tfs_c); __Pyx_DECREF(__pyx_v_self->tfs_c); __pyx_v_self->tfs_c = __pyx_t_1; __pyx_t_1 = 0;
+0855: self.small_mols_c = []
__pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 855, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->small_mols_c); __Pyx_DECREF(__pyx_v_self->small_mols_c); __pyx_v_self->small_mols_c = __pyx_t_1; __pyx_t_1 = 0;
+0856: self.cell_s.volume = self.py_cell.volume
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->py_cell, __pyx_n_s_volume); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 856, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 856, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->cell_s.volume = __pyx_t_4;
+0857: self.cell_s.trans_cost = self.py_cell.transcription_cost
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->py_cell, __pyx_n_s_transcription_cost); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 857, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 857, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->cell_s.trans_cost = __pyx_t_4;
+0858: self.cell_s.ene_trans_cost = self.py_cell.energy_transcription_cost
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->py_cell, __pyx_n_s_energy_transcription_cost); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 858, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 858, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->cell_s.ene_trans_cost = __pyx_t_4;
+0859: self.cell_s.k_ene_trans = self.py_cell.energy_transcription_scaling
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->py_cell, __pyx_n_s_energy_transcription_scaling); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 859, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 859, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->cell_s.k_ene_trans = __pyx_t_4;
+0860: self.cell_s.h_homeostatic_bb = self.py_cell.homeostatic_bb_scaling
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->py_cell, __pyx_n_s_homeostatic_bb_scaling); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 860, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 860, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->cell_s.h_homeostatic_bb = __pyx_t_4;
+0861: self.cell_s.nr_small_mols = len(self.py_cell.molecules["small_molecules"])
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->py_cell, __pyx_n_s_molecules); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 861, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = PyObject_GetItem(__pyx_t_1, __pyx_n_s_small_molecules); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 861, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_5 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(0, 861, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_self->cell_s.nr_small_mols = __pyx_t_5;
+0862: self.cell_s.nr_energy_mols = len(self.py_cell.energy_mols)
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->py_cell, __pyx_n_s_energy_mols); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 862, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(0, 862, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_self->cell_s.nr_energy_mols = __pyx_t_5;
+0863: self.add_small_mols(env, var_map)
__pyx_t_3 = ((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *)__pyx_v_self->__pyx_vtab)->add_small_mols(__pyx_v_self, __pyx_v_env, __pyx_v_var_map); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 863, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+0864: self.add_pumps(env, var_map)
__pyx_t_3 = ((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *)__pyx_v_self->__pyx_vtab)->add_pumps(__pyx_v_self, __pyx_v_env, __pyx_v_var_map); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 864, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+0865: self.add_enzymes(var_map)
__pyx_t_3 = ((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *)__pyx_v_self->__pyx_vtab)->add_enzymes(__pyx_v_self, __pyx_v_var_map); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 865, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+0866: self.add_tfs(env, var_map)
__pyx_t_3 = ((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *)__pyx_v_self->__pyx_vtab)->add_tfs(__pyx_v_self, __pyx_v_env, __pyx_v_var_map); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 866, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+0867: self.add_regulation()
__pyx_t_3 = ((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *)__pyx_v_self->__pyx_vtab)->add_regulation(__pyx_v_self); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 867, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+0868: self.add_production(var_map)
__pyx_t_3 = ((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *)__pyx_v_self->__pyx_vtab)->add_production(__pyx_v_self, __pyx_v_var_map); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 868, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+0869: self.add_energy(var_map)
__pyx_t_3 = ((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *)__pyx_v_self->__pyx_vtab)->add_energy(__pyx_v_self, __pyx_v_var_map); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 869, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+0870: self.add_toxicity(var_map)
__pyx_t_3 = ((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *)__pyx_v_self->__pyx_vtab)->add_toxicity(__pyx_v_self, __pyx_v_var_map); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 870, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+0871: self.add_cell_size(var_map)
__pyx_t_3 = ((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *)__pyx_v_self->__pyx_vtab)->add_cell_size(__pyx_v_self, __pyx_v_var_map); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 871, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
0872:
+0873: cdef add_pumps(self, env, var_map):
static PyObject *__pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_4CELL_add_pumps(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *__pyx_v_self, PyObject *__pyx_v_env, PyObject *__pyx_v_var_map) { PyObject *__pyx_v_pumps = 0; PyObject *__pyx_v_p = 0; struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_PUMP *__pyx_v_pump_c = 0; int __pyx_v_i; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("add_pumps", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("VirtualMicrobes.cython_gsl_interface.odes.CELL.add_pumps", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_pumps); __Pyx_XDECREF(__pyx_v_p); __Pyx_XDECREF((PyObject *)__pyx_v_pump_c); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
0874: cdef object pumps, p
+0875: pumps = list(self.py_cell.pumps)
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->py_cell, __pyx_n_s_pumps); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 875, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PySequence_List(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 875, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_pumps = __pyx_t_2; __pyx_t_2 = 0;
+0876: self.cell_s.genome.nr_pumps = len(pumps)
__pyx_t_3 = PyObject_Length(__pyx_v_pumps); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(0, 876, __pyx_L1_error)
__pyx_v_self->cell_s.genome.nr_pumps = __pyx_t_3;
+0877: self.cell_s.genome.pumps = <pump_str **> PyMem_Malloc(self.cell_s.genome.nr_pumps
__pyx_v_self->cell_s.genome.pumps = ((struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_pump_str **)PyMem_Malloc((__pyx_v_self->cell_s.genome.nr_pumps * (sizeof(struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_pump_str *)))));
0878: * sizeof(pump_str*))
0879: cdef PUMP pump_c
0880: cdef int i
+0881: for i, p in enumerate(pumps):
__pyx_t_4 = 0; if (likely(PyList_CheckExact(__pyx_v_pumps)) || PyTuple_CheckExact(__pyx_v_pumps)) { __pyx_t_2 = __pyx_v_pumps; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; __pyx_t_5 = NULL; } else { __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_pumps); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 881, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 881, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_5)) { if (likely(PyList_CheckExact(__pyx_t_2))) { if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 881, __pyx_L1_error) #else __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 881, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } else { if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 881, __pyx_L1_error) #else __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 881, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } } else { __pyx_t_1 = __pyx_t_5(__pyx_t_2); if (unlikely(!__pyx_t_1)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 881, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_1); } __Pyx_XDECREF_SET(__pyx_v_p, __pyx_t_1); __pyx_t_1 = 0; __pyx_v_i = __pyx_t_4; __pyx_t_4 = (__pyx_t_4 + 1); /* … */ } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+0882: pump_c = PUMP.__new__(PUMP, p, self.py_cell, env, var_map)
__pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 882, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_p); __Pyx_GIVEREF(__pyx_v_p); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_p); __Pyx_INCREF(__pyx_v_self->py_cell); __Pyx_GIVEREF(__pyx_v_self->py_cell); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_self->py_cell); __Pyx_INCREF(__pyx_v_env); __Pyx_GIVEREF(__pyx_v_env); PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_env); __Pyx_INCREF(__pyx_v_var_map); __Pyx_GIVEREF(__pyx_v_var_map); PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_var_map); __pyx_t_6 = __pyx_tp_new_15VirtualMicrobes_20cython_gsl_interface_4odes_PUMP(((PyTypeObject *)__pyx_ptype_15VirtualMicrobes_20cython_gsl_interface_4odes_PUMP), __pyx_t_1, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 882, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (!(likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_15VirtualMicrobes_20cython_gsl_interface_4odes_PUMP)))) __PYX_ERR(0, 882, __pyx_L1_error) __Pyx_XDECREF_SET(__pyx_v_pump_c, ((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_PUMP *)__pyx_t_6)); __pyx_t_6 = 0;
+0883: self.cell_s.genome.pumps[i] = (&pump_c.pump_s)
(__pyx_v_self->cell_s.genome.pumps[__pyx_v_i]) = (&__pyx_v_pump_c->pump_s);
+0884: self.pumps_c.append(pump_c)
__pyx_t_7 = __Pyx_PyObject_Append(__pyx_v_self->pumps_c, ((PyObject *)__pyx_v_pump_c)); if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(0, 884, __pyx_L1_error)
0885:
+0886: cdef add_enzymes(self, var_map):
static PyObject *__pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_4CELL_add_enzymes(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *__pyx_v_self, PyObject *__pyx_v_var_map) { PyObject *__pyx_v_enzymes = 0; PyObject *__pyx_v_e = 0; struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_ENZYME *__pyx_v_enzyme_c = 0; int __pyx_v_i; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("add_enzymes", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("VirtualMicrobes.cython_gsl_interface.odes.CELL.add_enzymes", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_enzymes); __Pyx_XDECREF(__pyx_v_e); __Pyx_XDECREF((PyObject *)__pyx_v_enzyme_c); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
0887: cdef object enzymes, e
+0888: enzymes = list(self.py_cell.enzymes)
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->py_cell, __pyx_n_s_enzymes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 888, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PySequence_List(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 888, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_enzymes = __pyx_t_2; __pyx_t_2 = 0;
+0889: self.cell_s.genome.nr_enzymes = len(enzymes)
__pyx_t_3 = PyObject_Length(__pyx_v_enzymes); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(0, 889, __pyx_L1_error)
__pyx_v_self->cell_s.genome.nr_enzymes = __pyx_t_3;
+0890: self.cell_s.genome.enzymes = <enzyme_str **> PyMem_Malloc(self.cell_s.genome.nr_enzymes
__pyx_v_self->cell_s.genome.enzymes = ((struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_enzyme_str **)PyMem_Malloc((__pyx_v_self->cell_s.genome.nr_enzymes * (sizeof(struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_enzyme_str *)))));
0891: * sizeof(enzyme_str*))
0892: cdef ENZYME enzyme_c
0893: cdef int i
+0894: for i, e in enumerate(enzymes):
__pyx_t_4 = 0; if (likely(PyList_CheckExact(__pyx_v_enzymes)) || PyTuple_CheckExact(__pyx_v_enzymes)) { __pyx_t_2 = __pyx_v_enzymes; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; __pyx_t_5 = NULL; } else { __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_enzymes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 894, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 894, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_5)) { if (likely(PyList_CheckExact(__pyx_t_2))) { if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 894, __pyx_L1_error) #else __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 894, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } else { if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 894, __pyx_L1_error) #else __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 894, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } } else { __pyx_t_1 = __pyx_t_5(__pyx_t_2); if (unlikely(!__pyx_t_1)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 894, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_1); } __Pyx_XDECREF_SET(__pyx_v_e, __pyx_t_1); __pyx_t_1 = 0; __pyx_v_i = __pyx_t_4; __pyx_t_4 = (__pyx_t_4 + 1); /* … */ } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+0895: enzyme_c = ENZYME.__new__(ENZYME, e, self.py_cell, var_map)
__pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 895, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_e); __Pyx_GIVEREF(__pyx_v_e); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_e); __Pyx_INCREF(__pyx_v_self->py_cell); __Pyx_GIVEREF(__pyx_v_self->py_cell); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_self->py_cell); __Pyx_INCREF(__pyx_v_var_map); __Pyx_GIVEREF(__pyx_v_var_map); PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_var_map); __pyx_t_6 = __pyx_tp_new_15VirtualMicrobes_20cython_gsl_interface_4odes_ENZYME(((PyTypeObject *)__pyx_ptype_15VirtualMicrobes_20cython_gsl_interface_4odes_ENZYME), __pyx_t_1, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 895, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (!(likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_15VirtualMicrobes_20cython_gsl_interface_4odes_ENZYME)))) __PYX_ERR(0, 895, __pyx_L1_error) __Pyx_XDECREF_SET(__pyx_v_enzyme_c, ((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_ENZYME *)__pyx_t_6)); __pyx_t_6 = 0;
+0896: self.cell_s.genome.enzymes[i] = (&enzyme_c.enzyme_s)
(__pyx_v_self->cell_s.genome.enzymes[__pyx_v_i]) = (&__pyx_v_enzyme_c->enzyme_s);
+0897: self.enzymes_c.append(enzyme_c)
__pyx_t_7 = __Pyx_PyObject_Append(__pyx_v_self->enzymes_c, ((PyObject *)__pyx_v_enzyme_c)); if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(0, 897, __pyx_L1_error)
0898:
+0899: cdef add_tfs(self, env, var_map):
static PyObject *__pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_4CELL_add_tfs(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *__pyx_v_self, PyObject *__pyx_v_env, PyObject *__pyx_v_var_map) { PyObject *__pyx_v_tfs = 0; PyObject *__pyx_v_t = 0; struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_TF *__pyx_v_tf_c = 0; int __pyx_v_i; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("add_tfs", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("VirtualMicrobes.cython_gsl_interface.odes.CELL.add_tfs", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_tfs); __Pyx_XDECREF(__pyx_v_t); __Pyx_XDECREF((PyObject *)__pyx_v_tf_c); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
0900: cdef object tfs, t
+0901: tfs = list(self.py_cell.tfs)
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->py_cell, __pyx_n_s_tfs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 901, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PySequence_List(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 901, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_tfs = __pyx_t_2; __pyx_t_2 = 0;
+0902: self.cell_s.genome.nr_tfs = len(tfs)
__pyx_t_3 = PyObject_Length(__pyx_v_tfs); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(0, 902, __pyx_L1_error)
__pyx_v_self->cell_s.genome.nr_tfs = __pyx_t_3;
+0903: self.cell_s.genome.tfs = <tf_str **> PyMem_Malloc(self.cell_s.genome.nr_tfs
__pyx_v_self->cell_s.genome.tfs = ((struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_tf_str **)PyMem_Malloc((__pyx_v_self->cell_s.genome.nr_tfs * (sizeof(struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_tf_str *)))));
0904: * sizeof(tf_str*))
0905: cdef TF tf_c
0906: cdef int i
+0907: for i, t in enumerate(tfs):
__pyx_t_4 = 0; if (likely(PyList_CheckExact(__pyx_v_tfs)) || PyTuple_CheckExact(__pyx_v_tfs)) { __pyx_t_2 = __pyx_v_tfs; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; __pyx_t_5 = NULL; } else { __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_tfs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 907, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 907, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_5)) { if (likely(PyList_CheckExact(__pyx_t_2))) { if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 907, __pyx_L1_error) #else __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 907, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } else { if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 907, __pyx_L1_error) #else __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 907, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } } else { __pyx_t_1 = __pyx_t_5(__pyx_t_2); if (unlikely(!__pyx_t_1)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 907, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_1); } __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_1); __pyx_t_1 = 0; __pyx_v_i = __pyx_t_4; __pyx_t_4 = (__pyx_t_4 + 1); /* … */ } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+0908: tf_c = TF.__new__(TF, t, self.py_cell, env, var_map)
__pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 908, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_t); __Pyx_GIVEREF(__pyx_v_t); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_t); __Pyx_INCREF(__pyx_v_self->py_cell); __Pyx_GIVEREF(__pyx_v_self->py_cell); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_self->py_cell); __Pyx_INCREF(__pyx_v_env); __Pyx_GIVEREF(__pyx_v_env); PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_env); __Pyx_INCREF(__pyx_v_var_map); __Pyx_GIVEREF(__pyx_v_var_map); PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_var_map); __pyx_t_6 = __pyx_tp_new_15VirtualMicrobes_20cython_gsl_interface_4odes_TF(((PyTypeObject *)__pyx_ptype_15VirtualMicrobes_20cython_gsl_interface_4odes_TF), __pyx_t_1, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 908, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (!(likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_15VirtualMicrobes_20cython_gsl_interface_4odes_TF)))) __PYX_ERR(0, 908, __pyx_L1_error) __Pyx_XDECREF_SET(__pyx_v_tf_c, ((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_TF *)__pyx_t_6)); __pyx_t_6 = 0;
+0909: self.cell_s.genome.tfs[i] = (&tf_c.tf_s)
(__pyx_v_self->cell_s.genome.tfs[__pyx_v_i]) = (&__pyx_v_tf_c->tf_s);
+0910: self.tfs_c[t] = tf_c
if (unlikely(PyObject_SetItem(__pyx_v_self->tfs_c, __pyx_v_t, ((PyObject *)__pyx_v_tf_c)) < 0)) __PYX_ERR(0, 910, __pyx_L1_error)
0911:
+0912: cdef add_small_mols(self, env, var_map):
static PyObject *__pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_4CELL_add_small_mols(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *__pyx_v_self, PyObject *__pyx_v_env, PyObject *__pyx_v_var_map) { struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_SMALL_MOL *__pyx_v_small_mol_c = 0; PyObject *__pyx_v_mol = 0; int __pyx_v_i; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("add_small_mols", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("VirtualMicrobes.cython_gsl_interface.odes.CELL.add_small_mols", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_small_mol_c); __Pyx_XDECREF(__pyx_v_mol); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
0913: cdef SMALL_MOL small_mol_c
0914: cdef double init_conc
+0915: self.cell_s.small_mols = <mol_str **> PyMem_Malloc(self.cell_s.nr_small_mols * sizeof(mol_str*))
__pyx_v_self->cell_s.small_mols = ((struct mol_str **)PyMem_Malloc((__pyx_v_self->cell_s.nr_small_mols * (sizeof(struct mol_str *)))));
0916: cdef object mol
0917: cdef int i
+0918: for i, mol in enumerate(self.py_cell.molecules["small_molecules"]):
__pyx_t_1 = 0; __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->py_cell, __pyx_n_s_molecules); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 918, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyObject_GetItem(__pyx_t_2, __pyx_n_s_small_molecules); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 918, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) { __pyx_t_2 = __pyx_t_3; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0; __pyx_t_5 = NULL; } else { __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 918, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 918, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; for (;;) { if (likely(!__pyx_t_5)) { if (likely(PyList_CheckExact(__pyx_t_2))) { if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 918, __pyx_L1_error) #else __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 918, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif } else { if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 918, __pyx_L1_error) #else __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 918, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif } } else { __pyx_t_3 = __pyx_t_5(__pyx_t_2); if (unlikely(!__pyx_t_3)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 918, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_3); } __Pyx_XDECREF_SET(__pyx_v_mol, __pyx_t_3); __pyx_t_3 = 0; __pyx_v_i = __pyx_t_1; __pyx_t_1 = (__pyx_t_1 + 1); /* … */ } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+0919: small_mol_c = SMALL_MOL.__new__(SMALL_MOL, mol, self.py_cell, var_map,
__pyx_t_3 = PyTuple_New(5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 919, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_mol); __Pyx_GIVEREF(__pyx_v_mol); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_mol); __Pyx_INCREF(__pyx_v_self->py_cell); __Pyx_GIVEREF(__pyx_v_self->py_cell); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_self->py_cell); __Pyx_INCREF(__pyx_v_var_map); __Pyx_GIVEREF(__pyx_v_var_map); PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_var_map); __Pyx_INCREF(Py_False); __Pyx_GIVEREF(Py_False); PyTuple_SET_ITEM(__pyx_t_3, 3, Py_False); __Pyx_INCREF(__pyx_v_env); __Pyx_GIVEREF(__pyx_v_env); PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_v_env); __pyx_t_6 = __pyx_tp_new_15VirtualMicrobes_20cython_gsl_interface_4odes_SMALL_MOL(((PyTypeObject *)__pyx_ptype_15VirtualMicrobes_20cython_gsl_interface_4odes_SMALL_MOL), __pyx_t_3, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 919, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (!(likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_15VirtualMicrobes_20cython_gsl_interface_4odes_SMALL_MOL)))) __PYX_ERR(0, 919, __pyx_L1_error) __Pyx_XDECREF_SET(__pyx_v_small_mol_c, ((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_SMALL_MOL *)__pyx_t_6)); __pyx_t_6 = 0;
0920: False, env)
+0921: self.cell_s.small_mols[i] = (&small_mol_c.mol_s)
(__pyx_v_self->cell_s.small_mols[__pyx_v_i]) = (&__pyx_v_small_mol_c->mol_s);
+0922: self.small_mols_c.append(small_mol_c)
__pyx_t_7 = __Pyx_PyObject_Append(__pyx_v_self->small_mols_c, ((PyObject *)__pyx_v_small_mol_c)); if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(0, 922, __pyx_L1_error)
0923:
+0924: cdef add_regulation(self):
static PyObject *__pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_4CELL_add_regulation(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *__pyx_v_self) { struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_PUMP *__pyx_v_pump_c = 0; struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_ENZYME *__pyx_v_enzyme_c = 0; struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_TF *__pyx_v_tf_c = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("add_regulation", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_9); __Pyx_AddTraceback("VirtualMicrobes.cython_gsl_interface.odes.CELL.add_regulation", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_pump_c); __Pyx_XDECREF((PyObject *)__pyx_v_enzyme_c); __Pyx_XDECREF((PyObject *)__pyx_v_tf_c); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
0925: cdef object pump, enzyme, tf
0926: cdef PUMP pump_c
0927: cdef ENZYME enzyme_c
0928: cdef TF tf_c
+0929: for pump_c in self.pumps_c:
if (likely(PyList_CheckExact(__pyx_v_self->pumps_c)) || PyTuple_CheckExact(__pyx_v_self->pumps_c)) { __pyx_t_1 = __pyx_v_self->pumps_c; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; __pyx_t_3 = NULL; } else { __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_self->pumps_c); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 929, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 929, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_3)) { if (likely(PyList_CheckExact(__pyx_t_1))) { if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 929, __pyx_L1_error) #else __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 929, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #endif } else { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 929, __pyx_L1_error) #else __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 929, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #endif } } else { __pyx_t_4 = __pyx_t_3(__pyx_t_1); if (unlikely(!__pyx_t_4)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 929, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_4); } if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_15VirtualMicrobes_20cython_gsl_interface_4odes_PUMP))))) __PYX_ERR(0, 929, __pyx_L1_error) __Pyx_XDECREF_SET(__pyx_v_pump_c, ((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_PUMP *)__pyx_t_4)); __pyx_t_4 = 0; /* … */ } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+0930: if pump_c.pump_s.gene_multiplicity > 0: # else, no longer has gene in the genome
__pyx_t_5 = ((__pyx_v_pump_c->pump_s.gene_multiplicity > 0.0) != 0); if (__pyx_t_5) { /* … */ }
+0931: pump_c.set_reg_seq(pump_c.py_pump.promoter,
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_pump_c->py_pump, __pyx_n_s_promoter); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 931, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); /* … */ __pyx_t_9 = ((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_PUMP *)__pyx_v_pump_c->__pyx_vtab)->set_reg_seq(__pyx_v_pump_c, __pyx_t_4, __pyx_t_6, __pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 931, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+0932: pump_c.py_pump.operator,
__pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_pump_c->py_pump, __pyx_n_s_operator); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 932, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6);
+0933: self.py_cell.genome,
__pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->py_cell, __pyx_n_s_genome); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 933, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7);
+0934: self.tfs_c)
__pyx_t_8 = __pyx_v_self->tfs_c;
__Pyx_INCREF(__pyx_t_8);
+0935: for enzyme_c in self.enzymes_c:
if (likely(PyList_CheckExact(__pyx_v_self->enzymes_c)) || PyTuple_CheckExact(__pyx_v_self->enzymes_c)) { __pyx_t_1 = __pyx_v_self->enzymes_c; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; __pyx_t_3 = NULL; } else { __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_self->enzymes_c); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 935, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 935, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_3)) { if (likely(PyList_CheckExact(__pyx_t_1))) { if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_9 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_9); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 935, __pyx_L1_error) #else __pyx_t_9 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 935, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); #endif } else { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_9); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 935, __pyx_L1_error) #else __pyx_t_9 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 935, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); #endif } } else { __pyx_t_9 = __pyx_t_3(__pyx_t_1); if (unlikely(!__pyx_t_9)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 935, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_9); } if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_15VirtualMicrobes_20cython_gsl_interface_4odes_ENZYME))))) __PYX_ERR(0, 935, __pyx_L1_error) __Pyx_XDECREF_SET(__pyx_v_enzyme_c, ((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_ENZYME *)__pyx_t_9)); __pyx_t_9 = 0; /* … */ } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+0936: if enzyme_c.enzyme_s.gene_multiplicity > 0:
__pyx_t_5 = ((__pyx_v_enzyme_c->enzyme_s.gene_multiplicity > 0.0) != 0); if (__pyx_t_5) { /* … */ }
+0937: enzyme_c.set_reg_seq(enzyme_c.py_enzyme.promoter,
__pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_enzyme_c->py_enzyme, __pyx_n_s_promoter); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 937, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); /* … */ __pyx_t_4 = ((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_ENZYME *)__pyx_v_enzyme_c->__pyx_vtab)->set_reg_seq(__pyx_v_enzyme_c, __pyx_t_9, __pyx_t_8, __pyx_t_7, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 937, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+0938: enzyme_c.py_enzyme.operator,
__pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_enzyme_c->py_enzyme, __pyx_n_s_operator); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 938, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8);
+0939: self.py_cell.genome,
__pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->py_cell, __pyx_n_s_genome); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 939, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7);
+0940: self.tfs_c)
__pyx_t_6 = __pyx_v_self->tfs_c;
__Pyx_INCREF(__pyx_t_6);
+0941: for tf_c in self.tfs_c.values():
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->tfs_c, __pyx_n_s_values); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 941, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_6 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) { __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); } } if (__pyx_t_6) { __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 941, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } else { __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 941, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { __pyx_t_4 = __pyx_t_1; __Pyx_INCREF(__pyx_t_4); __pyx_t_2 = 0; __pyx_t_3 = NULL; } else { __pyx_t_2 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 941, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 941, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; for (;;) { if (likely(!__pyx_t_3)) { if (likely(PyList_CheckExact(__pyx_t_4))) { if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_4)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 941, __pyx_L1_error) #else __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 941, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } else { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_4)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 941, __pyx_L1_error) #else __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 941, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } } else { __pyx_t_1 = __pyx_t_3(__pyx_t_4); if (unlikely(!__pyx_t_1)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 941, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_1); } if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_15VirtualMicrobes_20cython_gsl_interface_4odes_TF))))) __PYX_ERR(0, 941, __pyx_L1_error) __Pyx_XDECREF_SET(__pyx_v_tf_c, ((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_TF *)__pyx_t_1)); __pyx_t_1 = 0; /* … */ } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+0942: if tf_c.tf_s.gene_multiplicity > 0:
__pyx_t_5 = ((__pyx_v_tf_c->tf_s.gene_multiplicity > 0.0) != 0); if (__pyx_t_5) { /* … */ }
+0943: tf_c.set_reg_seq(tf_c.py_tf.promoter,
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_tf_c->py_tf, __pyx_n_s_promoter); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 943, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); /* … */ __pyx_t_9 = ((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_TF *)__pyx_v_tf_c->__pyx_vtab)->set_reg_seq(__pyx_v_tf_c, __pyx_t_1, __pyx_t_6, __pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 943, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+0944: tf_c.py_tf.operator,
__pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_tf_c->py_tf, __pyx_n_s_operator); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 944, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6);
+0945: self.py_cell.genome,
__pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->py_cell, __pyx_n_s_genome); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 945, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7);
+0946: self.tfs_c)
__pyx_t_8 = __pyx_v_self->tfs_c;
__Pyx_INCREF(__pyx_t_8);
0947:
+0948: cdef add_production(self, var_map):
static PyObject *__pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_4CELL_add_production(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *__pyx_v_self, PyObject *__pyx_v_var_map) { struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_building_block_str *__pyx_v_block_s; PyObject *__pyx_v_bl = 0; int __pyx_v_stoi; PyObject *__pyx_v_i = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("add_production", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_11); __Pyx_AddTraceback("VirtualMicrobes.cython_gsl_interface.odes.CELL.add_production", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_bl); __Pyx_XDECREF(__pyx_v_i); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0949: self.cell_s.production_s.nr_building_blocks = len(self.py_cell.building_blocks_dict)
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->py_cell, __pyx_n_s_building_blocks_dict); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 949, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(0, 949, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->cell_s.production_s.nr_building_blocks = __pyx_t_2;
+0950: self.cell_s.production_s.variable = var_map['cell_growth'][self.py_cell]
__pyx_t_1 = PyObject_GetItem(__pyx_v_var_map, __pyx_n_s_cell_growth); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 950, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = PyObject_GetItem(__pyx_t_1, __pyx_v_self->py_cell); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 950, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 950, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_self->cell_s.production_s.variable = __pyx_t_4;
+0951: self.cell_s.production_s.v_max = self.py_cell.v_max_growth
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->py_cell, __pyx_n_s_v_max_growth); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 951, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 951, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_self->cell_s.production_s.v_max = __pyx_t_5;
+0952: self.cell_s.production_s.energy = self.py_cell.energy_for_growth
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->py_cell, __pyx_n_s_energy_for_growth); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 952, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 952, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_self->cell_s.production_s.energy = __pyx_t_6;
+0953: self.cell_s.production_s.degr_const = self.py_cell.params.product_degradation_rate
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->py_cell, __pyx_n_s_params); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 953, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_product_degradation_rate); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 953, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 953, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->cell_s.production_s.degr_const = __pyx_t_5;
+0954: self.cell_s.production_s.building_blocks = <building_block_str**>PyMem_Malloc(self.cell_s.production_s.nr_building_blocks
__pyx_v_self->cell_s.production_s.building_blocks = ((struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_building_block_str **)PyMem_Malloc((__pyx_v_self->cell_s.production_s.nr_building_blocks * (sizeof(struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_building_block_str *)))));
0955: * sizeof(building_block_str*))
0956: cdef building_block_str * block_s
0957: cdef object bl
0958: cdef int stoi
+0959: for i, (bl, stoi) in enumerate(self.py_cell.building_blocks_dict.items()):
__Pyx_INCREF(__pyx_int_0); __pyx_t_1 = __pyx_int_0; __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->py_cell, __pyx_n_s_building_blocks_dict); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 959, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_items); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 959, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_8))) { __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8); if (likely(__pyx_t_7)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_8, function); } } if (__pyx_t_7) { __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 959, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } else { __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 959, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) { __pyx_t_8 = __pyx_t_3; __Pyx_INCREF(__pyx_t_8); __pyx_t_2 = 0; __pyx_t_9 = NULL; } else { __pyx_t_2 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 959, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 959, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; for (;;) { if (likely(!__pyx_t_9)) { if (likely(PyList_CheckExact(__pyx_t_8))) { if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_8)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_3 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 959, __pyx_L1_error) #else __pyx_t_3 = PySequence_ITEM(__pyx_t_8, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 959, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif } else { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_8)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 959, __pyx_L1_error) #else __pyx_t_3 = PySequence_ITEM(__pyx_t_8, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 959, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif } } else { __pyx_t_3 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_3)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 959, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_3); } if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) { PyObject* sequence = __pyx_t_3; #if CYTHON_COMPILING_IN_CPYTHON Py_ssize_t size = Py_SIZE(sequence); #else Py_ssize_t size = PySequence_Size(sequence); #endif if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); __PYX_ERR(0, 959, __pyx_L1_error) } #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_10 = PyTuple_GET_ITEM(sequence, 1); } else { __pyx_t_7 = PyList_GET_ITEM(sequence, 0); __pyx_t_10 = PyList_GET_ITEM(sequence, 1); } __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(__pyx_t_10); #else __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 959, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_10 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 959, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); #endif __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else { Py_ssize_t index = -1; __pyx_t_11 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 959, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_12 = Py_TYPE(__pyx_t_11)->tp_iternext; index = 0; __pyx_t_7 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_7)) goto __pyx_L5_unpacking_failed; __Pyx_GOTREF(__pyx_t_7); index = 1; __pyx_t_10 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_10)) goto __pyx_L5_unpacking_failed; __Pyx_GOTREF(__pyx_t_10); if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 2) < 0) __PYX_ERR(0, 959, __pyx_L1_error) __pyx_t_12 = NULL; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; goto __pyx_L6_unpacking_done; __pyx_L5_unpacking_failed:; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __pyx_t_12 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); __PYX_ERR(0, 959, __pyx_L1_error) __pyx_L6_unpacking_done:; } __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_10); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 959, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_XDECREF_SET(__pyx_v_bl, __pyx_t_7); __pyx_t_7 = 0; __pyx_v_stoi = __pyx_t_4; __Pyx_INCREF(__pyx_t_1); __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1); __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_t_1, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 959, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = __pyx_t_3; __pyx_t_3 = 0; /* … */ } __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+0960: block_s = <building_block_str *>PyMem_Malloc(sizeof(building_block_str))
__pyx_v_block_s = ((struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_building_block_str *)PyMem_Malloc((sizeof(struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_building_block_str))));
+0961: block_s.var = var_map["small_molecules"][self.py_cell][bl]
__pyx_t_3 = PyObject_GetItem(__pyx_v_var_map, __pyx_n_s_small_molecules); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 961, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_10 = PyObject_GetItem(__pyx_t_3, __pyx_v_self->py_cell); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 961, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_GetItem(__pyx_t_10, __pyx_v_bl); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 961, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 961, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_block_s->var = __pyx_t_4;
+0962: block_s.stoi = stoi
__pyx_v_block_s->stoi = __pyx_v_stoi;
+0963: self.cell_s.production_s.building_blocks[i] = block_s
__pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 963, __pyx_L1_error) (__pyx_v_self->cell_s.production_s.building_blocks[__pyx_t_13]) = __pyx_v_block_s;
0964:
0965:
+0966: cdef add_energy(self, var_map):
static PyObject *__pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_4CELL_add_energy(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *__pyx_v_self, PyObject *__pyx_v_var_map) { PyObject *__pyx_v_ene_mol = 0; int __pyx_v_i; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("add_energy", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("VirtualMicrobes.cython_gsl_interface.odes.CELL.add_energy", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_ene_mol); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0967: self.cell_s.energy_mols = <int*>PyMem_Malloc(self.cell_s.nr_energy_mols * sizeof(int))
__pyx_v_self->cell_s.energy_mols = ((int *)PyMem_Malloc((__pyx_v_self->cell_s.nr_energy_mols * (sizeof(int)))));
0968: cdef object ene_mol
0969: cdef int i
+0970: for i, ene_mol in enumerate(self.py_cell.energy_mols):
__pyx_t_1 = 0; __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->py_cell, __pyx_n_s_energy_mols); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 970, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) { __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0; __pyx_t_5 = NULL; } else { __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 970, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 970, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; for (;;) { if (likely(!__pyx_t_5)) { if (likely(PyList_CheckExact(__pyx_t_3))) { if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 970, __pyx_L1_error) #else __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 970, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #endif } else { if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 970, __pyx_L1_error) #else __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 970, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #endif } } else { __pyx_t_2 = __pyx_t_5(__pyx_t_3); if (unlikely(!__pyx_t_2)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 970, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_2); } __Pyx_XDECREF_SET(__pyx_v_ene_mol, __pyx_t_2); __pyx_t_2 = 0; __pyx_v_i = __pyx_t_1; __pyx_t_1 = (__pyx_t_1 + 1); /* … */ } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+0971: self.cell_s.energy_mols[i] = var_map['small_molecules'][self.py_cell][ene_mol]
__pyx_t_2 = PyObject_GetItem(__pyx_v_var_map, __pyx_n_s_small_molecules); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 971, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_6 = PyObject_GetItem(__pyx_t_2, __pyx_v_self->py_cell); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 971, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyObject_GetItem(__pyx_t_6, __pyx_v_ene_mol); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 971, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 971, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; (__pyx_v_self->cell_s.energy_mols[__pyx_v_i]) = __pyx_t_7;
0972:
0973:
0974:
+0975: cdef add_toxicity(self, var_map):
static PyObject *__pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_4CELL_add_toxicity(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *__pyx_v_self, PyObject *__pyx_v_var_map) { int __pyx_v_i; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("add_toxicity", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("VirtualMicrobes.cython_gsl_interface.odes.CELL.add_toxicity", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0976: self.cell_s.toxicity_s.nr_internal_mols = self.cell_s.nr_small_mols
__pyx_t_1 = __pyx_v_self->cell_s.nr_small_mols; __pyx_v_self->cell_s.toxicity_s.nr_internal_mols = __pyx_t_1;
+0977: self.cell_s.toxicity_s.variable = var_map['cell_toxicity'][self.py_cell]
__pyx_t_2 = PyObject_GetItem(__pyx_v_var_map, __pyx_n_s_cell_toxicity); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 977, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyObject_GetItem(__pyx_t_2, __pyx_v_self->py_cell); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 977, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 977, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_self->cell_s.toxicity_s.variable = __pyx_t_1;
+0978: self.cell_s.toxicity_s.internal_mols = <mol_str **> PyMem_Malloc(self.cell_s.toxicity_s.nr_internal_mols
__pyx_v_self->cell_s.toxicity_s.internal_mols = ((struct mol_str **)PyMem_Malloc((__pyx_v_self->cell_s.toxicity_s.nr_internal_mols * (sizeof(struct mol_str *)))));
0979: * sizeof(mol_str*))
0980: cdef int i
+0981: for i in range(self.cell_s.nr_small_mols):
__pyx_t_1 = __pyx_v_self->cell_s.nr_small_mols; for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_1; __pyx_t_4+=1) { __pyx_v_i = __pyx_t_4;
+0982: self.cell_s.toxicity_s.internal_mols[i] = self.cell_s.small_mols[i]
(__pyx_v_self->cell_s.toxicity_s.internal_mols[__pyx_v_i]) = (__pyx_v_self->cell_s.small_mols[__pyx_v_i]); }
0983:
0984:
0985:
+0986: cdef int get_toxicity_var(self):
static int __pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_4CELL_get_toxicity_var(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_toxicity_var", 0); /* … */ /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0987: return self.cell_s.toxicity_s.variable
__pyx_r = __pyx_v_self->cell_s.toxicity_s.variable; goto __pyx_L0;
0988:
+0989: cdef add_cell_size(self, var_map):
static PyObject *__pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_4CELL_add_cell_size(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *__pyx_v_self, PyObject *__pyx_v_var_map) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("add_cell_size", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("VirtualMicrobes.cython_gsl_interface.odes.CELL.add_cell_size", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0990: self.cell_s.cell_size_s.var = var_map['cell_volume'][self.py_cell]
__pyx_t_1 = PyObject_GetItem(__pyx_v_var_map, __pyx_n_s_cell_volume); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 990, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_v_self->py_cell); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 990, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 990, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_self->cell_s.cell_size_s.var = __pyx_t_3;
+0991: self.cell_s.cell_size_s.max_size = self.py_cell.max_volume
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->py_cell, __pyx_n_s_max_volume); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 991, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 991, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_self->cell_s.cell_size_s.max_size = __pyx_t_4;
+0992: self.cell_s.cell_size_s.growth_const = self.py_cell.growth_rate
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->py_cell, __pyx_n_s_growth_rate); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 992, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 992, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_self->cell_s.cell_size_s.growth_const = __pyx_t_4;
+0993: self.cell_s.cell_size_s.shrink_const = self.py_cell.shrink_rate
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->py_cell, __pyx_n_s_shrink_rate); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 993, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 993, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_self->cell_s.cell_size_s.shrink_const = __pyx_t_4;
+0994: self.cell_s.cell_size_s.growth_cost = self.py_cell.growth_cost
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->py_cell, __pyx_n_s_growth_cost); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 994, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 994, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_self->cell_s.cell_size_s.growth_cost = __pyx_t_4;
0995:
+0996: self.cell_s.cell_size_s.growth_rate = 0.
__pyx_v_self->cell_s.cell_size_s.growth_rate = 0.;
+0997: self.cell_s.cell_size_s.shrink_rate = 0.
__pyx_v_self->cell_s.cell_size_s.shrink_rate = 0.;
0998:
0999:
+1000: cdef int get_production_var(self):
static int __pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_4CELL_get_production_var(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_production_var", 0); /* … */ /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+1001: return self.cell_s.production_s.variable
__pyx_r = __pyx_v_self->cell_s.production_s.variable; goto __pyx_L0;
1002:
+1003: cdef double get_py_mol_conc(self, mol):
static double __pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_4CELL_get_py_mol_conc(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *__pyx_v_self, PyObject *__pyx_v_mol) { double __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_py_mol_conc", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_WriteUnraisable("VirtualMicrobes.cython_gsl_interface.odes.CELL.get_py_mol_conc", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+1004: return self.py_cell.get_small_mol_conc(mol)
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->py_cell, __pyx_n_s_get_small_mol_conc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1004, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } if (!__pyx_t_3) { __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_mol); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1004, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } else { __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1004, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL; __Pyx_INCREF(__pyx_v_mol); __Pyx_GIVEREF(__pyx_v_mol); PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_mol); __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1004, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1004, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_5; goto __pyx_L0;
1005:
+1006: cdef double get_py_prot_conc(self, prot):
static double __pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_4CELL_get_py_prot_conc(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *__pyx_v_self, PyObject *__pyx_v_prot) { double __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_py_prot_conc", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_WriteUnraisable("VirtualMicrobes.cython_gsl_interface.odes.CELL.get_py_prot_conc", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+1007: return self.py_cell.get_gene_prod_conc(prot)
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->py_cell, __pyx_n_s_get_gene_prod_conc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1007, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } if (!__pyx_t_3) { __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_prot); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1007, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } else { __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1007, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL; __Pyx_INCREF(__pyx_v_prot); __Pyx_GIVEREF(__pyx_v_prot); PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_prot); __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1007, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1007, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_5; goto __pyx_L0;
1008:
+1009: cdef double get_py_production(self):
static double __pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_4CELL_get_py_production(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *__pyx_v_self) { double __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_py_production", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_WriteUnraisable("VirtualMicrobes.cython_gsl_interface.odes.CELL.get_py_production", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+1010: return self.py_cell.raw_production
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->py_cell, __pyx_n_s_raw_production); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1010, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1010, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; goto __pyx_L0;
1011:
+1012: cdef double get_py_toxicity(self):
static double __pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_4CELL_get_py_toxicity(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *__pyx_v_self) { double __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_py_toxicity", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_WriteUnraisable("VirtualMicrobes.cython_gsl_interface.odes.CELL.get_py_toxicity", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+1013: return self.py_cell.toxicity
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->py_cell, __pyx_n_s_toxicity); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1013, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1013, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; goto __pyx_L0;
1014:
+1015: cdef double get_py_cell_size(self):
static double __pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_4CELL_get_py_cell_size(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *__pyx_v_self) { double __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_py_cell_size", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_WriteUnraisable("VirtualMicrobes.cython_gsl_interface.odes.CELL.get_py_cell_size", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+1016: return self.py_cell.volume
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->py_cell, __pyx_n_s_volume); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1016, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1016, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; goto __pyx_L0;
1017:
+1018: cdef int get_cell_size_var(self):
static int __pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_4CELL_get_cell_size_var(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_cell_size_var", 0); /* … */ /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+1019: return self.cell_s.cell_size_s.var
__pyx_r = __pyx_v_self->cell_s.cell_size_s.var; goto __pyx_L0;
1020:
+1021: cdef set_time_course_views(self):
static PyObject *__pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_4CELL_set_time_course_views(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *__pyx_v_self) { struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_PUMP *__pyx_v_p = 0; struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_ENZYME *__pyx_v_e = 0; struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_TF *__pyx_v_t = 0; struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_SMALL_MOL *__pyx_v_m = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_time_course_views", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __PYX_XDEC_MEMVIEW(&__pyx_t_2, 1); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("VirtualMicrobes.cython_gsl_interface.odes.CELL.set_time_course_views", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_p); __Pyx_XDECREF((PyObject *)__pyx_v_e); __Pyx_XDECREF((PyObject *)__pyx_v_t); __Pyx_XDECREF((PyObject *)__pyx_v_m); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+1022: self.cell_s.time_points = self.py_cell.time_points
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->py_cell, __pyx_n_s_time_points); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1022, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 1022, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_XDEC_MEMVIEW(&__pyx_v_self->cell_s.time_points, 0); __pyx_v_self->cell_s.time_points = __pyx_t_2; __pyx_t_2.memview = NULL; __pyx_t_2.data = NULL;
+1023: self.cell_s.toxicity_s.time_toxicity_vector = self.py_cell.toxicity_time_course
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->py_cell, __pyx_n_s_toxicity_time_course); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1023, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 1023, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_XDEC_MEMVIEW(&__pyx_v_self->cell_s.toxicity_s.time_toxicity_vector, 0); __pyx_v_self->cell_s.toxicity_s.time_toxicity_vector = __pyx_t_2; __pyx_t_2.memview = NULL; __pyx_t_2.data = NULL;
+1024: self.cell_s.cell_size_s.time_cell_size_vector = self.py_cell.cell_size_time_course
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->py_cell, __pyx_n_s_cell_size_time_course); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1024, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 1024, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_XDEC_MEMVIEW(&__pyx_v_self->cell_s.cell_size_s.time_cell_size_vector, 0); __pyx_v_self->cell_s.cell_size_s.time_cell_size_vector = __pyx_t_2; __pyx_t_2.memview = NULL; __pyx_t_2.data = NULL;
+1025: self.cell_s.production_s.time_production_vector = self.py_cell.raw_production_time_course
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->py_cell, __pyx_n_s_raw_production_time_course); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1025, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 1025, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_XDEC_MEMVIEW(&__pyx_v_self->cell_s.production_s.time_production_vector, 0); __pyx_v_self->cell_s.production_s.time_production_vector = __pyx_t_2; __pyx_t_2.memview = NULL; __pyx_t_2.data = NULL;
+1026: self.cell_s.production_s.time_pos_prod_vector = self.py_cell.pos_prod_time_course
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->py_cell, __pyx_n_s_pos_prod_time_course); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1026, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 1026, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_XDEC_MEMVIEW(&__pyx_v_self->cell_s.production_s.time_pos_prod_vector, 0); __pyx_v_self->cell_s.production_s.time_pos_prod_vector = __pyx_t_2; __pyx_t_2.memview = NULL; __pyx_t_2.data = NULL;
1027: cdef int i
1028: cdef PUMP p
1029: cdef ENZYME e
1030: cdef TF t
1031: cdef SMALL_MOL m
+1032: for p in self.pumps_c:
if (likely(PyList_CheckExact(__pyx_v_self->pumps_c)) || PyTuple_CheckExact(__pyx_v_self->pumps_c)) { __pyx_t_1 = __pyx_v_self->pumps_c; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0; __pyx_t_4 = NULL; } else { __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_self->pumps_c); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1032, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1032, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_4)) { if (likely(PyList_CheckExact(__pyx_t_1))) { if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_5 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 1032, __pyx_L1_error) #else __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1032, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); #endif } else { if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 1032, __pyx_L1_error) #else __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1032, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); #endif } } else { __pyx_t_5 = __pyx_t_4(__pyx_t_1); if (unlikely(!__pyx_t_5)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 1032, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_5); } if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_15VirtualMicrobes_20cython_gsl_interface_4odes_PUMP))))) __PYX_ERR(0, 1032, __pyx_L1_error) __Pyx_XDECREF_SET(__pyx_v_p, ((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_PUMP *)__pyx_t_5)); __pyx_t_5 = 0; /* … */ } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+1033: p.set_time_course_view(self.py_cell)
__pyx_t_5 = __pyx_v_self->py_cell; __Pyx_INCREF(__pyx_t_5); __pyx_t_6 = ((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_PUMP *)__pyx_v_p->__pyx_vtab)->set_time_course_view(__pyx_v_p, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1033, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+1034: for e in self.enzymes_c:
if (likely(PyList_CheckExact(__pyx_v_self->enzymes_c)) || PyTuple_CheckExact(__pyx_v_self->enzymes_c)) { __pyx_t_1 = __pyx_v_self->enzymes_c; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0; __pyx_t_4 = NULL; } else { __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_self->enzymes_c); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1034, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1034, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_4)) { if (likely(PyList_CheckExact(__pyx_t_1))) { if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_6 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_6); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 1034, __pyx_L1_error) #else __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1034, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); #endif } else { if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_6); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 1034, __pyx_L1_error) #else __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1034, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); #endif } } else { __pyx_t_6 = __pyx_t_4(__pyx_t_1); if (unlikely(!__pyx_t_6)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 1034, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_6); } if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_15VirtualMicrobes_20cython_gsl_interface_4odes_ENZYME))))) __PYX_ERR(0, 1034, __pyx_L1_error) __Pyx_XDECREF_SET(__pyx_v_e, ((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_ENZYME *)__pyx_t_6)); __pyx_t_6 = 0; /* … */ } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+1035: e.set_time_course_view(self.py_cell)
__pyx_t_6 = __pyx_v_self->py_cell; __Pyx_INCREF(__pyx_t_6); __pyx_t_5 = ((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_ENZYME *)__pyx_v_e->__pyx_vtab)->set_time_course_view(__pyx_v_e, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1035, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+1036: for t in self.tfs_c.values():
__pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->tfs_c, __pyx_n_s_values); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1036, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) { __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); } } if (__pyx_t_6) { __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1036, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } else { __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1036, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { __pyx_t_5 = __pyx_t_1; __Pyx_INCREF(__pyx_t_5); __pyx_t_3 = 0; __pyx_t_4 = NULL; } else { __pyx_t_3 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1036, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1036, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; for (;;) { if (likely(!__pyx_t_4)) { if (likely(PyList_CheckExact(__pyx_t_5))) { if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_5)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_1 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 1036, __pyx_L1_error) #else __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1036, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } else { if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_5)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 1036, __pyx_L1_error) #else __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1036, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } } else { __pyx_t_1 = __pyx_t_4(__pyx_t_5); if (unlikely(!__pyx_t_1)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 1036, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_1); } if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_15VirtualMicrobes_20cython_gsl_interface_4odes_TF))))) __PYX_ERR(0, 1036, __pyx_L1_error) __Pyx_XDECREF_SET(__pyx_v_t, ((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_TF *)__pyx_t_1)); __pyx_t_1 = 0; /* … */ } __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+1037: t.set_time_course_view(self.py_cell)
__pyx_t_1 = __pyx_v_self->py_cell; __Pyx_INCREF(__pyx_t_1); __pyx_t_6 = ((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_TF *)__pyx_v_t->__pyx_vtab)->set_time_course_view(__pyx_v_t, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1037, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+1038: for m in self.small_mols_c:
if (likely(PyList_CheckExact(__pyx_v_self->small_mols_c)) || PyTuple_CheckExact(__pyx_v_self->small_mols_c)) { __pyx_t_5 = __pyx_v_self->small_mols_c; __Pyx_INCREF(__pyx_t_5); __pyx_t_3 = 0; __pyx_t_4 = NULL; } else { __pyx_t_3 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_self->small_mols_c); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1038, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1038, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_4)) { if (likely(PyList_CheckExact(__pyx_t_5))) { if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_5)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_6 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_3); __Pyx_INCREF(__pyx_t_6); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 1038, __pyx_L1_error) #else __pyx_t_6 = PySequence_ITEM(__pyx_t_5, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1038, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); #endif } else { if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_5)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_3); __Pyx_INCREF(__pyx_t_6); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 1038, __pyx_L1_error) #else __pyx_t_6 = PySequence_ITEM(__pyx_t_5, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1038, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); #endif } } else { __pyx_t_6 = __pyx_t_4(__pyx_t_5); if (unlikely(!__pyx_t_6)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 1038, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_6); } if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_15VirtualMicrobes_20cython_gsl_interface_4odes_SMALL_MOL))))) __PYX_ERR(0, 1038, __pyx_L1_error) __Pyx_XDECREF_SET(__pyx_v_m, ((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_SMALL_MOL *)__pyx_t_6)); __pyx_t_6 = 0; /* … */ } __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+1039: m.set_time_course_view(self.py_cell)
__pyx_t_6 = __pyx_v_self->py_cell; __Pyx_INCREF(__pyx_t_6); __pyx_t_1 = ((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_SMALL_MOL *)__pyx_v_m->__pyx_vtab)->set_time_course_view(__pyx_v_m, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1039, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1040:
+1041: def __dealloc__(self):
/* Python wrapper */ static void __pyx_pw_15VirtualMicrobes_20cython_gsl_interface_4odes_4CELL_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ static void __pyx_pw_15VirtualMicrobes_20cython_gsl_interface_4odes_4CELL_3__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); __pyx_pf_15VirtualMicrobes_20cython_gsl_interface_4odes_4CELL_2__dealloc__(((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); } static void __pyx_pf_15VirtualMicrobes_20cython_gsl_interface_4odes_4CELL_2__dealloc__(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *__pyx_v_self) { int __pyx_v_i; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); /* … */ /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __PYX_XDEC_MEMVIEW(&__pyx_t_3, 1); __Pyx_WriteUnraisable("VirtualMicrobes.cython_gsl_interface.odes.CELL.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0); __pyx_L0:; __Pyx_RefNannyFinishContext(); }
+1042: PyMem_Free(self.cell_s.genome.pumps)
PyMem_Free(__pyx_v_self->cell_s.genome.pumps);
+1043: PyMem_Free(self.cell_s.genome.enzymes)
PyMem_Free(__pyx_v_self->cell_s.genome.enzymes);
+1044: PyMem_Free(self.cell_s.genome.tfs)
PyMem_Free(__pyx_v_self->cell_s.genome.tfs);
+1045: PyMem_Free(self.cell_s.small_mols)
PyMem_Free(__pyx_v_self->cell_s.small_mols);
+1046: PyMem_Free(self.cell_s.energy_mols)
PyMem_Free(__pyx_v_self->cell_s.energy_mols);
1047: cdef int i
+1048: for i in range(self.cell_s.production_s.nr_building_blocks):
__pyx_t_1 = __pyx_v_self->cell_s.production_s.nr_building_blocks; for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2;
+1049: PyMem_Free(self.cell_s.production_s.building_blocks[i])
PyMem_Free((__pyx_v_self->cell_s.production_s.building_blocks[__pyx_v_i]));
}
+1050: PyMem_Free(self.cell_s.production_s.building_blocks)
PyMem_Free(__pyx_v_self->cell_s.production_s.building_blocks);
+1051: PyMem_Free(self.cell_s.toxicity_s.internal_mols)
PyMem_Free(__pyx_v_self->cell_s.toxicity_s.internal_mols);
+1052: self.cell_s.time_points = None
__pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(Py_None);
if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 1052, __pyx_L1_error)
__PYX_XDEC_MEMVIEW(&__pyx_v_self->cell_s.time_points, 0);
__pyx_v_self->cell_s.time_points = __pyx_t_3;
__pyx_t_3.memview = NULL;
__pyx_t_3.data = NULL;
+1053: self.cell_s.production_s.time_production_vector = None
__pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(Py_None);
if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 1053, __pyx_L1_error)
__PYX_XDEC_MEMVIEW(&__pyx_v_self->cell_s.production_s.time_production_vector, 0);
__pyx_v_self->cell_s.production_s.time_production_vector = __pyx_t_3;
__pyx_t_3.memview = NULL;
__pyx_t_3.data = NULL;
+1054: self.cell_s.production_s.time_pos_prod_vector = None
__pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(Py_None);
if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 1054, __pyx_L1_error)
__PYX_XDEC_MEMVIEW(&__pyx_v_self->cell_s.production_s.time_pos_prod_vector, 0);
__pyx_v_self->cell_s.production_s.time_pos_prod_vector = __pyx_t_3;
__pyx_t_3.memview = NULL;
__pyx_t_3.data = NULL;
+1055: self.cell_s.production_s.time_prod_change_rate_vector = None
__pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(Py_None);
if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 1055, __pyx_L1_error)
__PYX_XDEC_MEMVIEW(&__pyx_v_self->cell_s.production_s.time_prod_change_rate_vector, 0);
__pyx_v_self->cell_s.production_s.time_prod_change_rate_vector = __pyx_t_3;
__pyx_t_3.memview = NULL;
__pyx_t_3.data = NULL;
+1056: self.cell_s.toxicity_s.time_toxicity_vector = None
__pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(Py_None);
if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 1056, __pyx_L1_error)
__PYX_XDEC_MEMVIEW(&__pyx_v_self->cell_s.toxicity_s.time_toxicity_vector, 0);
__pyx_v_self->cell_s.toxicity_s.time_toxicity_vector = __pyx_t_3;
__pyx_t_3.memview = NULL;
__pyx_t_3.data = NULL;
+1057: self.cell_s.toxicity_s.time_tox_change_rate_vector = None
__pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(Py_None);
if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 1057, __pyx_L1_error)
__PYX_XDEC_MEMVIEW(&__pyx_v_self->cell_s.toxicity_s.time_tox_change_rate_vector, 0);
__pyx_v_self->cell_s.toxicity_s.time_tox_change_rate_vector = __pyx_t_3;
__pyx_t_3.memview = NULL;
__pyx_t_3.data = NULL;
+1058: self.cell_s.cell_size_s.time_cell_size_vector = None
__pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(Py_None);
if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 1058, __pyx_L1_error)
__PYX_XDEC_MEMVIEW(&__pyx_v_self->cell_s.cell_size_s.time_cell_size_vector, 0);
__pyx_v_self->cell_s.cell_size_s.time_cell_size_vector = __pyx_t_3;
__pyx_t_3.memview = NULL;
__pyx_t_3.data = NULL;
+1059: self.cell_s.cell_size_s.time_csize_change_rate_vector = None
__pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(Py_None);
if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 1059, __pyx_L1_error)
__PYX_XDEC_MEMVIEW(&__pyx_v_self->cell_s.cell_size_s.time_csize_change_rate_vector, 0);
__pyx_v_self->cell_s.cell_size_s.time_csize_change_rate_vector = __pyx_t_3;
__pyx_t_3.memview = NULL;
__pyx_t_3.data = NULL;
1060:
1061:
+1062: cdef class ENVIRONMENT:
struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_ENVIRONMENT { PyObject *(*add_small_mols)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_ENVIRONMENT *, PyObject *, PyObject *); double (*get_py_mol_conc)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_ENVIRONMENT *, PyObject *); PyObject *(*set_time_course_views)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_ENVIRONMENT *); }; static struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_ENVIRONMENT *__pyx_vtabptr_15VirtualMicrobes_20cython_gsl_interface_4odes_ENVIRONMENT;
+1063: def __cinit__(self, locality):
/* Python wrapper */ static int __pyx_pw_15VirtualMicrobes_20cython_gsl_interface_4odes_11ENVIRONMENT_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_15VirtualMicrobes_20cython_gsl_interface_4odes_11ENVIRONMENT_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_locality = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_locality,0}; PyObject* values[1] = {0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_locality)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 1063, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); } __pyx_v_locality = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1063, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("VirtualMicrobes.cython_gsl_interface.odes.ENVIRONMENT.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_15VirtualMicrobes_20cython_gsl_interface_4odes_11ENVIRONMENT___cinit__(((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_ENVIRONMENT *)__pyx_v_self), __pyx_v_locality); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_15VirtualMicrobes_20cython_gsl_interface_4odes_11ENVIRONMENT___cinit__(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_ENVIRONMENT *__pyx_v_self, PyObject *__pyx_v_locality) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__", 0); /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("VirtualMicrobes.cython_gsl_interface.odes.ENVIRONMENT.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+1064: self.py_env = locality
__Pyx_INCREF(__pyx_v_locality); __Pyx_GIVEREF(__pyx_v_locality); __Pyx_GOTREF(__pyx_v_self->py_env); __Pyx_DECREF(__pyx_v_self->py_env); __pyx_v_self->py_env = __pyx_v_locality;
+1065: self.small_mols_c = collections.OrderedDict()
__pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_collections); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1065, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_OrderedDict); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1065, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_2)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } if (__pyx_t_2) { __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1065, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else { __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1065, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->small_mols_c); __Pyx_DECREF(__pyx_v_self->small_mols_c); __pyx_v_self->small_mols_c = __pyx_t_1; __pyx_t_1 = 0;
+1066: self.env_s.volume = locality.volume
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_locality, __pyx_n_s_volume); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1066, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1066, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->env_s.volume = __pyx_t_4;
+1067: self.env_s.nr_small_mols = len(self.py_env.molecules["small_molecules"])
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->py_env, __pyx_n_s_molecules); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1067, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = PyObject_GetItem(__pyx_t_1, __pyx_n_s_small_molecules); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1067, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_5 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(0, 1067, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_self->env_s.nr_small_mols = __pyx_t_5;
+1068: self.add_small_mols(locality, locality.variables_map)
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_locality, __pyx_n_s_variables_map); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1068, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = ((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_ENVIRONMENT *)__pyx_v_self->__pyx_vtab)->add_small_mols(__pyx_v_self, __pyx_v_locality, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1068, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+1069: self.set_time_course_views()
__pyx_t_1 = ((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_ENVIRONMENT *)__pyx_v_self->__pyx_vtab)->set_time_course_views(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1069, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1070:
+1071: cdef add_small_mols(self, env, var_map):
static PyObject *__pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_11ENVIRONMENT_add_small_mols(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_ENVIRONMENT *__pyx_v_self, PyObject *__pyx_v_env, PyObject *__pyx_v_var_map) { struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_SMALL_MOL *__pyx_v_small_mol_c = 0; PyObject *__pyx_v_mol = 0; int __pyx_v_i; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("add_small_mols", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("VirtualMicrobes.cython_gsl_interface.odes.ENVIRONMENT.add_small_mols", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_small_mol_c); __Pyx_XDECREF(__pyx_v_mol); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
1072: cdef SMALL_MOL small_mol_c
+1073: self.env_s.small_mols = <mol_str **> PyMem_Malloc(self.env_s.nr_small_mols * sizeof(mol_str*))
__pyx_v_self->env_s.small_mols = ((struct mol_str **)PyMem_Malloc((__pyx_v_self->env_s.nr_small_mols * (sizeof(struct mol_str *)))));
1074: cdef object mol
1075: cdef int i
+1076: for i, mol in enumerate(self.py_env.molecules["small_molecules"]):
__pyx_t_1 = 0; __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->py_env, __pyx_n_s_molecules); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1076, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyObject_GetItem(__pyx_t_2, __pyx_n_s_small_molecules); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1076, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) { __pyx_t_2 = __pyx_t_3; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0; __pyx_t_5 = NULL; } else { __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1076, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1076, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; for (;;) { if (likely(!__pyx_t_5)) { if (likely(PyList_CheckExact(__pyx_t_2))) { if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 1076, __pyx_L1_error) #else __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1076, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif } else { if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 1076, __pyx_L1_error) #else __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1076, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif } } else { __pyx_t_3 = __pyx_t_5(__pyx_t_2); if (unlikely(!__pyx_t_3)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 1076, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_3); } __Pyx_XDECREF_SET(__pyx_v_mol, __pyx_t_3); __pyx_t_3 = 0; __pyx_v_i = __pyx_t_1; __pyx_t_1 = (__pyx_t_1 + 1); /* … */ } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+1077: small_mol_c = SMALL_MOL.__new__(SMALL_MOL, mol, env, var_map)
__pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1077, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_mol); __Pyx_GIVEREF(__pyx_v_mol); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_mol); __Pyx_INCREF(__pyx_v_env); __Pyx_GIVEREF(__pyx_v_env); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_env); __Pyx_INCREF(__pyx_v_var_map); __Pyx_GIVEREF(__pyx_v_var_map); PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_var_map); __pyx_t_6 = __pyx_tp_new_15VirtualMicrobes_20cython_gsl_interface_4odes_SMALL_MOL(((PyTypeObject *)__pyx_ptype_15VirtualMicrobes_20cython_gsl_interface_4odes_SMALL_MOL), __pyx_t_3, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1077, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (!(likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_15VirtualMicrobes_20cython_gsl_interface_4odes_SMALL_MOL)))) __PYX_ERR(0, 1077, __pyx_L1_error) __Pyx_XDECREF_SET(__pyx_v_small_mol_c, ((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_SMALL_MOL *)__pyx_t_6)); __pyx_t_6 = 0;
+1078: self.env_s.small_mols[i] = (&small_mol_c.mol_s)
(__pyx_v_self->env_s.small_mols[__pyx_v_i]) = (&__pyx_v_small_mol_c->mol_s);
+1079: self.small_mols_c[mol] = small_mol_c
if (unlikely(PyObject_SetItem(__pyx_v_self->small_mols_c, __pyx_v_mol, ((PyObject *)__pyx_v_small_mol_c)) < 0)) __PYX_ERR(0, 1079, __pyx_L1_error)
1080:
+1081: cdef double get_py_mol_conc(self, mol):
static double __pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_11ENVIRONMENT_get_py_mol_conc(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_ENVIRONMENT *__pyx_v_self, PyObject *__pyx_v_mol) { double __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_py_mol_conc", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_WriteUnraisable("VirtualMicrobes.cython_gsl_interface.odes.ENVIRONMENT.get_py_mol_conc", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
1082: #return self.py_env.molecules['small_molecules'][mol].concentration
+1083: return self.py_env.get_small_mol_conc(mol)
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->py_env, __pyx_n_s_get_small_mol_conc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1083, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } if (!__pyx_t_3) { __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_mol); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1083, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } else { __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1083, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL; __Pyx_INCREF(__pyx_v_mol); __Pyx_GIVEREF(__pyx_v_mol); PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_mol); __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1083, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1083, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_5; goto __pyx_L0;
1084:
+1085: cdef set_time_course_views(self):
static PyObject *__pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_11ENVIRONMENT_set_time_course_views(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_ENVIRONMENT *__pyx_v_self) { struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_SMALL_MOL *__pyx_v_m = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_time_course_views", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __PYX_XDEC_MEMVIEW(&__pyx_t_2, 1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("VirtualMicrobes.cython_gsl_interface.odes.ENVIRONMENT.set_time_course_views", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_m); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+1086: self.env_s.nr_time_points_stored = 0
__pyx_v_self->env_s.nr_time_points_stored = 0;
+1087: self.env_s.time_points = self.py_env.time_points
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->py_env, __pyx_n_s_time_points); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1087, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 1087, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_XDEC_MEMVIEW(&__pyx_v_self->env_s.time_points, 0); __pyx_v_self->env_s.time_points = __pyx_t_2; __pyx_t_2.memview = NULL; __pyx_t_2.data = NULL;
1088: cdef SMALL_MOL m
+1089: for m in self.small_mols_c.values():
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->small_mols_c, __pyx_n_s_values); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1089, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } if (__pyx_t_4) { __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1089, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else { __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1089, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { __pyx_t_3 = __pyx_t_1; __Pyx_INCREF(__pyx_t_3); __pyx_t_5 = 0; __pyx_t_6 = NULL; } else { __pyx_t_5 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1089, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_6 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1089, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; for (;;) { if (likely(!__pyx_t_6)) { if (likely(PyList_CheckExact(__pyx_t_3))) { if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_3)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 1089, __pyx_L1_error) #else __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1089, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } else { if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_3)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 1089, __pyx_L1_error) #else __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1089, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } } else { __pyx_t_1 = __pyx_t_6(__pyx_t_3); if (unlikely(!__pyx_t_1)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 1089, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_1); } if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_15VirtualMicrobes_20cython_gsl_interface_4odes_SMALL_MOL))))) __PYX_ERR(0, 1089, __pyx_L1_error) __Pyx_XDECREF_SET(__pyx_v_m, ((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_SMALL_MOL *)__pyx_t_1)); __pyx_t_1 = 0; /* … */ } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+1090: m.set_time_course_view(self.py_env)
__pyx_t_1 = __pyx_v_self->py_env; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = ((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_SMALL_MOL *)__pyx_v_m->__pyx_vtab)->set_time_course_view(__pyx_v_m, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1090, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
1091:
+1092: def __dealloc__(self):
/* Python wrapper */ static void __pyx_pw_15VirtualMicrobes_20cython_gsl_interface_4odes_11ENVIRONMENT_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ static void __pyx_pw_15VirtualMicrobes_20cython_gsl_interface_4odes_11ENVIRONMENT_3__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); __pyx_pf_15VirtualMicrobes_20cython_gsl_interface_4odes_11ENVIRONMENT_2__dealloc__(((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_ENVIRONMENT *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); } static void __pyx_pf_15VirtualMicrobes_20cython_gsl_interface_4odes_11ENVIRONMENT_2__dealloc__(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_ENVIRONMENT *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); /* … */ /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1); __Pyx_WriteUnraisable("VirtualMicrobes.cython_gsl_interface.odes.ENVIRONMENT.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0); __pyx_L0:; __Pyx_RefNannyFinishContext(); }
+1093: PyMem_Free(self.env_s.small_mols)
PyMem_Free(__pyx_v_self->env_s.small_mols);
+1094: self.env_s.time_points = None
__pyx_t_1 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(Py_None);
if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 1094, __pyx_L1_error)
__PYX_XDEC_MEMVIEW(&__pyx_v_self->env_s.time_points, 0);
__pyx_v_self->env_s.time_points = __pyx_t_1;
__pyx_t_1.memview = NULL;
__pyx_t_1.data = NULL;
1095:
+1096: cdef class POPULATION:
struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_POPULATION { PyObject *(*set_time_course_views)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_POPULATION *); PyObject *(*update_time_course_views)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_POPULATION *); }; static struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_POPULATION *__pyx_vtabptr_15VirtualMicrobes_20cython_gsl_interface_4odes_POPULATION;
1097:
+1098: def __cinit__(self, locality, double product_scaling, double product_scaling_power):
/* Python wrapper */ static int __pyx_pw_15VirtualMicrobes_20cython_gsl_interface_4odes_10POPULATION_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_15VirtualMicrobes_20cython_gsl_interface_4odes_10POPULATION_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_locality = 0; double __pyx_v_product_scaling; double __pyx_v_product_scaling_power; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_locality,&__pyx_n_s_product_scaling,&__pyx_n_s_product_scaling_power,0}; PyObject* values[3] = {0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_locality)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_product_scaling)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, 1); __PYX_ERR(0, 1098, __pyx_L3_error) } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_product_scaling_power)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, 2); __PYX_ERR(0, 1098, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 1098, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); } __pyx_v_locality = values[0]; __pyx_v_product_scaling = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_product_scaling == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1098, __pyx_L3_error) __pyx_v_product_scaling_power = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_product_scaling_power == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1098, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1098, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("VirtualMicrobes.cython_gsl_interface.odes.POPULATION.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_15VirtualMicrobes_20cython_gsl_interface_4odes_10POPULATION___cinit__(((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_POPULATION *)__pyx_v_self), __pyx_v_locality, __pyx_v_product_scaling, __pyx_v_product_scaling_power); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_15VirtualMicrobes_20cython_gsl_interface_4odes_10POPULATION___cinit__(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_POPULATION *__pyx_v_self, PyObject *__pyx_v_locality, double __pyx_v_product_scaling, double __pyx_v_product_scaling_power) { int __pyx_v_i; struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *__pyx_v_cell_c = 0; PyObject *__pyx_v_cell = NULL; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__", 0); /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("VirtualMicrobes.cython_gsl_interface.odes.POPULATION.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_cell_c); __Pyx_XDECREF(__pyx_v_cell); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+1099: self.pop_s.nr_cells = len(locality.cells)
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_locality, __pyx_n_s_cells); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1099, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(0, 1099, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->pop_s.nr_cells = __pyx_t_2;
+1100: self.pop_s.product_scaling = product_scaling
__pyx_v_self->pop_s.product_scaling = __pyx_v_product_scaling;
+1101: self.pop_s.product_scaling_power = product_scaling_power
__pyx_v_self->pop_s.product_scaling_power = __pyx_v_product_scaling_power;
+1102: self.pop_s.cells = <cell_str **>PyMem_Malloc(self.pop_s.nr_cells * sizeof(cell_str*))
__pyx_v_self->pop_s.cells = ((struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_cell_str **)PyMem_Malloc((__pyx_v_self->pop_s.nr_cells * (sizeof(struct __pyx_t_15VirtualMicrobes_20cython_gsl_interface_4odes_cell_str *)))));
1103: cdef int i
1104: cdef CELL cell_c
+1105: self.cells_c = [] #unordered OK (?)
__pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1105, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->cells_c); __Pyx_DECREF(__pyx_v_self->cells_c); __pyx_v_self->cells_c = __pyx_t_1; __pyx_t_1 = 0;
+1106: for i, cell in enumerate(locality.cells):
__pyx_t_3 = 0; __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_locality, __pyx_n_s_cells); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1106, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { __pyx_t_4 = __pyx_t_1; __Pyx_INCREF(__pyx_t_4); __pyx_t_2 = 0; __pyx_t_5 = NULL; } else { __pyx_t_2 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1106, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1106, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; for (;;) { if (likely(!__pyx_t_5)) { if (likely(PyList_CheckExact(__pyx_t_4))) { if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_4)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 1106, __pyx_L1_error) #else __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1106, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } else { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_4)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 1106, __pyx_L1_error) #else __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1106, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } } else { __pyx_t_1 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_1)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 1106, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_1); } __Pyx_XDECREF_SET(__pyx_v_cell, __pyx_t_1); __pyx_t_1 = 0; __pyx_v_i = __pyx_t_3; __pyx_t_3 = (__pyx_t_3 + 1); /* … */ } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+1107: cell_c = CELL.__new__(CELL, cell, locality, locality.variables_map)
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_locality, __pyx_n_s_variables_map); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1107, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1107, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_INCREF(__pyx_v_cell); __Pyx_GIVEREF(__pyx_v_cell); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_cell); __Pyx_INCREF(__pyx_v_locality); __Pyx_GIVEREF(__pyx_v_locality); PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_locality); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __pyx_tp_new_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL(((PyTypeObject *)__pyx_ptype_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL), __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1107, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL)))) __PYX_ERR(0, 1107, __pyx_L1_error) __Pyx_XDECREF_SET(__pyx_v_cell_c, ((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *)__pyx_t_1)); __pyx_t_1 = 0;
+1108: self.cells_c.append(cell_c)
__pyx_t_7 = __Pyx_PyObject_Append(__pyx_v_self->cells_c, ((PyObject *)__pyx_v_cell_c)); if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(0, 1108, __pyx_L1_error)
+1109: self.pop_s.cells[i] = (&cell_c.cell_s)
(__pyx_v_self->pop_s.cells[__pyx_v_i]) = (&__pyx_v_cell_c->cell_s);
+1110: self.set_time_course_views()
__pyx_t_4 = ((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_POPULATION *)__pyx_v_self->__pyx_vtab)->set_time_course_views(__pyx_v_self); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1110, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
1111:
+1112: cdef set_time_course_views(self):
static PyObject *__pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_10POPULATION_set_time_course_views(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_POPULATION *__pyx_v_self) { struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *__pyx_v_cell_c = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_time_course_views", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("VirtualMicrobes.cython_gsl_interface.odes.POPULATION.set_time_course_views", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_cell_c); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
1113: cdef CELL cell_c
+1114: for cell_c in self.cells_c:
if (likely(PyList_CheckExact(__pyx_v_self->cells_c)) || PyTuple_CheckExact(__pyx_v_self->cells_c)) { __pyx_t_1 = __pyx_v_self->cells_c; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; __pyx_t_3 = NULL; } else { __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_self->cells_c); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1114, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1114, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_3)) { if (likely(PyList_CheckExact(__pyx_t_1))) { if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 1114, __pyx_L1_error) #else __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1114, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #endif } else { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 1114, __pyx_L1_error) #else __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1114, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #endif } } else { __pyx_t_4 = __pyx_t_3(__pyx_t_1); if (unlikely(!__pyx_t_4)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 1114, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_4); } if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL))))) __PYX_ERR(0, 1114, __pyx_L1_error) __Pyx_XDECREF_SET(__pyx_v_cell_c, ((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *)__pyx_t_4)); __pyx_t_4 = 0; /* … */ } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+1115: cell_c.set_time_course_views()
__pyx_t_4 = ((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *)__pyx_v_cell_c->__pyx_vtab)->set_time_course_views(__pyx_v_cell_c); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1115, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
1116:
+1117: cdef update_time_course_views(self):
static PyObject *__pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_10POPULATION_update_time_course_views(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_POPULATION *__pyx_v_self) { struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *__pyx_v_cell_c = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("update_time_course_views", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("VirtualMicrobes.cython_gsl_interface.odes.POPULATION.update_time_course_views", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_cell_c); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
1118: cdef CELL cell_c
+1119: for cell_c in self.cells_c:
if (likely(PyList_CheckExact(__pyx_v_self->cells_c)) || PyTuple_CheckExact(__pyx_v_self->cells_c)) { __pyx_t_1 = __pyx_v_self->cells_c; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; __pyx_t_3 = NULL; } else { __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_self->cells_c); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1119, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1119, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_3)) { if (likely(PyList_CheckExact(__pyx_t_1))) { if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 1119, __pyx_L1_error) #else __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1119, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #endif } else { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 1119, __pyx_L1_error) #else __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1119, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #endif } } else { __pyx_t_4 = __pyx_t_3(__pyx_t_1); if (unlikely(!__pyx_t_4)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 1119, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_4); } if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL))))) __PYX_ERR(0, 1119, __pyx_L1_error) __Pyx_XDECREF_SET(__pyx_v_cell_c, ((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *)__pyx_t_4)); __pyx_t_4 = 0; /* … */ } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+1120: if cell_c.py_cell.arrays_changed:
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_cell_c->py_cell, __pyx_n_s_arrays_changed); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1120, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1120, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_5) { /* … */ }
+1121: cell_c.set_time_course_views()
__pyx_t_4 = ((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *)__pyx_v_cell_c->__pyx_vtab)->set_time_course_views(__pyx_v_cell_c); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1121, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+1122: cell_c.py_cell.arrays_changed = False
if (__Pyx_PyObject_SetAttrStr(__pyx_v_cell_c->py_cell, __pyx_n_s_arrays_changed, Py_False) < 0) __PYX_ERR(0, 1122, __pyx_L1_error)
1123:
+1124: def __dealloc__(self):
/* Python wrapper */ static void __pyx_pw_15VirtualMicrobes_20cython_gsl_interface_4odes_10POPULATION_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ static void __pyx_pw_15VirtualMicrobes_20cython_gsl_interface_4odes_10POPULATION_3__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); __pyx_pf_15VirtualMicrobes_20cython_gsl_interface_4odes_10POPULATION_2__dealloc__(((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_POPULATION *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); } static void __pyx_pf_15VirtualMicrobes_20cython_gsl_interface_4odes_10POPULATION_2__dealloc__(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_POPULATION *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); /* … */ /* function exit code */ __Pyx_RefNannyFinishContext(); }
+1125: PyMem_Free(self.pop_s.cells)
PyMem_Free(__pyx_v_self->pop_s.cells);
1126:
+1127: cdef class SYSTEM:
struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_SYSTEM { void (*init_internal_vars)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_SYSTEM *); void (*init_external_vars)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_SYSTEM *); void (*update_external_vars)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_SYSTEM *); void (*update_internal_vars)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_SYSTEM *); void (*update_influxes)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_SYSTEM *); void (*update_sys)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_SYSTEM *, double, int); void (*store_nr_time_points_py)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_SYSTEM *); int (*check_sane_vals)(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_SYSTEM *); }; static struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_SYSTEM *__pyx_vtabptr_15VirtualMicrobes_20cython_gsl_interface_4odes_SYSTEM;
+1128: def __cinit__(self, locality, product_scaling, int num_threads=8):
/* Python wrapper */ static int __pyx_pw_15VirtualMicrobes_20cython_gsl_interface_4odes_6SYSTEM_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_15VirtualMicrobes_20cython_gsl_interface_4odes_6SYSTEM_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_locality = 0; PyObject *__pyx_v_product_scaling = 0; int __pyx_v_num_threads; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_locality,&__pyx_n_s_product_scaling,&__pyx_n_s_num_threads,0}; PyObject* values[3] = {0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_locality)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_product_scaling)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); __PYX_ERR(0, 1128, __pyx_L3_error) } case 2: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_num_threads); if (value) { values[2] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 1128, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[0] = PyTuple_GET_ITEM(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_locality = values[0]; __pyx_v_product_scaling = values[1]; if (values[2]) { __pyx_v_num_threads = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_num_threads == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1128, __pyx_L3_error) } else { __pyx_v_num_threads = ((int)8); } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1128, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("VirtualMicrobes.cython_gsl_interface.odes.SYSTEM.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_15VirtualMicrobes_20cython_gsl_interface_4odes_6SYSTEM___cinit__(((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_SYSTEM *)__pyx_v_self), __pyx_v_locality, __pyx_v_product_scaling, __pyx_v_num_threads); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_15VirtualMicrobes_20cython_gsl_interface_4odes_6SYSTEM___cinit__(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_SYSTEM *__pyx_v_self, PyObject *__pyx_v_locality, PyObject *__pyx_v_product_scaling, int __pyx_v_num_threads) { struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_POPULATION *__pyx_v_pop_c = 0; struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_ENVIRONMENT *__pyx_v_env_c = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__", 0); /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("VirtualMicrobes.cython_gsl_interface.odes.SYSTEM.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_pop_c); __Pyx_XDECREF((PyObject *)__pyx_v_env_c); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+1129: self.py_loc = locality
__Pyx_INCREF(__pyx_v_locality); __Pyx_GIVEREF(__pyx_v_locality); __Pyx_GOTREF(__pyx_v_self->py_loc); __Pyx_DECREF(__pyx_v_self->py_loc); __pyx_v_self->py_loc = __pyx_v_locality;
+1130: self.sys_s.dimension = locality.dimension
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_locality, __pyx_n_s_dimension); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1130, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1130, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->sys_s.dimension = __pyx_t_2;
+1131: self.sys_s.vars = <double *> PyMem_Malloc(self.sys_s.dimension * sizeof(double))
__pyx_v_self->sys_s.vars = ((double *)PyMem_Malloc((__pyx_v_self->sys_s.dimension * (sizeof(double)))));
+1132: self.sys_s.derivs = <double *> PyMem_Malloc(self.sys_s.dimension * sizeof(double))
__pyx_v_self->sys_s.derivs = ((double *)PyMem_Malloc((__pyx_v_self->sys_s.dimension * (sizeof(double)))));
+1133: self.sys_s.master_eq = master_eq_function
__pyx_v_self->sys_s.master_eq = __pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_master_eq_function;
+1134: self.sys_s.num_threads = num_threads
__pyx_v_self->sys_s.num_threads = __pyx_v_num_threads;
+1135: self.sys_s.membrane_occupancy_constant = locality.params.transporter_membrane_occupancy
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_locality, __pyx_n_s_params); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1135, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_transporter_membrane_occupancy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1135, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1135, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_self->sys_s.membrane_occupancy_constant = __pyx_t_4;
+1136: self.sys_s.volume_occupancy_constant = locality.params.enzyme_volume_occupancy
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_locality, __pyx_n_s_params); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1136, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_enzyme_volume_occupancy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1136, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1136, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->sys_s.volume_occupancy_constant = __pyx_t_4;
+1137: cdef POPULATION pop_c = POPULATION.__new__(POPULATION, locality, product_scaling,
__pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1137, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_locality); __Pyx_GIVEREF(__pyx_v_locality); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_locality); __Pyx_INCREF(__pyx_v_product_scaling); __Pyx_GIVEREF(__pyx_v_product_scaling); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_product_scaling); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __pyx_tp_new_15VirtualMicrobes_20cython_gsl_interface_4odes_POPULATION(((PyTypeObject *)__pyx_ptype_15VirtualMicrobes_20cython_gsl_interface_4odes_POPULATION), __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1137, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (!(likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_15VirtualMicrobes_20cython_gsl_interface_4odes_POPULATION)))) __PYX_ERR(0, 1137, __pyx_L1_error) __pyx_v_pop_c = ((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_POPULATION *)__pyx_t_3); __pyx_t_3 = 0;
+1138: locality.params.growth_rate_scaling)
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_locality, __pyx_n_s_params); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1138, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_growth_rate_scaling); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1138, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+1139: self.pop_c = pop_c
__Pyx_INCREF(((PyObject *)__pyx_v_pop_c)); __Pyx_GIVEREF(((PyObject *)__pyx_v_pop_c)); __Pyx_GOTREF(__pyx_v_self->pop_c); __Pyx_DECREF(__pyx_v_self->pop_c); __pyx_v_self->pop_c = ((PyObject *)__pyx_v_pop_c);
+1140: self.sys_s.population = (&pop_c.pop_s)
__pyx_v_self->sys_s.population = (&__pyx_v_pop_c->pop_s);
+1141: cdef ENVIRONMENT env_c = ENVIRONMENT.__new__(ENVIRONMENT, locality)
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1141, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_locality); __Pyx_GIVEREF(__pyx_v_locality); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_locality); __pyx_t_1 = __pyx_tp_new_15VirtualMicrobes_20cython_gsl_interface_4odes_ENVIRONMENT(((PyTypeObject *)__pyx_ptype_15VirtualMicrobes_20cython_gsl_interface_4odes_ENVIRONMENT), __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1141, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_15VirtualMicrobes_20cython_gsl_interface_4odes_ENVIRONMENT)))) __PYX_ERR(0, 1141, __pyx_L1_error) __pyx_v_env_c = ((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_ENVIRONMENT *)__pyx_t_1); __pyx_t_1 = 0;
+1142: self.env_c = env_c
__Pyx_INCREF(((PyObject *)__pyx_v_env_c)); __Pyx_GIVEREF(((PyObject *)__pyx_v_env_c)); __Pyx_GOTREF(__pyx_v_self->env_c); __Pyx_DECREF(__pyx_v_self->env_c); __pyx_v_self->env_c = ((PyObject *)__pyx_v_env_c);
+1143: self.sys_s.environment = (&env_c.env_s)
__pyx_v_self->sys_s.environment = (&__pyx_v_env_c->env_s);
+1144: self.init_internal_vars()
((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_SYSTEM *)__pyx_v_self->__pyx_vtab)->init_internal_vars(__pyx_v_self);
+1145: self.init_external_vars()
((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_SYSTEM *)__pyx_v_self->__pyx_vtab)->init_external_vars(__pyx_v_self);
1146:
+1147: cdef bint check_sane_vals(self):
static int __pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_6SYSTEM_check_sane_vals(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_SYSTEM *__pyx_v_self) { int __pyx_v_sane; int __pyx_v_i; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("check_sane_vals", 0); /* … */ /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+1148: cdef bint sane = True
__pyx_v_sane = 1;
1149: cdef int i
+1150: for i in range(self.sys_s.dimension):
__pyx_t_1 = __pyx_v_self->sys_s.dimension; for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2;
+1151: if self.sys_s.vars[i] < 0. or self.sys_s.vars[i] > 1e6:
__pyx_t_4 = (((__pyx_v_self->sys_s.vars[__pyx_v_i]) < 0.) != 0); if (!__pyx_t_4) { } else { __pyx_t_3 = __pyx_t_4; goto __pyx_L6_bool_binop_done; } __pyx_t_4 = (((__pyx_v_self->sys_s.vars[__pyx_v_i]) > 1e6) != 0); __pyx_t_3 = __pyx_t_4; __pyx_L6_bool_binop_done:; if (__pyx_t_3) { /* … */ } }
+1152: printf("var %d is not sane at %f \n", i, self.sys_s.vars[i])
printf(((char const *)"var %d is not sane at %f \n"), __pyx_v_i, (__pyx_v_self->sys_s.vars[__pyx_v_i]));
+1153: sane = False
__pyx_v_sane = 0;
+1154: return sane
__pyx_r = __pyx_v_sane; goto __pyx_L0;
1155:
+1156: cdef void init_external_vars(self):
static void __pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_6SYSTEM_init_external_vars(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_SYSTEM *__pyx_v_self) { CYTHON_UNUSED int __pyx_v_nr_vars; struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_SMALL_MOL *__pyx_v_small_mol = 0; struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_ENVIRONMENT *__pyx_v_env_c = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("init_external_vars", 0); /* … */ /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_WriteUnraisable("VirtualMicrobes.cython_gsl_interface.odes.SYSTEM.init_external_vars", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0); __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_small_mol); __Pyx_XDECREF((PyObject *)__pyx_v_env_c); __Pyx_RefNannyFinishContext(); }
+1157: cdef int nr_vars = self.sys_s.dimension
__pyx_t_1 = __pyx_v_self->sys_s.dimension; __pyx_v_nr_vars = __pyx_t_1;
1158: cdef SMALL_MOL small_mol
1159: cdef ENVIRONMENT env_c
+1160: env_c = self.env_c
if (!(likely(((__pyx_v_self->env_c) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_self->env_c, __pyx_ptype_15VirtualMicrobes_20cython_gsl_interface_4odes_ENVIRONMENT))))) __PYX_ERR(0, 1160, __pyx_L1_error) __pyx_t_2 = __pyx_v_self->env_c; __Pyx_INCREF(__pyx_t_2); __pyx_v_env_c = ((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_ENVIRONMENT *)__pyx_t_2); __pyx_t_2 = 0;
+1161: for small_mol in env_c.small_mols_c.values():
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_env_c->small_mols_c, __pyx_n_s_values); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1161, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } if (__pyx_t_4) { __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1161, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else { __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1161, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) { __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); __pyx_t_5 = 0; __pyx_t_6 = NULL; } else { __pyx_t_5 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1161, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_6 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1161, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; for (;;) { if (likely(!__pyx_t_6)) { if (likely(PyList_CheckExact(__pyx_t_3))) { if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_3)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 1161, __pyx_L1_error) #else __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1161, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #endif } else { if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_3)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 1161, __pyx_L1_error) #else __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1161, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #endif } } else { __pyx_t_2 = __pyx_t_6(__pyx_t_3); if (unlikely(!__pyx_t_2)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 1161, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_2); } if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_15VirtualMicrobes_20cython_gsl_interface_4odes_SMALL_MOL))))) __PYX_ERR(0, 1161, __pyx_L1_error) __Pyx_XDECREF_SET(__pyx_v_small_mol, ((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_SMALL_MOL *)__pyx_t_2)); __pyx_t_2 = 0; /* … */ } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+1162: self.sys_s.vars[small_mol.get_var()] = env_c.get_py_mol_conc(small_mol.py_mol)
__pyx_t_2 = __pyx_v_small_mol->py_mol; __Pyx_INCREF(__pyx_t_2); (__pyx_v_self->sys_s.vars[((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_SMALL_MOL *)__pyx_v_small_mol->__pyx_vtab)->get_var(__pyx_v_small_mol)]) = ((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_ENVIRONMENT *)__pyx_v_env_c->__pyx_vtab)->get_py_mol_conc(__pyx_v_env_c, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1163:
+1164: cdef void update_external_vars(self):
static void __pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_6SYSTEM_update_external_vars(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_SYSTEM *__pyx_v_self) { struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_ENVIRONMENT *__pyx_v_env_c = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("update_external_vars", 0); /* … */ /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_WriteUnraisable("VirtualMicrobes.cython_gsl_interface.odes.SYSTEM.update_external_vars", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0); __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_env_c); __Pyx_RefNannyFinishContext(); }
+1165: cdef ENVIRONMENT env_c = self.env_c
if (!(likely(((__pyx_v_self->env_c) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_self->env_c, __pyx_ptype_15VirtualMicrobes_20cython_gsl_interface_4odes_ENVIRONMENT))))) __PYX_ERR(0, 1165, __pyx_L1_error) __pyx_t_1 = __pyx_v_self->env_c; __Pyx_INCREF(__pyx_t_1); __pyx_v_env_c = ((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_ENVIRONMENT *)__pyx_t_1); __pyx_t_1 = 0;
+1166: if env_c.py_env.new_concentrations:
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_env_c->py_env, __pyx_n_s_new_concentrations); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1166, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1166, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { /* … */ }
+1167: self.init_external_vars()
((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_SYSTEM *)__pyx_v_self->__pyx_vtab)->init_external_vars(__pyx_v_self);
1168:
+1169: cdef void init_internal_vars(self):
static void __pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_6SYSTEM_init_internal_vars(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_SYSTEM *__pyx_v_self) { struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *__pyx_v_cell_c = 0; struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_PUMP *__pyx_v_pump = 0; struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_ENZYME *__pyx_v_enzyme = 0; struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_TF *__pyx_v_tf_c = 0; struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_SMALL_MOL *__pyx_v_small_mol = 0; PyObject *__pyx_v_py_tf = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("init_internal_vars", 0); /* … */ /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_9); __Pyx_XDECREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_11); __Pyx_WriteUnraisable("VirtualMicrobes.cython_gsl_interface.odes.SYSTEM.init_internal_vars", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0); __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_cell_c); __Pyx_XDECREF((PyObject *)__pyx_v_pump); __Pyx_XDECREF((PyObject *)__pyx_v_enzyme); __Pyx_XDECREF((PyObject *)__pyx_v_tf_c); __Pyx_XDECREF((PyObject *)__pyx_v_small_mol); __Pyx_XDECREF(__pyx_v_py_tf); __Pyx_RefNannyFinishContext(); }
1170: cdef int var
1171: cdef CELL cell_c
1172: cdef PUMP pump
1173: cdef ENZYME enzyme
1174: cdef TF tf_c
1175: cdef SMALL_MOL small_mol
+1176: for cell_c in self.pop_c.cells_c:
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->pop_c, __pyx_n_s_cells_c); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1176, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; __pyx_t_4 = NULL; } else { __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1176, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1176, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; for (;;) { if (likely(!__pyx_t_4)) { if (likely(PyList_CheckExact(__pyx_t_2))) { if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 1176, __pyx_L1_error) #else __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1176, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } else { if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 1176, __pyx_L1_error) #else __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1176, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } } else { __pyx_t_1 = __pyx_t_4(__pyx_t_2); if (unlikely(!__pyx_t_1)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 1176, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_1); } if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL))))) __PYX_ERR(0, 1176, __pyx_L1_error) __Pyx_XDECREF_SET(__pyx_v_cell_c, ((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *)__pyx_t_1)); __pyx_t_1 = 0; /* … */ } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+1177: cell_c.cell_s.nr_time_points_stored = cell_c.py_cell.nr_time_points_stored
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_cell_c->py_cell, __pyx_n_s_nr_time_points_stored); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1177, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1177, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_cell_c->cell_s.nr_time_points_stored = __pyx_t_5;
+1178: for pump in cell_c.pumps_c:
if (likely(PyList_CheckExact(__pyx_v_cell_c->pumps_c)) || PyTuple_CheckExact(__pyx_v_cell_c->pumps_c)) { __pyx_t_1 = __pyx_v_cell_c->pumps_c; __Pyx_INCREF(__pyx_t_1); __pyx_t_6 = 0; __pyx_t_7 = NULL; } else { __pyx_t_6 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_cell_c->pumps_c); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1178, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_7 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1178, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_7)) { if (likely(PyList_CheckExact(__pyx_t_1))) { if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_1)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_8 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 1178, __pyx_L1_error) #else __pyx_t_8 = PySequence_ITEM(__pyx_t_1, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1178, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); #endif } else { if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_1)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 1178, __pyx_L1_error) #else __pyx_t_8 = PySequence_ITEM(__pyx_t_1, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1178, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); #endif } } else { __pyx_t_8 = __pyx_t_7(__pyx_t_1); if (unlikely(!__pyx_t_8)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 1178, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_8); } if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_15VirtualMicrobes_20cython_gsl_interface_4odes_PUMP))))) __PYX_ERR(0, 1178, __pyx_L1_error) __Pyx_XDECREF_SET(__pyx_v_pump, ((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_PUMP *)__pyx_t_8)); __pyx_t_8 = 0; /* … */ } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+1179: self.sys_s.vars[pump.get_var()] = cell_c.get_py_prot_conc(pump.py_pump)
__pyx_t_8 = __pyx_v_pump->py_pump; __Pyx_INCREF(__pyx_t_8); (__pyx_v_self->sys_s.vars[((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_PUMP *)__pyx_v_pump->__pyx_vtab)->get_var(__pyx_v_pump)]) = ((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *)__pyx_v_cell_c->__pyx_vtab)->get_py_prot_conc(__pyx_v_cell_c, __pyx_t_8); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+1180: for enzyme in cell_c.enzymes_c:
if (likely(PyList_CheckExact(__pyx_v_cell_c->enzymes_c)) || PyTuple_CheckExact(__pyx_v_cell_c->enzymes_c)) { __pyx_t_1 = __pyx_v_cell_c->enzymes_c; __Pyx_INCREF(__pyx_t_1); __pyx_t_6 = 0; __pyx_t_7 = NULL; } else { __pyx_t_6 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_cell_c->enzymes_c); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1180, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_7 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1180, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_7)) { if (likely(PyList_CheckExact(__pyx_t_1))) { if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_1)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_8 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 1180, __pyx_L1_error) #else __pyx_t_8 = PySequence_ITEM(__pyx_t_1, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1180, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); #endif } else { if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_1)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 1180, __pyx_L1_error) #else __pyx_t_8 = PySequence_ITEM(__pyx_t_1, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1180, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); #endif } } else { __pyx_t_8 = __pyx_t_7(__pyx_t_1); if (unlikely(!__pyx_t_8)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 1180, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_8); } if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_15VirtualMicrobes_20cython_gsl_interface_4odes_ENZYME))))) __PYX_ERR(0, 1180, __pyx_L1_error) __Pyx_XDECREF_SET(__pyx_v_enzyme, ((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_ENZYME *)__pyx_t_8)); __pyx_t_8 = 0; /* … */ } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+1181: self.sys_s.vars[enzyme.get_var()] = cell_c.get_py_prot_conc(enzyme.py_enzyme)
__pyx_t_8 = __pyx_v_enzyme->py_enzyme; __Pyx_INCREF(__pyx_t_8); (__pyx_v_self->sys_s.vars[((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_ENZYME *)__pyx_v_enzyme->__pyx_vtab)->get_var(__pyx_v_enzyme)]) = ((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *)__pyx_v_cell_c->__pyx_vtab)->get_py_prot_conc(__pyx_v_cell_c, __pyx_t_8); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+1182: for py_tf, tf_c in cell_c.tfs_c.items():
__pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_cell_c->tfs_c, __pyx_n_s_items); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1182, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_9 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_8))) { __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8); if (likely(__pyx_t_9)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); __Pyx_INCREF(__pyx_t_9); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_8, function); } } if (__pyx_t_9) { __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1182, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } else { __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1182, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { __pyx_t_8 = __pyx_t_1; __Pyx_INCREF(__pyx_t_8); __pyx_t_6 = 0; __pyx_t_7 = NULL; } else { __pyx_t_6 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1182, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_7 = Py_TYPE(__pyx_t_8)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1182, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; for (;;) { if (likely(!__pyx_t_7)) { if (likely(PyList_CheckExact(__pyx_t_8))) { if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_8)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_1 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 1182, __pyx_L1_error) #else __pyx_t_1 = PySequence_ITEM(__pyx_t_8, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1182, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } else { if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_8)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 1182, __pyx_L1_error) #else __pyx_t_1 = PySequence_ITEM(__pyx_t_8, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1182, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } } else { __pyx_t_1 = __pyx_t_7(__pyx_t_8); if (unlikely(!__pyx_t_1)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 1182, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_1); } if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { PyObject* sequence = __pyx_t_1; #if CYTHON_COMPILING_IN_CPYTHON Py_ssize_t size = Py_SIZE(sequence); #else Py_ssize_t size = PySequence_Size(sequence); #endif if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); __PYX_ERR(0, 1182, __pyx_L1_error) } #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_10 = PyTuple_GET_ITEM(sequence, 1); } else { __pyx_t_9 = PyList_GET_ITEM(sequence, 0); __pyx_t_10 = PyList_GET_ITEM(sequence, 1); } __Pyx_INCREF(__pyx_t_9); __Pyx_INCREF(__pyx_t_10); #else __pyx_t_9 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1182, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_10 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1182, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } else { Py_ssize_t index = -1; __pyx_t_11 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1182, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_12 = Py_TYPE(__pyx_t_11)->tp_iternext; index = 0; __pyx_t_9 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_9)) goto __pyx_L11_unpacking_failed; __Pyx_GOTREF(__pyx_t_9); index = 1; __pyx_t_10 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_10)) goto __pyx_L11_unpacking_failed; __Pyx_GOTREF(__pyx_t_10); if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 2) < 0) __PYX_ERR(0, 1182, __pyx_L1_error) __pyx_t_12 = NULL; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; goto __pyx_L12_unpacking_done; __pyx_L11_unpacking_failed:; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __pyx_t_12 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); __PYX_ERR(0, 1182, __pyx_L1_error) __pyx_L12_unpacking_done:; } if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_15VirtualMicrobes_20cython_gsl_interface_4odes_TF))))) __PYX_ERR(0, 1182, __pyx_L1_error) __Pyx_XDECREF_SET(__pyx_v_py_tf, __pyx_t_9); __pyx_t_9 = 0; __Pyx_XDECREF_SET(__pyx_v_tf_c, ((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_TF *)__pyx_t_10)); __pyx_t_10 = 0; /* … */ } __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+1183: self.sys_s.vars[tf_c.get_var()] = cell_c.get_py_prot_conc(py_tf)
(__pyx_v_self->sys_s.vars[((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_TF *)__pyx_v_tf_c->__pyx_vtab)->get_var(__pyx_v_tf_c)]) = ((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *)__pyx_v_cell_c->__pyx_vtab)->get_py_prot_conc(__pyx_v_cell_c, __pyx_v_py_tf);
+1184: for small_mol in cell_c.small_mols_c:
if (likely(PyList_CheckExact(__pyx_v_cell_c->small_mols_c)) || PyTuple_CheckExact(__pyx_v_cell_c->small_mols_c)) { __pyx_t_8 = __pyx_v_cell_c->small_mols_c; __Pyx_INCREF(__pyx_t_8); __pyx_t_6 = 0; __pyx_t_7 = NULL; } else { __pyx_t_6 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_v_cell_c->small_mols_c); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1184, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_7 = Py_TYPE(__pyx_t_8)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1184, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_7)) { if (likely(PyList_CheckExact(__pyx_t_8))) { if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_8)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_1 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 1184, __pyx_L1_error) #else __pyx_t_1 = PySequence_ITEM(__pyx_t_8, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1184, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } else { if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_8)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 1184, __pyx_L1_error) #else __pyx_t_1 = PySequence_ITEM(__pyx_t_8, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1184, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } } else { __pyx_t_1 = __pyx_t_7(__pyx_t_8); if (unlikely(!__pyx_t_1)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 1184, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_1); } if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_15VirtualMicrobes_20cython_gsl_interface_4odes_SMALL_MOL))))) __PYX_ERR(0, 1184, __pyx_L1_error) __Pyx_XDECREF_SET(__pyx_v_small_mol, ((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_SMALL_MOL *)__pyx_t_1)); __pyx_t_1 = 0; /* … */ } __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+1185: self.sys_s.vars[small_mol.get_var()] = cell_c.get_py_mol_conc(small_mol.py_mol)
__pyx_t_1 = __pyx_v_small_mol->py_mol; __Pyx_INCREF(__pyx_t_1); (__pyx_v_self->sys_s.vars[((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_SMALL_MOL *)__pyx_v_small_mol->__pyx_vtab)->get_var(__pyx_v_small_mol)]) = ((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *)__pyx_v_cell_c->__pyx_vtab)->get_py_mol_conc(__pyx_v_cell_c, __pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+1186: self.sys_s.vars[cell_c.get_production_var()] = cell_c.get_py_production()
(__pyx_v_self->sys_s.vars[((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *)__pyx_v_cell_c->__pyx_vtab)->get_production_var(__pyx_v_cell_c)]) = ((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *)__pyx_v_cell_c->__pyx_vtab)->get_py_production(__pyx_v_cell_c);
+1187: self.sys_s.vars[cell_c.get_toxicity_var()] = cell_c.get_py_toxicity()
(__pyx_v_self->sys_s.vars[((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *)__pyx_v_cell_c->__pyx_vtab)->get_toxicity_var(__pyx_v_cell_c)]) = ((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *)__pyx_v_cell_c->__pyx_vtab)->get_py_toxicity(__pyx_v_cell_c);
+1188: self.sys_s.vars[cell_c.get_cell_size_var()] = cell_c.get_py_cell_size()
(__pyx_v_self->sys_s.vars[((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *)__pyx_v_cell_c->__pyx_vtab)->get_cell_size_var(__pyx_v_cell_c)]) = ((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *)__pyx_v_cell_c->__pyx_vtab)->get_py_cell_size(__pyx_v_cell_c);
1189:
+1190: cdef void update_internal_vars(self):
static void __pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_6SYSTEM_update_internal_vars(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_SYSTEM *__pyx_v_self) { struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *__pyx_v_cell_c = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("update_internal_vars", 0); /* … */ /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_WriteUnraisable("VirtualMicrobes.cython_gsl_interface.odes.SYSTEM.update_internal_vars", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0); __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_cell_c); __Pyx_RefNannyFinishContext(); }
1191: cdef CELL cell_c
+1192: for cell_c in self.pop_c.cells_c:
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->pop_c, __pyx_n_s_cells_c); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1192, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; __pyx_t_4 = NULL; } else { __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1192, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1192, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; for (;;) { if (likely(!__pyx_t_4)) { if (likely(PyList_CheckExact(__pyx_t_2))) { if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 1192, __pyx_L1_error) #else __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1192, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } else { if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 1192, __pyx_L1_error) #else __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1192, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } } else { __pyx_t_1 = __pyx_t_4(__pyx_t_2); if (unlikely(!__pyx_t_1)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 1192, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_1); } if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL))))) __PYX_ERR(0, 1192, __pyx_L1_error) __Pyx_XDECREF_SET(__pyx_v_cell_c, ((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *)__pyx_t_1)); __pyx_t_1 = 0; /* … */ } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+1193: if cell_c.py_cell.divided:
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_cell_c->py_cell, __pyx_n_s_divided); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1193, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1193, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_5) { /* … */ }
+1194: self.sys_s.vars[cell_c.get_cell_size_var()] = cell_c.get_py_cell_size()
(__pyx_v_self->sys_s.vars[((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *)__pyx_v_cell_c->__pyx_vtab)->get_cell_size_var(__pyx_v_cell_c)]) = ((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *)__pyx_v_cell_c->__pyx_vtab)->get_py_cell_size(__pyx_v_cell_c);
+1195: self.sys_s.vars[cell_c.get_production_var()] = cell_c.get_py_production()
(__pyx_v_self->sys_s.vars[((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *)__pyx_v_cell_c->__pyx_vtab)->get_production_var(__pyx_v_cell_c)]) = ((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *)__pyx_v_cell_c->__pyx_vtab)->get_py_production(__pyx_v_cell_c);
1196:
+1197: cdef void update_influxes(self):
static void __pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_6SYSTEM_update_influxes(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_SYSTEM *__pyx_v_self) { struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_SMALL_MOL *__pyx_v_small_mol_c = 0; CYTHON_UNUSED PyObject *__pyx_v_mol_py = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("update_influxes", 0); /* … */ /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_WriteUnraisable("VirtualMicrobes.cython_gsl_interface.odes.SYSTEM.update_influxes", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0); __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_small_mol_c); __Pyx_XDECREF(__pyx_v_mol_py); __Pyx_RefNannyFinishContext(); }
1198: cdef SMALL_MOL small_mol_c
1199: cdef object mol_py
+1200: for mol_py, small_mol_c in self.env_c.small_mols_c.items():
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->env_c, __pyx_n_s_small_mols_c); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1200, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_items); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1200, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_2)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } if (__pyx_t_2) { __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1200, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else { __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1200, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { __pyx_t_3 = __pyx_t_1; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0; __pyx_t_5 = NULL; } else { __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1200, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1200, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; for (;;) { if (likely(!__pyx_t_5)) { if (likely(PyList_CheckExact(__pyx_t_3))) { if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 1200, __pyx_L1_error) #else __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1200, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } else { if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 1200, __pyx_L1_error) #else __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1200, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } } else { __pyx_t_1 = __pyx_t_5(__pyx_t_3); if (unlikely(!__pyx_t_1)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 1200, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_1); } if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { PyObject* sequence = __pyx_t_1; #if CYTHON_COMPILING_IN_CPYTHON Py_ssize_t size = Py_SIZE(sequence); #else Py_ssize_t size = PySequence_Size(sequence); #endif if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); __PYX_ERR(0, 1200, __pyx_L1_error) } #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); } else { __pyx_t_2 = PyList_GET_ITEM(sequence, 0); __pyx_t_6 = PyList_GET_ITEM(sequence, 1); } __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(__pyx_t_6); #else __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1200, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1200, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } else { Py_ssize_t index = -1; __pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1200, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext; index = 0; __pyx_t_2 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed; __Pyx_GOTREF(__pyx_t_2); index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed; __Pyx_GOTREF(__pyx_t_6); if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 1200, __pyx_L1_error) __pyx_t_8 = NULL; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; goto __pyx_L6_unpacking_done; __pyx_L5_unpacking_failed:; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_8 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); __PYX_ERR(0, 1200, __pyx_L1_error) __pyx_L6_unpacking_done:; } if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_15VirtualMicrobes_20cython_gsl_interface_4odes_SMALL_MOL))))) __PYX_ERR(0, 1200, __pyx_L1_error) __Pyx_XDECREF_SET(__pyx_v_mol_py, __pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF_SET(__pyx_v_small_mol_c, ((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_SMALL_MOL *)__pyx_t_6)); __pyx_t_6 = 0; /* … */ } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+1201: small_mol_c.set_influx(self.env_c.py_env)
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->env_c, __pyx_n_s_py_env); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1201, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_6 = ((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_SMALL_MOL *)__pyx_v_small_mol_c->__pyx_vtab)->set_influx(__pyx_v_small_mol_c, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1201, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
1202:
+1203: cdef void update_sys(self, double product_scaling, bint reset):
static void __pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_6SYSTEM_update_sys(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_SYSTEM *__pyx_v_self, double __pyx_v_product_scaling, int __pyx_v_reset) { struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_POPULATION *__pyx_v_pop_c = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("update_sys", 0); /* … */ /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_WriteUnraisable("VirtualMicrobes.cython_gsl_interface.odes.SYSTEM.update_sys", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0); __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_pop_c); __Pyx_RefNannyFinishContext(); }
+1204: if reset:
__pyx_t_1 = (__pyx_v_reset != 0); if (__pyx_t_1) { /* … */ goto __pyx_L3; }
+1205: self.init_external_vars()
((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_SYSTEM *)__pyx_v_self->__pyx_vtab)->init_external_vars(__pyx_v_self);
+1206: self.init_internal_vars()
((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_SYSTEM *)__pyx_v_self->__pyx_vtab)->init_internal_vars(__pyx_v_self);
1207: else:
+1208: self.update_internal_vars()
/*else*/ { ((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_SYSTEM *)__pyx_v_self->__pyx_vtab)->update_internal_vars(__pyx_v_self);
+1209: self.update_external_vars()
((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_SYSTEM *)__pyx_v_self->__pyx_vtab)->update_external_vars(__pyx_v_self);
+1210: self.update_influxes()
((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_SYSTEM *)__pyx_v_self->__pyx_vtab)->update_influxes(__pyx_v_self); } __pyx_L3:;
+1211: self.sys_s.population.product_scaling = product_scaling
__pyx_v_self->sys_s.population->product_scaling = __pyx_v_product_scaling;
+1212: self.sys_s.environment.nr_time_points_stored = 0
__pyx_v_self->sys_s.environment->nr_time_points_stored = 0;
+1213: cdef POPULATION pop_c = self.pop_c
if (!(likely(((__pyx_v_self->pop_c) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_self->pop_c, __pyx_ptype_15VirtualMicrobes_20cython_gsl_interface_4odes_POPULATION))))) __PYX_ERR(0, 1213, __pyx_L1_error) __pyx_t_2 = __pyx_v_self->pop_c; __Pyx_INCREF(__pyx_t_2); __pyx_v_pop_c = ((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_POPULATION *)__pyx_t_2); __pyx_t_2 = 0;
+1214: pop_c.update_time_course_views()
__pyx_t_2 = ((struct __pyx_vtabstruct_15VirtualMicrobes_20cython_gsl_interface_4odes_POPULATION *)__pyx_v_pop_c->__pyx_vtab)->update_time_course_views(__pyx_v_pop_c); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1214, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1215: #print_vars(&self.sys_s)
1216:
+1217: cdef void store_nr_time_points_py(self):
static void __pyx_f_15VirtualMicrobes_20cython_gsl_interface_4odes_6SYSTEM_store_nr_time_points_py(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_SYSTEM *__pyx_v_self) { struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *__pyx_v_cell_c = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("store_nr_time_points_py", 0); /* … */ /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_WriteUnraisable("VirtualMicrobes.cython_gsl_interface.odes.SYSTEM.store_nr_time_points_py", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0); __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_cell_c); __Pyx_RefNannyFinishContext(); }
1218: cdef CELL cell_c
+1219: self.py_loc.nr_time_points_stored = self.sys_s.environment.nr_time_points_stored
__pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->sys_s.environment->nr_time_points_stored); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1219, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (__Pyx_PyObject_SetAttrStr(__pyx_v_self->py_loc, __pyx_n_s_nr_time_points_stored, __pyx_t_1) < 0) __PYX_ERR(0, 1219, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+1220: for cell_c in self.pop_c.cells_c:
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->pop_c, __pyx_n_s_cells_c); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1220, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; __pyx_t_4 = NULL; } else { __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1220, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1220, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; for (;;) { if (likely(!__pyx_t_4)) { if (likely(PyList_CheckExact(__pyx_t_2))) { if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 1220, __pyx_L1_error) #else __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1220, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } else { if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 1220, __pyx_L1_error) #else __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1220, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } } else { __pyx_t_1 = __pyx_t_4(__pyx_t_2); if (unlikely(!__pyx_t_1)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 1220, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_1); } if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL))))) __PYX_ERR(0, 1220, __pyx_L1_error) __Pyx_XDECREF_SET(__pyx_v_cell_c, ((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_CELL *)__pyx_t_1)); __pyx_t_1 = 0; /* … */ } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+1221: cell_c.py_cell.nr_time_points_stored = cell_c.cell_s.nr_time_points_stored
__pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_cell_c->cell_s.nr_time_points_stored); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1221, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (__Pyx_PyObject_SetAttrStr(__pyx_v_cell_c->py_cell, __pyx_n_s_nr_time_points_stored, __pyx_t_1) < 0) __PYX_ERR(0, 1221, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1222:
+1223: def __dealloc__(self):
/* Python wrapper */ static void __pyx_pw_15VirtualMicrobes_20cython_gsl_interface_4odes_6SYSTEM_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ static void __pyx_pw_15VirtualMicrobes_20cython_gsl_interface_4odes_6SYSTEM_3__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); __pyx_pf_15VirtualMicrobes_20cython_gsl_interface_4odes_6SYSTEM_2__dealloc__(((struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_SYSTEM *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); } static void __pyx_pf_15VirtualMicrobes_20cython_gsl_interface_4odes_6SYSTEM_2__dealloc__(struct __pyx_obj_15VirtualMicrobes_20cython_gsl_interface_4odes_SYSTEM *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); /* … */ /* function exit code */ __Pyx_RefNannyFinishContext(); }
+1224: PyMem_Free(self.sys_s.vars)
PyMem_Free(__pyx_v_self->sys_s.vars);
+1225: PyMem_Free(self.sys_s.derivs)
PyMem_Free(__pyx_v_self->sys_s.derivs);
1226:
+1227: if cython.compiled:
__pyx_t_2 = (1 != 0); if (__pyx_t_2) { /* … */ goto __pyx_L2; }
+1228: print "Yep, odes.pyx is compiled."
if (__Pyx_PrintOne(0, __pyx_kp_s_Yep_odes_pyx_is_compiled) < 0) __PYX_ERR(0, 1228, __pyx_L1_error)
1229: else:
+1230: print "Just a lowly interpreted script."
/*else*/ {
if (__Pyx_PrintOne(0, __pyx_kp_s_Just_a_lowly_interpreted_script) < 0) __PYX_ERR(0, 1230, __pyx_L1_error)
}
__pyx_L2:;