T = np.arange(0.0, 0.5, 0.01) output_data = [] for isp_position in T: OFSP_catalytic.step(isp_position) OFSP_catalytic.print_stats # Prints some information of where the solver is. output_data.append(OFSP_catalytic.print_stats) """ Runtime plotting""" #OFSP_ABC.plot(inter=True) # For interactive plotting """ Check Point""" OFSP_catalytic.check_point() """ Probing """ #X = np.zeros((3,2)) #X[:,0] = [8,2,0] #X[:,1] = [7,2,1] X = np.zeros((5, 2)) X[:, 0] = [48, 2, 0, 80, 0] X[:, 1] = [47, 2, 1, 80, 0] #X[:,2] = [48,1,0,79,1] OFSP_catalytic.probe_states(X) elapsed_time = time.time() - start_time print "Time elapsed:" + ' ' + str(elapsed_time) + ' ' + "seconds" OFSP_catalytic.plot() #OFSP_catalytic.plot_contour() OFSP_catalytic.plot_checked() np.savetxt('ISPData_CatalyticOFSP.csv', np.column_stack(output_data), delimiter=',')
""" OFSP_obj = OFSP_Solver(SIR_model, 50, 1e-6, expander_name="SE1") for t in T: OFSP_obj.step(t) OFSP_obj.plot( inter=True) # Interactive mode graphs the marginal each time called. OFSP_obj.print_stats OFSP_obj.check_point() X = np.array([[150, 180], [50, 20] ]) # We can probe various states for their probabilities. OFSP_obj.probe_states( X) # Probes and stores the states of the respective time step. OFSP_obj.plot_checked() from pyme.Hybrid_FSP import Hybrid_FSP_solver """ Initialising a Hybrid solver class. Where we want to consider S to be stochastic and I to be deterministic def __init__(self,model,stoc_vector,model_name,sink_error,jac=None): @param model : model.Model. @param stoc_vector : numpy.ndarray. @param model_name : str, 'MRCE' or 'HL'. @param sink_error : float, maximum error allowed in the sink state. @param jac : (List of Functions), The jacobian of the propensity functions. """
"SE1" Simple N-step expander. validity_test : func , Validity function is by default looking for non negative states """ OFSP_obj = OFSP_Solver(SIR_model,50,1e-6,expander_name="SE1") for t in T: OFSP_obj.step(t) OFSP_obj.plot(inter=True) # Interactive mode graphs the marginal each time called. OFSP_obj.print_stats OFSP_obj.check_point() X = np.array([[150,180],[50,20]]) # We can probe various states for their probabilities. OFSP_obj.probe_states(X) # Probes and stores the states of the respective time step. OFSP_obj.plot_checked() from pyme.Hybrid_FSP import Hybrid_FSP_solver """ Initialising a Hybrid solver class. Where we want to consider S to be stochastic and I to be deterministic def __init__(self,model,stoc_vector,model_name,sink_error,jac=None): @param model : model.Model. @param stoc_vector : numpy.ndarray. @param model_name : str, 'MRCE' or 'HL'. @param sink_error : float, maximum error allowed in the sink state. @param jac : (List of Functions), The jacobian of the propensity functions.
from pyme.OFSP import OFSP_Solver # OFSP start_time = time.time() OFSP_dual_enzy_model = OFSP_Solver(dual_enzy_model,1,1e-6) T = np.arange(0.0,2.0,0.01) output_data = [] for isp_position in T: OFSP_dual_enzy_model.step(isp_position) OFSP_dual_enzy_model.print_stats output_data.append(OFSP_dual_enzy_model.print_stats) """ Check Point""" OFSP_dual_enzy_model.check_point() """ Probing """ X = np.zeros((6,2)) X[:,0] = [48,18,2,0,10,0] X[:,1] = [48,19,1,1,10,0] OFSP_dual_enzy_model.probe_states(X) elapsed_time = time.time() - start_time print "Time elapsed:" +' '+ str( elapsed_time) +' '+ "seconds" OFSP_dual_enzy_model.plot() #OFSP_dual_enzy_model.plot_contour() OFSP_dual_enzy_model.plot_checked() np.savetxt('OFSPData_dual_enzyOFSP.csv', np.column_stack(output_data), delimiter=',')
""" def validity_func(X): return np.sum(np.abs(X),axis=0) == 10 # since we started with 10 states. # The solver initialisation would look like OFSP_ABC = OFSP_Solver(ABC_model,10,1e-6,validity_test = validity_func) """ T = np.arange(0.01,1.0,0.01) for t in T: OFSP_ABC.step(t) OFSP_ABC.print_stats # Prints some information of where the solver is. """ Runtime plotting""" #OFSP_ABC.plot(inter=True) # For interactive plotting """ Check Point""" OFSP_ABC.check_point() """ Probing """ X = np.zeros((3,2)) X[:,0] = [8,2,0] X[:,1] = [7,2,1] OFSP_ABC.probe_states(X) OFSP_ABC.plot() OFSP_ABC.plot_checked()