Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def spark_work(model_with_parameters):
import tellurium as te
if(antimony == "antimony"):
model_roadrunner = te.loada(model_with_parameters[0])
else:
model_roadrunner = te.loadSBMLModel(model_with_parameters[0])
parameter_scan_initilisation = te.ParameterScan(model_roadrunner,**model_with_parameters[1])
simulator = getattr(parameter_scan_initilisation, function_name)
return(simulator())
def spark_sensitivity_analysis(model_with_parameters):
import tellurium as te
sa_model = model_with_parameters[0]
parameters = model_with_parameters[1]
class_name = importlib.import_module(sa_model.filename)
user_defined_simulator = getattr(class_name, dir(class_name)[0])
sa_model.simulation = user_defined_simulator()
if(sa_model.sbml):
model_roadrunner = te.loadAntimonyModel(te.sbmlToAntimony(sa_model.model))
else:
model_roadrunner = te.loadAntimonyModel(sa_model.model)
model_roadrunner.conservedMoietyAnalysis = sa_model.conservedMoietyAnalysis
#Running PreSimulation
model_roadrunner = sa_model.simulation.presimulator(model_roadrunner)
#Running Analysis
computations = {}
model_roadrunner = sa_model.simulation.simulator(model_roadrunner,computations)
_analysis = [None,None]
#Setting the Parameter Variables
def stochastic_work(model_object):
import tellurium as te
if model_type == "antimony":
model_roadrunner = te.loada(model_object.model)
else:
model_roadrunner = te.loadSBMLModel(model_object.model)
model_roadrunner.integrator = model_object.integrator
# seed the randint method with the current time
random.seed()
# it is now safe to use random.randint
model_roadrunner.setSeed(random.randint(1000, 99999))
model_roadrunner.integrator.variable_step_size = model_object.variable_step_size
model_roadrunner.reset()
simulated_data = model_roadrunner.simulate(model_object.from_time, model_object.to_time, model_object.step_points)
return([simulated_data.colnames,np.array(simulated_data)])
def spark_work(model_with_parameters):
import tellurium as te
if(antimony == "antimony"):
model_roadrunner = te.loada(model_with_parameters[0])
else:
model_roadrunner = te.loadSBMLModel(model_with_parameters[0])
parameter_scan_initilisation = te.ParameterScan(model_roadrunner,**model_with_parameters[1])
simulator = getattr(parameter_scan_initilisation, function_name)
return(simulator())
def spark_work(model_with_parameters):
import tellurium as te
if(antimony == "antimony"):
model_roadrunner = te.loada(model_with_parameters[0])
else:
model_roadrunner = te.loadSBMLModel(model_with_parameters[0])
parameter_scan_initilisation = te.ParameterScan(model_roadrunner,**model_with_parameters[1])
simulator = getattr(parameter_scan_initilisation, function_name)
return(simulator())
def stochastic_work(model_object):
import tellurium as te
if model_type == "antimony":
model_roadrunner = te.loada(model_object.model)
else:
model_roadrunner = te.loadSBMLModel(model_object.model)
model_roadrunner.integrator = model_object.integrator
# seed the randint method with the current time
random.seed()
# it is now safe to use random.randint
model_roadrunner.setSeed(random.randint(1000, 99999))
model_roadrunner.integrator.variable_step_size = model_object.variable_step_size
model_roadrunner.reset()
simulated_data = model_roadrunner.simulate(model_object.from_time, model_object.to_time, model_object.step_points)
return([simulated_data.colnames,np.array(simulated_data)])
def spark_sensitivity_analysis(model_with_parameters):
import tellurium as te
sa_model = model_with_parameters[0]
parameters = model_with_parameters[1]
class_name = importlib.import_module(sa_model.filename)
user_defined_simulator = getattr(class_name, dir(class_name)[0])
sa_model.simulation = user_defined_simulator()
if(sa_model.sbml):
model_roadrunner = te.loadAntimonyModel(te.sbmlToAntimony(sa_model.model))
else:
model_roadrunner = te.loadAntimonyModel(sa_model.model)
model_roadrunner.conservedMoietyAnalysis = sa_model.conservedMoietyAnalysis
#Running PreSimulation
model_roadrunner = sa_model.simulation.presimulator(model_roadrunner)
#Running Analysis
computations = {}
model_roadrunner = sa_model.simulation.simulator(model_roadrunner,computations)
_analysis = [None,None]
#Setting the Parameter Variables
_analysis[0] = {}
for i_param,param_names in enumerate(sa_model.bounds.keys()):