def __init__(self, parameter_values=None): # First call the gillespy2.Model initializer. super().__init__(self) # Define parameters for the rates of creation and dissociation. k_c = gillespy2.Parameter(name='k_c', expression=0.005) k_d = gillespy2.Parameter(name='k_d', expression=0.08) self.add_parameter([k_c, k_d]) # Define variables for the molecular species representing M and D. m = gillespy2.Species(name='monomer', initial_value=30) d = gillespy2.Species(name='dimer', initial_value=0) self.add_species([m, d]) # Define the reactions representing the process. In GillesPy2, # the list of reactants and products for a Reaction object are each a # Python dictionary in which the dictionary keys are Species objects # and the values are stoichiometries of the species in the reaction. r_creation = gillespy2.Reaction(name="r_creation", rate=k_c, reactants={m: 2}, products={d: 1}) r_dissociation = gillespy2.Reaction(name="r_dissociation", rate=k_d, reactants={d: 1}, products={m: 2}) self.add_reaction([r_creation, r_dissociation]) # Set the timespan for the simulation. self.timespan(numpy.linspace(0, 100, 101))
def __init__(self, parameter_values=None): # Initialize the model. gillespy2.Model.__init__(self, name="toggle_switch") # Parameters alpha1 = gillespy2.Parameter(name='alpha1', expression=1) alpha2 = gillespy2.Parameter(name='alpha2', expression=1) beta = gillespy2.Parameter(name='beta', expression="2.0") gamma = gillespy2.Parameter(name='gamma', expression="2.0") mu = gillespy2.Parameter(name='mu', expression=1.0) self.add_parameter([alpha1, alpha2, beta, gamma, mu]) # Species U = gillespy2.Species(name='U', initial_value=10) V = gillespy2.Species(name='V', initial_value=10) self.add_species([U, V]) # Reactions cu = gillespy2.Reaction(name="r1", reactants={}, products={U: 1}, propensity_function="alpha1/(1+pow(V,beta))") cv = gillespy2.Reaction(name="r2", reactants={}, products={V: 1}, propensity_function="alpha2/(1+pow(U,gamma))") du = gillespy2.Reaction(name="r3", reactants={U: 1}, products={}, rate=mu) dv = gillespy2.Reaction(name="r4", reactants={V: 1}, products={}, rate=mu) self.add_reaction([cu, cv, du, dv]) self.timespan(np.linspace(0, 50, 101))
def __init__(self, t, s0, i0, r0, beta, gamma): # First call the gillespy2.Model initializer. gillespy2.Model.__init__(self, name='StochasticSIR') # Define parameters for the rates of creation and dissociation. k_i = gillespy2.Parameter(name='k_i', expression=beta / N) k_r = gillespy2.Parameter(name='k_r', expression=gamma) self.add_parameter([k_i, k_r]) # Define variables for the molecular species representing M and D. s = gillespy2.Species(name='S', initial_value=s0) i = gillespy2.Species(name='I', initial_value=i0) r = gillespy2.Species(name='R', initial_value=r0) self.add_species([s, i, r]) # The list of reactants and products for a Reaction object are each a # Python dictionary in which the dictionary keys are Species objects # and the values are stoichiometries of the species in the reaction. r_i = gillespy2.Reaction(name="infection", rate=k_i, reactants={ s: 1, i: 1 }, products={i: 2}) r_r = gillespy2.Reaction(name="recovery", rate=k_r, reactants={i: 1}, products={r: 1}) self.add_reaction([r_i, r_r]) # Set the timespan for the simulation. self.timespan(t)
def __init__(self, parameter_values=None, volume=1.0): # Initialize the model. gillespy2.Model.__init__(self, name="simple1", volume=volume) # Parameters k1 = gillespy2.Parameter(name='k1', expression=0.03) self.add_parameter(k1) # Species r1 = gillespy2.Species(name='r1', initial_value=100) self.add_species(r1) r2 = gillespy2.Species(name='r2', initial_value=100) self.add_species(r2) # Reactions rxn1 = gillespy2.Reaction(name='r1d', reactants={r1: 2}, products={}, rate=k1) self.add_reaction(rxn1) rxn2 = gillespy2.Reaction(name='r2d', reactants={r2: 2}, products={}, propensity_function='k1/2 * r2*(r2-1)/vol') self.add_reaction(rxn2)
def __init__(self, parameter_values=None, init_v=1): #initialize Model gillespy2.Model.__init__(self, name="Simple_Hybrid_Model") #Species A = gillespy2.Species(name='A', initial_value=init_v) V = gillespy2.Species(name='V', initial_value=init_v) self.add_species([A, V]) #parameters rate1 = gillespy2.Parameter(name='rate1', expression=20.0) rate2 = gillespy2.Parameter(name='rate2', expression=10.0) # rate_rule1 = gillespy2.RateRule(V, "cos(t)") self.add_parameter([rate1, rate2]) # self.add_rate_rule(rate_rule1) #reactions r1 = gillespy2.Reaction(name="r1", reactants={}, products={A: 1}, propensity_function="rate1 * V") r2 = gillespy2.Reaction(name="r2", reactants={A: 1}, products={}, rate=rate2) self.add_reaction([r1, r2]) self.timespan(numpy.linspace(0, 100, 101))
def test_compile_w_spaces(self): import gillespy2 self.solvers = [ gillespy2.ODECSolver, gillespy2.SSACSolver, gillespy2.TauLeapingCSolver, gillespy2.TauHybridCSolver ] # create a model model = gillespy2.Model(name="Michaelis_Menten") # parameters rate1 = gillespy2.Parameter(name='rate1', expression=0.0017) rate2 = gillespy2.Parameter(name='rate2', expression=0.5) rate3 = gillespy2.Parameter(name='rate3', expression=0.1) model.add_parameter([rate1, rate2, rate3]) # Species A = gillespy2.Species(name='A', initial_value=301) B = gillespy2.Species(name='B', initial_value=120) C = gillespy2.Species(name='C', initial_value=0) D = gillespy2.Species(name='D', initial_value=0) model.add_species([A, B, C, D]) # reactions r1 = gillespy2.Reaction(name="r1", reactants={ A: 1, B: 1 }, products={C: 1}, rate=rate1) r2 = gillespy2.Reaction(name="r2", reactants={C: 1}, products={ A: 1, B: 1 }, rate=rate2) r3 = gillespy2.Reaction(name="r3", reactants={C: 1}, products={ B: 1, D: 1 }, rate=rate3) model.add_reaction([r1, r2, r3]) model.timespan(gillespy2.TimeSpan.linspace(t=100, num_points=101)) # run the model for solver in self.solvers: with self.subTest(solver=solver.name): if platform.system() == "Windows": with self.assertRaises(gillespy2.SimulationError): model.run(solver=solver) else: result = model.run(solver=solver) self.assertTrue(gillespy2.__file__ == os.path.join( self.prefix_base_dir, 'A SPACE/gillespy2/__init__.py'))
def create_boundary_condition_test_model(parameter_values=None): model = gillespy2.Model(name="BoundaryConditionTestModel") s1 = gillespy2.Species(name="S1", boundary_condition=True, initial_value=0.001, mode='continuous') s2 = gillespy2.Species(name="S2", boundary_condition=False, initial_value=0.002, mode='continuous') s3 = gillespy2.Species(name="S3", boundary_condition=False, initial_value=0.001, mode='continuous') s4 = gillespy2.Species(name="S4", boundary_condition=True, initial_value=0.002, mode='continuous') model.add_species([s1, s2, s3, s4]) k1 = gillespy2.Parameter(name="k1", expression="0.75") k2 = gillespy2.Parameter(name="k2", expression="0.25") model.add_parameter([k1, k2]) reaction1 = gillespy2.Reaction(name="reaction1", propensity_function="vol*k1*S1*S2", reactants={s1: 1, s2: 1}, products={s3: 1}) reaction2 = gillespy2.Reaction(name="reaction2", propensity_function="vol*k2*S3", reactants={s3: 1}, products={s1: 1, s2: 1}) reaction3 = gillespy2.Reaction(name="reaction3", propensity_function="vol*k2*S3", reactants={s1: 1, s2: 2, s3: 1}, products={s4: 1}) model.add_reaction([reaction1, reaction2, reaction3]) model.timespan(numpy.linspace(0, 20, 51)) return model
def __init__(self, parameter_values=None): # Initialize the model. gillespy2.Model.__init__(self, name="simple1") # Parameters k1 = gillespy2.Parameter(name='k1', expression=parameter_values[0]) k2 = gillespy2.Parameter(name='k2', expression=parameter_values[1]) k3 = gillespy2.Parameter(name='k3', expression=parameter_values[2]) self.add_parameter([k1, k2, k3]) # Species S1 = gillespy2.Species(name='S1', initial_value=100) S2 = gillespy2.Species(name='S2', initial_value=0) self.add_species([S1, S2]) # Reactions rxn1 = gillespy2.Reaction(name='S1 production', reactants={}, products={S1: 1}, rate=k1) rxn2 = gillespy2.Reaction(name='dimer formation', reactants={S1: 2}, products={S2: 1}, rate=k2) rxn3 = gillespy2.Reaction(name='dimer degradation', reactants={S2: 1}, products={}, rate=k3) self.add_reaction([rxn1, rxn2, rxn3]) self.timespan(np.linspace(0, 100, 101))
def test_add_rate_rule_dict(self): species2 = gillespy2.Species('test_species2',initial_value=2, mode ='continuous') species3 = gillespy2.Species('test_species3',initial_value=3, mode='continuous') rule2 = gillespy2.RateRule(species2, 'cos(t)') rule3 = gillespy2.RateRule(species3, 'sin(t)') rate_rule_dict = {'rule2' :rule2, 'rule3':rule3} self.model.add_species([species2,species3]) with self.assertRaises(ParameterError): self.model.add_rate_rule(rate_rule_dict)
def __init__(self, parameter_values=None): gillespy2.Model.__init__(self, name='StochTest1') A = gillespy2.Species(name='A', initial_value=10) B = gillespy2.Species(name='B', initial_value=0) self.add_species([A, B]) k = gillespy2.Parameter(name='k', expression=10) self.add_parameter([k]) r = gillespy2.Reaction(name='r', reactants={A: 2}, products={B:1}, rate=k) self.add_reaction([r]) self.timespan(np.linspace(0, 100, 101))
def create_stoch_test_1(parameter_values=None): model = gillespy2.Model(name='StochTest1') A = gillespy2.Species(name='A', initial_value=10) B = gillespy2.Species(name='B', initial_value=0) model.add_species([A, B]) k = gillespy2.Parameter(name='k', expression=10) model.add_parameter([k]) r = gillespy2.Reaction(name='r', reactants={A: 2}, products={B: 1}, rate=k) model.add_reaction([r]) model.timespan(np.linspace(0, 100, 101)) return model
def create_truncated_state_model(parameter_values=None): model = gillespy2.Model(name="TruncatedStateModel") S1 = gillespy2.Species(name="S1", initial_value=0, mode="discrete") rate = gillespy2.Species(name="rate", initial_value=0.9999, mode="continuous") model.add_species([S1, rate]) model.add_rate_rule( gillespy2.RateRule(variable="rate", formula="-1/((t+0.9999)**2)")) model.add_reaction( # Because S1 is a "discrete" species, our reaction will be marked "stochastic." gillespy2.Reaction(products={S1: 1}, propensity_function="10.0*rate")) return model
def create_stoch_test_1(parameter_values=None): model = gillespy2.Model(name='StochTest1') A = gillespy2.Species(name='A', initial_value=10) B = gillespy2.Species(name='B', initial_value=0) model.add_species([A, B]) k = gillespy2.Parameter(name='k', expression=10) model.add_parameter([k]) r = gillespy2.Reaction(name='r', reactants={A: 1}, products={B: 1}, propensity_function="k*A/vol" ) # testing if 'vol' is a pre-set variable model.add_reaction([r]) model.timespan(np.linspace(0, 100, 101)) return model
def create_protein_decay(parameter_values=None): # Instantiate Model model = gillespy2.Model(name="Protein Decay") # Define Variables (GillesPy2.Species) protein = gillespy2.Species(name='protein', initial_value=50) # Add Variables to Model model.add_species(protein) # Define Parameters decayrate = gillespy2.Parameter(name='decayrate', expression=0.05) # Add Parameters to Model model.add_parameter(decayrate) # Define Reactions reaction = gillespy2.Reaction( name="decay", rate='decayrate', reactants={'protein': 1}, products={} ) # Add Reactions to Model model.add_reaction(reaction) # Define Timespan tspan = gillespy2.TimeSpan.linspace(t=100, num_points=101) # Set Model Timespan model.timespan(tspan) return model
def __get_events(sbml_model, gillespy_model): for i in range(sbml_model.getNumEvents()): event = sbml_model.getEvent(i) gillespy_assignments = [] trigger = event.getTrigger() delay = event.getDelay() if delay is not None: delay = libsbml.formulaToL3String(delay.getMath()) expression=libsbml.formulaToL3String(trigger.getMath()) expression = expression.replace('&&', ' and ').replace('||', ' or ') initial_value = trigger.getInitialValue() persistent = trigger.getPersistent() use_values_from_trigger_time = event.getUseValuesFromTriggerTime() gillespy_trigger = gillespy2.EventTrigger(expression=expression, initial_value=initial_value, persistent=persistent) assignments = event.getListOfEventAssignments() for a in assignments: # Convert Non-Constant Parameter to Species if a.getVariable() in gillespy_model.listOfParameters: gillespy_species = gillespy2.Species(name=a.getVariable(), initial_value=gillespy_model.listOfParameters[a.getVariable()].expression, mode='continuous', allow_negative_populations=True) gillespy_model.delete_parameter(a.getVariable()) gillespy_model.add_species([gillespy_species]) gillespy_assignment = gillespy2.EventAssignment(a.getVariable(), __get_math(a.getMath())) gillespy_assignments.append(gillespy_assignment) gillespy_event = gillespy2.Event( name=event.getId(), trigger=gillespy_trigger, assignments=gillespy_assignments, delay=delay, use_values_from_trigger_time=use_values_from_trigger_time) gillespy_model.add_event(gillespy_event)
def cbsa2gillespy(cbsa_model): import gillespy2 as glp gilles = glp.Model(name="Model") k = [glp.Parameter(name='k'+str(i), expression=cbsa_model.exp_k[i]) for i in range(1,cbsa_model.exp_n_reactions)] gilles.add_parameter(k) mols = [glp.Species(name='M'+str(i), initial_value=int(cbsa_model.exp_x0[i])) for i in range(1,cbsa_model.exp_n_molecules)] gilles.add_species(mols) reactions = [] for i in range(1,cbsa_model.exp_n_reactions): reactants = list(np.where(cbsa_model.expS[:,i] < 0)[0]) reactants_sto = list(cbsa_model.expS[:,i][reactants]*-1) modifiers = list(np.where(cbsa_model.expR[:,i] > 0)[0]) modifiers_sto = list(cbsa_model.expR[:,i][modifiers]) products = list(np.where(cbsa_model.expS[:,i] > 0)[0]) products_sto = list(cbsa_model.expS[:,i][products]) reactants += modifiers reactants_sto += modifiers_sto products += modifiers products_sto += modifiers_sto reactions.append(glp.Reaction(name="R"+str(i), rate=k[i-1], reactants={mols[reactants[j]-1]:reactants_sto[j] for j in range(len(reactants))}, products={mols[products[j]-1]:products_sto[j] for j in range(len(products))} ) ) gilles.add_reaction(reactions) return gilles
def __init__(self, parameter_values=None): # First call the gillespy2.Model initializer. super().__init__(self) # Define a parameter that represents the rate of decay. decayrate = gillespy2.Parameter(name='decayrate', expression=0.05) self.add_parameter([decayrate]) # Define a molecular species representing the protein; "initial_value" # sets the number of molecules initial present of simulation. protein = gillespy2.Species(name='protein', initial_value=50) self.add_species([protein]) # Define the reaction representing the decay process. In GillesPy2, # the list of reactants and products for a Reaction object are each a # Python dictionary in which the dictionary keys are Species objects # and the values are stoichiometries of the species in the reaction. # (In this example, we have only one reactant, and no products.) The # "rate" for the Reaction object is a Parameter representing the # propensity of this reaction firing.) reaction = gillespy2.Reaction(name="decay", rate=decayrate, reactants={protein: 1}, products={}) self.add_reaction([reaction]) # Set the timespan for the simulation. self.timespan(numpy.linspace(0, 100, 101))
def create_event_test_model(parameter_values=None): model = gillespy2.Model(name='Event Test Model') model.add_species([gillespy2.Species(name='S', initial_value=0)]) model.add_parameter( gillespy2.Parameter(name='event_tracker', expression=99)) model.add_parameter( gillespy2.Parameter(name='event_tracker2', expression=0)) model.add_reaction( gillespy2.Reaction( name='r1', products={'S': 1}, rate=model.listOfParameters['event_tracker2'])) eventTrig1 = gillespy2.EventTrigger(expression='t>=2') event1 = gillespy2.Event(name='event1', trigger=eventTrig1) event1.add_assignment( gillespy2.EventAssignment(variable='event_tracker', expression='t')) eventTrig2 = gillespy2.EventTrigger( expression='t >= event_tracker + 2') event2 = gillespy2.Event(name='event2', trigger=eventTrig2) event2.add_assignment( gillespy2.EventAssignment(variable='event_tracker2', expression='t')) model.add_event([event1, event2]) return model
def test_add_rate_rule_dict(self): model = create_decay() species2 = gillespy2.Species('test_species2', initial_value=2, mode='continuous') species3 = gillespy2.Species('test_species3', initial_value=3, mode='continuous') rule2 = gillespy2.RateRule('rule2', species2, 'cos(t)') rule3 = gillespy2.RateRule(name='rule3', variable=species3, formula='sin(t)') rate_rule_dict = {'rule2': rule2, 'rule3': rule3} model.add_species([species2, species3]) with self.assertRaises(ModelError): model.add_rate_rule(rate_rule_dict)
def test_null_timeout(self): model = create_decay() species = gillespy2.Species('test_species', initial_value=1) model.add_species([species]) solver = TauHybridSolver(model=model) results = solver.run() self.assertTrue(len(results) > 0)
def test_model_add__multiple_components__in_order(self): import gillespy2 s1 = gillespy2.Species(name="s1", initial_value=29) k1 = gillespy2.Parameter(name="k1", expression=29) r1 = gillespy2.Reaction(name="r1", reactants={"s1": 1}, rate="k1") rr1 = gillespy2.RateRule(name="rr1", variable="k1", formula="29") ar1 = gillespy2.AssignmentRule(name="ar1", variable="s1", formula="29") ea = gillespy2.EventAssignment(name="ea", variable="k1", expression="29") et = gillespy2.EventTrigger(expression="t > 29") e1 = gillespy2.Event(name="e1", trigger=et, assignments=[ea]) divide = gillespy2.FunctionDefinition(name="divide", function="x / y", args=["x", "y"]) tspan = gillespy2.TimeSpan(range(100)) model = gillespy2.Model(name="Test Model") model.add([s1, k1, r1, rr1, ar1, e1, divide, tspan]) self.assertIn("ar1", model.listOfAssignmentRules) self.assertIn("e1", model.listOfEvents) self.assertIn("divide", model.listOfFunctionDefinitions) self.assertIn("k1", model.listOfParameters) self.assertIn("rr1", model.listOfRateRules) self.assertIn("r1", model.listOfReactions) self.assertIn("s1", model.listOfSpecies) self.assertEqual(tspan, model.tspan)
def test_add_rate_rule(self): model = Example() species = gillespy2.Species('test_species', initial_value=1) rule = gillespy2.RateRule(name='rr1',formula='test_species+1',variable='test_species') model.add_species([species]) model.add_rate_rule([rule]) results = model.run() self.assertEqual(results[0].solver_name, 'TauHybridSolver')
def test_add_rate_rule(self): species = gillespy2.Species('test_species', initial_value=1, mode='continuous') rule = gillespy2.RateRule(species, 'cos(t)') self.model.add_species([species]) self.model.add_rate_rule([rule]) self.model.run(solver=BasicTauHybridSolver)
def test_add_bad_expression_rate_rule_dict(self): model = create_decay() species2 = gillespy2.Species('test_species2', initial_value=2, mode='continuous') rule = gillespy2.RateRule(variable=species2, formula='') with self.assertRaises(ModelError): model.add_rate_rule(rule)
def test_math_name_overlap(self): gamma = gillespy2.Species('gamma',initial_value=2, mode='continuous') self.model.add_species([gamma]) k2 = gillespy2.Parameter(name='k2', expression=1) self.model.add_parameter([k2]) gamma_react = gillespy2.Reaction(name='gamma_react', reactants={'gamma':1}, products={}, rate=k2) self.model.add_reaction([gamma_react]) self.model.run(solver=BasicTauHybridSolver)
def create_rate_rule_test_model(parameter_values=None): model = gillespy2.Model(name="RateRuleTestModel") s1 = gillespy2.Species(name="S1", initial_value=0.015, mode='continuous') s2 = gillespy2.Species(name="S2", initial_value=0.0, mode='continuous') s3 = gillespy2.Species(name="S3", initial_value=1.0, mode='continuous') model.add_species([s1, s2, s3]) k1 = gillespy2.Parameter(name="k1", expression="1.0") model.add_parameter([k1]) rule1 = gillespy2.RateRule(name="rule1", variable="S1", formula="-k1*S1") rule2 = gillespy2.RateRule(name="rule2", variable="S2", formula="k1*S1") rule3 = gillespy2.RateRule(name="rule3", variable="S3", formula="0.015-(S1+S2)") model.add_rate_rule([rule1, rule2, rule3]) model.timespan(numpy.linspace(0, 20, 51)) return model
def convert_species(self): ''' Method to convert species from non-gillespy2 Random DNA Chemistry to the gillespy2 Random DNA Chemistry ''' gillespy2_species = [] if self.previous_gillespy2_result == None: for u, ucon in self.randomDNAChem.concentration_lookup[ 'conU'].items(): gillespy2_u = gillespy2.Species(name=u, initial_value=ucon[0]) gillespy2_species.append(gillespy2_u) for l, lcon in self.randomDNAChem.concentration_lookup[ 'conL'].items(): gillespy2_l = gillespy2.Species(name=l, initial_value=lcon[0]) gillespy2_species.append(gillespy2_l) for f, fcon in self.randomDNAChem.concentration_lookup[ 'conF'].items(): gillespy2_f = gillespy2.Species(name=f, initial_value=fcon[0]) gillespy2_species.append(gillespy2_f) for p, pcon in self.randomDNAChem.concentration_lookup[ 'conP'].items(): gillespy2_p = gillespy2.Species(name=p, initial_value=pcon[0]) gillespy2_species.append(gillespy2_p) else: for u, ucon in self.randomDNAChem.concentration_lookup[ 'conU'].items(): gillespy2_u = gillespy2.Species( name=u, initial_value=int(self.previous_gillespy2_result[u][-1])) gillespy2_species.append(gillespy2_u) for l, lcon in self.randomDNAChem.concentration_lookup[ 'conL'].items(): gillespy2_l = gillespy2.Species( name=l, initial_value=int(self.previous_gillespy2_result[l][-1])) gillespy2_species.append(gillespy2_l) for f, fcon in self.randomDNAChem.concentration_lookup[ 'conF'].items(): gillespy2_f = gillespy2.Species( name=f, initial_value=int(self.previous_gillespy2_result[f][-1])) gillespy2_species.append(gillespy2_f) for p, pcon in self.randomDNAChem.concentration_lookup[ 'conP'].items(): gillespy2_p = gillespy2.Species( name=p, initial_value=int(self.previous_gillespy2_result[p][-1])) gillespy2_species.append(gillespy2_p) self.add_species(gillespy2_species)
def __init__(self, endtime, timestep): """ Initialize the model. Parameters ---------- endtime : endtime of simulations timestep : time-step of simulations """ super().__init__( endtime=endtime, timestep=timestep, model_name="SIR", ) beta = gillespy.Parameter(name='beta', expression=self.params['beta']) gamma = gillespy.Parameter(name='gamma', expression=self.params['gamma']) self.add_parameter([beta, gamma]) # Species S = gillespy.Species(name='S', initial_value=100) I = gillespy.Species(name='I', initial_value=100) R = gillespy.Species(name='R', initial_value=100) self.add_species([S, I, R]) # Reactions infection = gillespy.Reaction( name='infection', reactants={ S: 1, I: 1 }, products={I: 2}, propensity_function='beta*S*I/(S+I+R)', ) recover = gillespy.Reaction( name='recover', reactants={I: 1}, products={R: 1}, rate=gamma, ) self.add_reaction([infection, recover]) nb_of_steps = int(math.ceil((endtime / timestep))) + 1 self.timespan(np.linspace(0, endtime, nb_of_steps))
def test_ensure_hybrid_continuous_species(self): model = create_decay() species1 = gillespy2.Species('test_species1', initial_value=1, mode='continuous') model.add_species(species1) results = model.run() valid_solvers = ('TauHybridSolver', 'TauHybridCSolver') self.assertIn(results[0].solver_name, valid_solvers)
def test_ensure_continuous_dynamic_timeout_warning(self): model = create_decay() species1 = gillespy2.Species('test_species1', initial_value=1, mode='dynamic') model.add_species(species1) with self.assertLogs('GillesPy2', level='WARN'): solver = TauHybridSolver(model=model) results = model.run(solver=solver, timeout=1)