def constants(self): """Replacing the constantVarValues attribute of scrn.Network instances, as it is buggy and does not update upon changing p in certain ways. """ return Series([var.value for var in self.constantVars], self.constantVars.keys(), dtype=np.float)
def get_dxdt(net): """Get the velocities of species dynamics, dx/dt. (Another way of getting it is N*v.) """ if not hasattr(net, 'res_function'): net.compile() # assume it is an autonomous dynamical system # (time-invariant, hence t=0 here) dxdt = net.res_function(0, net.x, np.zeros(net.xdim), net.constants) return Series(dxdt, index=net.xids)
def v(self): return Series(OD([(rxn.id, self.evaluate_expr(rxn.kineticLaw)) for rxn in self.reactions]), dtype=np.float)
def asgrules(self): return Series(OD(self.assignmentRules.items()), dtype=object)
def ratelaws(self): return Series(OD([(rxn.id, rxn.kineticLaw) for rxn in self.reactions]), dtype=object)
def rxns(self): return Series(OD([(rxn.id, rxn) for rxn in self.reactions]), dtype=object)
def varvals(self): return Series(OD([(var.id, var.value) for var in self.variables]), dtype=np.float)
def vars(self): return Series(OD(self.variables.items()), dtype=object)
def c(self): return Series(OD([(sp.id, sp.value) for sp in self.species if sp.is_constant]), dtype=np.float)
def x(self): return Series([var.value for var in self.dynamicVars], self.xids, dtype=np.float)
def p0(self): return Series([var.initialValue for var in self.optimizableVars], self.pids, dtype=np.float)
def get_J(net, *args, **kwargs): """Get steady-state flux. """ set_ss(net, *args, **kwargs) return Series(net.v.values, net.Jids)