diff --git a/rcolgem.py b/rcolgem.py index 5df7401..4b5acb6 100644 --- a/rcolgem.py +++ b/rcolgem.py @@ -2,9 +2,6 @@ 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 @@ -12,7 +9,6 @@ def __init__ (self, ncores, nreps, t0=0, fgy_resolution=500., integration_method 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. @@ -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, "