コード例 #1
0
from Zombie_model import * 


# import Hybrid Solver

from pyme.Hybrid_FSP import Hybrid_FSP_solver

"""
("S_1 = Zombies","S_2 = People")
* S_1 is considered stochastic 
* S_2 will be approximated by marginal distributions
"""
stoc_vector = np.array([True,False]) 

# initialising the Hybrid Solver
Zombie_solver = Hybrid_FSP_solver(Zombie_model,stoc_vector,"MRCE",1e-7)
Zombie_solver.set_initial_values(Zombie_OFSP.domain_states,Zombie_OFSP.p,t=Zombie_OFSP.t)


T = np.arange(Zombie_OFSP.t,2.0,0.1)

for t in T:
	Zombie_solver.step(t)
	Zombie_solver.print_stats

Zombie_solver.plot()




コード例 #2
0
ファイル: ViralDynamics.py プロジェクト: SysSynBio/PyME
OFSP_obj.plot()

####### Hybrid Solver Class ########

from pyme.Hybrid_FSP import Hybrid_FSP_solver

### Hybrid MRCE Computation
stoc_vector = np.array([True,False,False,True])
"""
Templetes and Virons are stochastic.
Genome and Structures are modelled by conditional / marginal expectations.
"""


MRCE_obj = Hybrid_FSP_solver(Viral_D_model,stoc_vector,"MRCE",1e-7,jac=Jac_Mat)
MRCE_obj.set_initial_values(OFSP_obj.domain_states,OFSP_obj.p,t=0.005)

for t in T:
	MRCE_obj.step(t)
	MRCE_obj.print_stats
	MRCE_obj.plot(inter=True)

### Hybrid HL Computation

HL_obj = Hybrid_FSP_solver(Viral_D_model,stoc_vector,"HL",1e-7)
HL_obj.set_initial_values(OFSP_obj.domain_states,OFSP_obj.p,t=0.005)
for t in T:
	HL_obj.step(t)
	HL_obj.print_stats
コード例 #3
0
ファイル: SIR.py プロジェクト: SysSynBio/PyME
		@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.


"""

stoc_vector = np.array([True,False])

# Evolving the density a bit forward so that we have a regular marginal.
OFSP_obj = OFSP_Solver(SIR_model,"SE1",50,1e-6)
OFSP_obj.step(0.01)

### Hybrid MRCE Computation
MRCE_obj = Hybrid_FSP_solver(SIR_model,stoc_vector,"MRCE",1e-7)
MRCE_obj.set_initial_values(OFSP_obj.domain_states,OFSP_obj.p,t=0.01)

for t in T:
	MRCE_obj.step(t)
	MRCE_obj.print_stats
	#MRCE_obj.plot(inter=True)
	MRCE_obj.check_point()
	X = np.array([[150.0,180.0],[1,2]])
	MRCE_obj.probe_states(X)

MRCE_obj.plot_checked()


### Hybrid HL Computation
from pyme.Hybrid_FSP import Hybrid_FSP_solver