[Pomp-commits] r886 - in pkg/pomp: . R inst man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Feb 27 03:20:25 CET 2014


Author: kingaa
Date: 2014-02-27 03:20:24 +0100 (Thu, 27 Feb 2014)
New Revision: 886

Modified:
   pkg/pomp/DESCRIPTION
   pkg/pomp/R/builder.R
   pkg/pomp/R/mif.R
   pkg/pomp/inst/NEWS
   pkg/pomp/man/builder.Rd
Log:
- pompBuilder now puts files in the temporary directory
- fix error with ic.lag in 'mif'


Modified: pkg/pomp/DESCRIPTION
===================================================================
--- pkg/pomp/DESCRIPTION	2014-02-03 22:32:56 UTC (rev 885)
+++ pkg/pomp/DESCRIPTION	2014-02-27 02:20:24 UTC (rev 886)
@@ -1,8 +1,8 @@
 Package: pomp
 Type: Package
 Title: Statistical inference for partially observed Markov processes
-Version: 0.47-1
-Date: 2014-02-02
+Version: 0.47-2
+Date: 2014-02-26
 Authors at R: c(person(given=c("Aaron","A."),family="King",
 		role=c("aut","cre"),email="kingaa at umich.edu"),
 	  person(given=c("Edward","L."),family="Ionides",role=c("aut")),

Modified: pkg/pomp/R/builder.R
===================================================================
--- pkg/pomp/R/builder.R	2014-02-03 22:32:56 UTC (rev 885)
+++ pkg/pomp/R/builder.R	2014-02-27 02:20:24 UTC (rev 886)
@@ -24,7 +24,7 @@
                          rmeasure, dmeasure, step.fn, step.fn.delta.t,
                          skeleton, skeleton.type, skelmap.delta.t = 1,
                          parameter.transform, parameter.inv.transform,
-                         ..., link = TRUE) {
+                         ..., link = TRUE, save = FALSE) {
   if (!is.data.frame(data)) stop(sQuote("data")," must be a data-frame")
   obsnames <- names(data)
   obsnames <- setdiff(obsnames,times)
@@ -37,20 +37,27 @@
     tcovar <- numeric(0)
     covarnames <- character(0)
   }
-  solib <- pompCBuilder(
-                        name=name,
-                        statenames=statenames,
-                        paramnames=paramnames,
-                        covarnames=covarnames,
-                        obsnames=obsnames,
-                        rmeasure=rmeasure,
-                        dmeasure=dmeasure,
-                        step.fn=step.fn,
-                        skeleton=skeleton,
-                        parameter.transform=parameter.transform,
-                        parameter.inv.transform=parameter.inv.transform
-                        )
-  if (link) pompLink(name)
+  pompCBuilder(
+               name=name,
+               statenames=statenames,
+               paramnames=paramnames,
+               covarnames=covarnames,
+               obsnames=obsnames,
+               rmeasure=rmeasure,
+               dmeasure=dmeasure,
+               step.fn=step.fn,
+               skeleton=skeleton,
+               parameter.transform=parameter.transform,
+               parameter.inv.transform=parameter.inv.transform,
+               save=save
+               )
+  if (link) {
+    if (save) {
+      pompLink(name)
+    } else {
+      pompLink(file.path(tempdir(),name))
+    }
+  }
   pomp(
        data=data,times=times,t0=t0,
        rprocess=euler.sim(
@@ -125,8 +132,10 @@
                     )
 
 
-pompCBuilder <- function (name, statenames, paramnames, covarnames, obsnames, rmeasure, dmeasure,
-                          step.fn, skeleton, parameter.transform, parameter.inv.transform)
+pompCBuilder <- function (name, statenames, paramnames, covarnames, obsnames,
+                          rmeasure, dmeasure, step.fn, skeleton,
+                          parameter.transform, parameter.inv.transform,
+                          save = FALSE)
 {
   if (missing(name)) stop(sQuote("name")," must be supplied");
   if (missing(statenames)) stop(sQuote("statenames")," must be supplied");
@@ -146,8 +155,10 @@
   covarnames <- cleanForC(covarnames)
   obsnames <- cleanForC(obsnames)
 
-  modelfile <- paste0(name,".c")
-  solib <- paste0(name,.Platform$dynlib.ext)
+  stem <- if (save) name else file.path(tempdir(),name)
+  modelfile <- paste0(stem,".c") 
+  solib <- paste0(stem,.Platform$dynlib.ext)
+
   if (.Platform$OS.type=="unix") {
     pompheader <- "pomp.h"
   } else {
@@ -257,7 +268,7 @@
   else
     cat("model codes written to",sQuote(modelfile),"\nlink to shared-object library",sQuote(solib),"\n")
 
-  invisible(solib)
+  invisible(NULL)
 }
 
 cleanForC <- function (text) {

Modified: pkg/pomp/R/mif.R
===================================================================
--- pkg/pomp/R/mif.R	2014-02-03 22:32:56 UTC (rev 885)
+++ pkg/pomp/R/mif.R	2014-02-27 02:20:24 UTC (rev 886)
@@ -410,12 +410,14 @@
             if (missing(start)) start <- coef(object)
             if (missing(rw.sd))
               stop("mif error: ",sQuote("rw.sd")," must be specified",call.=FALSE)
-            if (missing(ic.lag) && length(ivps)>0) {
-              if (method=="mif2")
-                ic.lag <- length(time(object)) # default mif2 behavior
-              else
-                stop("mif error: ",sQuote("ic.lag")," must be specified if ",sQuote("ivps"),
+            if (missing(ic.lag)) {
+              if (length(ivps)>0 && (method != "mif2")) {
+                stop("mif error: ",sQuote("ic.lag"),
+                     " must be specified if ",sQuote("ivps"),
                      " are",call.=FALSE)
+              } else {
+                ic.lag <- length(time(object))
+              }
             }
             if (missing(pars)) {
               rw.names <- names(rw.sd)[rw.sd>0]

Modified: pkg/pomp/inst/NEWS
===================================================================
--- pkg/pomp/inst/NEWS	2014-02-03 22:32:56 UTC (rev 885)
+++ pkg/pomp/inst/NEWS	2014-02-27 02:20:24 UTC (rev 886)
@@ -1,4 +1,7 @@
 NEWS
+0.47-2
+     o	By default, 'pompBuilder' now creates all files in the temporary directory.
+
 0.47-1
      o	'abc' implements Approximate Bayesian Computation for pomp models.
 

Modified: pkg/pomp/man/builder.Rd
===================================================================
--- pkg/pomp/man/builder.Rd	2014-02-03 22:32:56 UTC (rev 885)
+++ pkg/pomp/man/builder.Rd	2014-02-27 02:20:24 UTC (rev 886)
@@ -10,7 +10,7 @@
             rmeasure, dmeasure, step.fn, step.fn.delta.t,
             skeleton, skeleton.type, skelmap.delta.t = 1,
             parameter.transform, parameter.inv.transform,
-            \dots, link = TRUE)
+            \dots, link = TRUE, save = FALSE)
 }
 \arguments{
   \item{data, times, t0}{
@@ -52,6 +52,11 @@
   \item{link}{
     logical; if TRUE, the resulting code will be linked after compilation.
   }
+  \item{save}{
+    logical; if TRUE, the resulting C code will be saved in the current working directory.
+    The shared-object library will also be created in this directory.
+    If FALSE, the C code and shared-object library will be created in the temporary directory.
+  }
 }
 \value{
   The constructed \code{pomp} object.



More information about the pomp-commits mailing list