Skip to content
Snippets Groups Projects
Select Git revision
  • d4d98e3385b9e8fc367d377cf21921b8a02cc311
  • main default protected
  • multi-gitter-gfz-name-repl
  • maintenance/update_ci
  • enhancement/extraterrestrial_compatibility
  • feature/implement_operators
  • v0.19.1
  • v0.19.0
  • v0.18.0
  • v0.17.2
  • v0.17.1
  • v0.17.0
  • v0.16.1
  • v0.16.0
  • v0.15.11
  • v0.15.10
  • v0.15.9
  • v0.15.8
  • v0.15.7
  • v0.15.6
  • v0.15.5
  • v0.15.4
  • v0.15.3
  • v0.15.2
  • v0.15.1
  • v0.15.0
26 results

MANIFEST.in

Blame
  • Rphree_Viz.R 3.28 KiB
    ### RedModRphree, functions to perform basic visualization
    ### Licence: LGPL version 2.1
    ### Time-stamp: "Last modified 2018-05-06 19:30:10 delucia"
    
    ##' @title Display the profiles of some variables along a 1D reactive
    ##'     transport simulation
    ##' @param sim The simulation to display
    ##' @param sample optional, time frame position to be desplayed. If
    ##'     omitted, the last is showed
    ##' @param vars optional, character vector containing the names of
    ##'     variables to display (up to 7)
    ##' @param ... further parameters passed to \code{matplot}, such as
    ##'     main, xlab, ylab...
    ##' @return NULL
    ##' @author MDL
    ##' @export
    MatplotSingle <- function(sim, sample=1L, vars=c("Ca","Mg","Calcite","Dolomite"), ...) {
        if(missing(sample))
            sample <- length(sim)
        if (length(vars)>7)
            stopmsg("Please specify up to seven variables")
        
        cols <- c("red", "black","blue","olivedrab3", "orange", "light blue", "grey")[1:length(vars)]
        
        frame <- sim[[sample]]$C
        matplot(frame[,vars], type="l", lwd=2, lty="solid", col=cols, ...)
        legend("topright", vars, text.col=cols, bty="n")
    }
    
    
    
    ##' @title Display the profiles of some variables for 2 reactive
    ##'     transport simulation (one using surrogates)
    ##' @param sur The simulation with surrogate
    ##' @param sim The simulation using only phreeqc
    ##' @param sample optional, time frame position to be desplayed. If
    ##'     omitted, the last is showed
    ##' @param vars optional, character vector containing the names of
    ##'     variables to display (up to 7)
    ##' @param ... further parameters passed to \code{matplot}, such as
    ##'     main, xlab, ylab...
    ##' @return NULL
    ##' @author MDL
    ##' @export
    Matplot <- function(sur, sim, sample=1L, vars=c("Ca","Mg","Calcite","Dolomite"), ...) {
        if(missing(sample))
            sample <- length(sim)
        if (length(vars)>7)
            stopmsg("Please specify up to seven variables")
        
        cols <- c("red", "black","blue","olivedrab3", "orange", "light blue", "grey")[1:length(vars)]
        
        rs <- sur[[sample]]$C
        rn <- sim[[sample]]$C
        matplot(rn[,vars], type="l", lwd=2, lty="solid", col=cols, ...)
        matplot(rs[,vars], type="l", lwd=2, lty="dashed",col=cols, add=TRUE)
        legend("topright", vars, text.col=cols, bty="n")
    }
    
    ##' @title Scatter plots of phreeqc simulations vs surrogate response
    ##' @param mod list of regression models, one per variable
    ##' @param res the matrix or data.frame of the results
    ##' @param des the matrix or data.frame of the design (upon which the surrogates are called)
    ##' @param sample optional, indeces of the rows to include in the plot
    ##' @param column logical, if TRUE there are 2 columns, if FALSE 2 rows of the plot
    ##' @param ... further parameters passed internally to \code{plot}
    ##' @return NULL
    ##' @author MDL
    ##' @export
    PlotModsInSample <- function(mod, res, des, sample=seq(1,nrow(res)), column=TRUE, ...) {
        nres <- ncol(res)
        ## how many rows in the mfrow plot?
        nr <- floor(nres/2)+nres%%2
        design <- des[sample,]
        result <- res[sample,]
        
        if (column)
            par(mfrow=c(nr,2))
        else
            par(mfrow=c(2,nr))
        for (i in seq_along(mod)) {
            plot(result[,i], predict(mod[[i]], design),"p",pch=3, main=names(mod)[i],
                 xlab="Full physics", ylab="Surrogate", ...)
            abline(0,1,lty="dashed",col="grey")
        }
    }