Skip to content

Commit

Permalink
Revert to calling Rcolgem within class function to address #9
Browse files Browse the repository at this point in the history
  • Loading branch information
ArtPoon committed Mar 27, 2015
1 parent e0abccf commit 9960fd8
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions rcolgem.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,13 @@

class Rcolgem ():
def __init__ (self, ncores, nreps, t0=0, fgy_resolution=500., integration_method='rk4'):
# load Rcolgem
robjects.r("require(rcolgem, quietly=TRUE)")

# default settings
robjects.globalenv['n.cores'] = ncores
robjects.globalenv['nreps'] = nreps
robjects.globalenv['fgyResolution'] = fgy_resolution
robjects.globalenv['integrationMethod'] = integration_method
robjects.globalenv['t0'] = t0


def init_SI_model (self, N=1000, beta=0.01, gamma=1/520., mu=1/3640.):
"""
Defines a susceptible-infected-recovered model in rcolgem.
Expand Down Expand Up @@ -129,6 +125,9 @@ def simulate_SI2_trees(self, params, tip_heights):
robjects.r("m <- nrow(births)")
robjects.r("maxSampleTime <- max(sampleTimes)")

# load Rcolgem package
robjects.r("require(rcolgem, quietly=TRUE)")

# solve first ODE
robjects.r("tfgy.1 <- make.fgy( t0, times[fgyRes.1], births, deaths, nonDemeDynamics, x0,"
"migrations=migrations, parms=parms, fgyResolution = fgyRes.1, "
Expand Down

0 comments on commit 9960fd8

Please sign in to comment.