Turn off all the wells in the MADS problem dictionary
Turn off all the wells in the MADS problem dictionary
Turn on all the wells in the MADS problem dictionary
Arcsine transformation of model parameters
Bayesian Sampling
Mads.bayessampling(madsdata; nsteps=1000, burnin=100, thinning=1, seed=2016)
Mads.bayessampling(madsdata, numsequences; nsteps=1000, burnin=100, thinning=1, seed=2016)
Arguments:
madsdata
: MADS problem dictionarynumsequences
: number of sequences executed in parallelnsteps
: number of final realizations in the chainburnin
: number of initial realizations before the MCMC are recordedthinning
: removal of any thinning
realizationseed
: initial random number seedReturns:
mcmcchain
: Calibrate
Mads.calibrate(madsdata; tolX=1e-3, tolG=1e-6, maxEval=1000, maxIter=100, maxJacobians=100, lambda=100.0, lambda_mu=10.0, np_lambda=10, show_trace=false, usenaive=false)
Arguments:
madsdata
: MADS problem dictionarytolX
: parameter space tolerancetolG
: parameter space update tolerancemaxEval
: maximum number of model evaluationsmaxIter
: maximum number of optimization iterationsmaxJacobians
: maximum number of Jacobian solveslambda
: initial Levenberg-Marquardt lambda lambda_mu
: lambda multiplication factor [10]np_lambda
: number of parallel lambda solvesshow_trace
: shows solution trace [default=false]save_results
: save intermediate results [default=true]usenaive
: use naive Levenberg-Marquardt solverReturns:
minimumdict
: model parameter dictionary with the optimal values at the minimumresults
: optimization algorithm results (e.g. results.minimum)Do a calibration using NLopt
Calibrate with random initial guesses
Mads.calibraterandom(madsdata; tolX=1e-3, tolG=1e-6, maxEval=1000, maxIter=100, maxJacobians=100, lambda=100.0, lambda_mu=10.0, np_lambda=10, show_trace=false, usenaive=false)
Mads.calibraterandom(madsdata, numberofsamples; tolX=1e-3, tolG=1e-6, maxEval=1000, maxIter=100, maxJacobians=100, lambda=100.0, lambda_mu=10.0, np_lambda=10, show_trace=false, usenaive=false)
Arguments:
madsdata
: MADS problem dictionarynumberofsamples
: number of random initial samplestolX
: parameter space tolerancetolG
: parameter space update tolerancemaxEval
: maximum number of model evaluationsmaxIter
: maximum number of optimization iterationsmaxJacobians
: maximum number of Jacobian solveslambda
: initial Levenberg-Marquardt lambda lambda_mu
: lambda multiplication factor [10]np_lambda
: number of parallel lambda solvesshow_trace
: shows solution trace [default=false]save_results
: save intermediate results [default=true]usenaive
: use naive Levenberg-Marquardt solverseed
: initial random seedReturns:
bestresult
: optimal results tuple: [1] model parameter dictionary with the optimal values at the minimum; [2] optimization algorithm results (e.g. bestresult[2].minimum)Calibrate with random initial guesses
Mads.calibraterandom(madsdata; tolX=1e-3, tolG=1e-6, maxEval=1000, maxIter=100, maxJacobians=100, lambda=100.0, lambda_mu=10.0, np_lambda=10, show_trace=false, usenaive=false)
Mads.calibraterandom(madsdata, numberofsamples; tolX=1e-3, tolG=1e-6, maxEval=1000, maxIter=100, maxJacobians=100, lambda=100.0, lambda_mu=10.0, np_lambda=10, show_trace=false, usenaive=false)
Arguments:
madsdata
: MADS problem dictionarynumberofsamples
: number of random initial samplestolX
: parameter space tolerancetolG
: parameter space update tolerancemaxEval
: maximum number of model evaluationsmaxIter
: maximum number of optimization iterationsmaxJacobians
: maximum number of Jacobian solveslambda
: initial Levenberg-Marquardt lambda lambda_mu
: lambda multiplication factor [10]np_lambda
: number of parallel lambda solvesshow_trace
: shows solution trace [default=false]save_results
: save intermediate results [default=true]usenaive
: use naive Levenberg-Marquardt solverseed
: initial random seedReturns:
bestresult
: optimal results tuple: [1] model parameter dictionary with the optimal values at the minimum; [2] optimization algorithm results (e.g. bestresult[2].minimum)Checkout the latest version of the Mads modules
Checkout the latest version of the Mads modules
Remove Mads coverage files
Call C MADS ins_obs() function from the MADS dynamic library
Compute injected/reduced contaminant mass
Mads.computemass(madsdata; time = 0)
Arguments:
madsdata
: MADS problem dictionarytime
: computational timeReturns:
mass_injected
: total injected massmass_reduced
: total reduced massCompute injected/reduced contaminant mass for a given set of mads input files
Mads.computemass(madsfiles; time = 0, path = ".")
Arguments:
madsfiles
: matching pattern for Mads input files (string or regular expression accepted)time
: computational timepath
: search directory for the mads input files Returns:
lambda
: array with all the lambda valuesmass_injected
: array with associated total injected massmass_reduced
: array with associated total reduced massCompute sensitivities for each model parameter; averaging the sensitivity indices over the entire observation range
Arguments:
madsdata
: MADS problem dictionarysaresults
: sensitivity analysis resultsCompute concentration for a point in space and time (x,y,z,t)
Mads.contamination(wellx, welly, wellz, n, lambda, theta, vx, vy, vz, ax, ay, az, H, x, y, z, dx, dy, dz, f, t0, t1, t; anasolfunction="long_bbb_ddd_iir_c")
Arguments:
wellx
- observation point (well) X coordinatewelly
- observation point (well) Y coordinatewellz
- observation point (well) Z coordinaten
- porositylambda
- first-order reaction ratetheta
- groundwater flow directionvx
- advective transport velocity in X directionvy
- advective transport velocity in Y directionvz
- advective transport velocity in Z directionax
- dispersivity in X direction (longitudinal)ay
- dispersivity in Y direction (transverse horizontal)az
- dispersivity in Y direction (transverse vertical)H
- Hurst coefficient for Fractional Brownian dispersionx
- X coordinate of contaminant source location y
- Y coordinate of contaminant source locationz
- Z coordinate of contaminant source locationdx
- source size (extent) in X directiondy
- source size (extent) in Y directiondz
- source size (extent) in Z directionf
- source mass fluxt0
- source starting timet1
- source termination timet
- time to compute concentration at the observation pointanasolfunction
: Anasol function to call (check out the Anasol module) [long_bbb_ddd_iir_c]Returns:
Produce MADS copyright information
Create web documentation files for Mads functions
Turn off the generation of MADS tests (default)
Turn on the generation of MADS tests (dangerous)
Create a new Mads problem where the observation targets are computed based on the model predictions
Mads.createmadsproblem(infilename, outfilename)
Mads.createmadsproblem(madsdata, outfilename)
Arguments:
infilename
: input Mads fileoutfilename
: output Mads filemadsdata
: MADS problem dictionarypredictions
: dictionary of model predictionsCreate observations in the MADS problem dictionary based on time
and observation
arrays
Delete rows with NaN in a Dataframe df
Perform BIG-DT analysis
Arguments:
madsdata
: MADS problem dictionarynummodelruns
: number of model runsnumhorizons
: number of info-gap horizons of uncertaintymaxHorizon
: maximum info-gap horizons of uncertaintynumlikelihoods
: number of Bayesian likelihoodsReturns:
bigdtresults
: dictionary with BIG-DT resultsDump ASCII file
Dump a JSON file
Dump well data from MADS problem dictionary into a ASCII file
Dump YAML file in JSON format
Dump YAML Mads file
Arguments:
madsdata
: MADS problem dictionaryfilename
: file nameSensitivity analysis using Saltelli's extended Fourier Amplitude Sensitivity Testing (eFAST) method
Arguments:
madsdata
: MADS problem dictionaryN
: number of samplesM
: maximum number of harmonicsgamma
: multiplication factor (Saltelli 1999 recommends gamma = 2 or 4)seed
: initial random seedEvaluate the expression in terms of the parameters, return a Dict() containing the expression names as keys, and the values of the expression as values
Evaluate the expressions in terms of the parameters, return a Dict() containing the expression names as keys, and the values of the expression as values
Filter dictionary keys based on a string or regular expression
Perform a forward run using the initial or provided values for the model parameters
forward(madsdata)
forward(madsdata, paramdict)
forward(madsdata, paramarray)
Arguments:
madsdata
: MADS problem dictionaryparamdict
: dictionary of model parameter valuesparamarray
: array of model parameter valuesReturns:
obsvalues
: dictionary of model predictionsPerform a forward run over a 3D grid defined in madsdata
using the initial or provided values for the model parameters
forwardgrid(madsdata)
forwardgrid(madsdata, paramvalues))
Arguments:
madsdata
: MADS problem dictionaryparamvalues
: dictionary of model parameter valuesReturns:
array3d
: 3D array with model predictions along a 3D gridUse the latest tagged versions of the Mads modules
List available functions in the MADS modules:
Examples:
Mads.functions()
Mads.functions(BIGUQ)
Mads.functions("get")
Mads.functions(Mads, "get")
Arguments:
module
: MADS modulestring
: matching stringList available functions in the MADS modules:
Examples:
Mads.functions()
Mads.functions(BIGUQ)
Mads.functions("get")
Mads.functions(Mads, "get")
Arguments:
module
: MADS modulestring
: matching stringGet file name extension
Example:
ext = Mads.getextension("a.mads") # ext = "mads"
Get important samples
Arguments:
samples
: array of samplesllhoods
: vector of log-likelihoodsReturns:
imp_samples
: array of important samplesGet the directory where currently Mads is running
problemdir = Mads.getmadsdir()
Get the default MADS input file set as a MADS global variable using setmadsinputfile(filename)
Mads.getmadsinputfile()
Arguments: none
Returns:
filename
: input file name (e.g. input_file_name.mads
)Get the directory where the Mads data file is located
Mads.getmadsproblemdir(madsdata)
Example:
madsdata = Mads.loadmadsproblemdir("../../a.mads")
madsproblemdir = Mads.getmadsproblemdir(madsdata)
where madsproblemdir
= "../../"
Get the MADS problem root name
madsrootname = Mads.getmadsrootname(madsdata)
Get keys for all observations in the MADS problem dictionary
Get dictionary with all parameters and their respective initial values
Mads.getparamdict(madsdata)
Arguments:
madsdata
: MADS problem dictionaryReturns:
paramdict
: dictionary with all parameters and their respective initial valuesGet probabilistic distributions of all parameters in the MADS problem dictionary
Mads.getparamdistributions(madsdata; init_dist=false)
Note:
Probabilistic distribution of parameters can be defined only if dist
or min
/max
model parameter fields are specified in the MADS problem dictionary madsdata
.
Arguments:
madsdata
: MADS problem dictionaryinit_dist
: if true
use the distribution defined for initialization in the MADS problem dictionary (defined using init_dist
parameter field); else use the regular distribution defined in the MADS problem dictionary (defined using dist
parameter field)Get keys of all parameters in the MADS dictionary
Mads.getparamkeys(madsdata)
Arguments:
madsdata
: MADS problem dictionaryReturns:
paramkeys
: array with the keys of all parameters in the MADS dictionaryGet an array with init_max
values for all the MADS model parameters
Get an array with init_max
values for parameters defined by paramkeys
Get an array with init_min
values for all the MADS model parameters
Get an array with init_min
values for parameters defined by paramkeys
Get an array with min
values for all the MADS model parameters
Get an array with max
values for parameters defined by paramkeys
Get an array with min
values for all the MADS model parameters
Get an array with min
values for parameters defined by paramkeys
Get the number of processors
Get the directory where restarts will be stored.
Get the directory where restarts will be stored.
Get file name root
Example:
r = Mads.getrootname("a.rnd.dat") # r = "a"
r = Mads.getrootname("a.rnd.dat", first=false) # r = "a.rnd"
Get keys of all source parameters in the MADS dictionary
Mads.getsourcekeys(madsdata)
Arguments:
madsdata
: MADS problem dictionaryReturns:
sourcekeys
: array with keys of all source parameters in the MADS dictionaryGet observation target
Get keys for all targets (observations with weights greater than zero) in the MADS problem dictionary
Get observation time
Get observation weight
Get keys for all wells in the MADS problem dictionary
Check for a keyword
in a class within the Mads dictionary madsdata
Mads.haskeyword(madsdata, keyword)
Mads.haskeyword(madsdata, class, keyword)
Arguments:
madsdata
: MADS problem dictionaryclass
: dictionary class; if not provided searches for keyword
in Problem
classkeyword
: dictionary keyReturns: true
or false
Examples:
Mads.haskeyword(madsdata, "disp")
... searches in Problem
class by defaultMads.haskeyword(madsdata, "Wells", "R-28")
... searches in Wells
class for a keyword "R-28"Produce MADS help information
Import function everywhere from a file. The first function in the file is the one that will be called by Mads to perform the model simulations.
Find indexes for dictionary keys based on a string or regular expression
Apply Mads instruction file instructionfilename
to read model input file inputfilename
Convert an instruction line in the Mads instruction file into regular expressions
Inversely proportional observation weights in the MADS problem dictionary
Inversely proportional observation weights in the MADS problem dictionary
Is parameter with key parameterkey
log-transformed?
Is a dictionary containing all the observations
Is parameter with key parameterkey
optimizable?
Is the dictionary containing all the parameters
Levenberg-Marquardt optimization
Arguments:
f
: forward model functiong
: gradient function for the forward modelx0
: initial parameter guessroot
: Mads problem root nametolX
: parameter space tolerancetolG
: parameter space update tolerancetolOF
: objective function update tolerancemaxEval
: maximum number of model evaluationsmaxIter
: maximum number of optimization iterationsmaxJacobians
: maximum number of Jacobian solveslambda
: initial Levenberg-Marquardt lambda [eps(Float32)]lambda_scale
: lambda scaling factorlambda_mu
: lambda multiplication factor μ [10]lambda_nu
: lambda multiplication factor ν [10]np_lambda
: number of parallel lambda solvesshow_trace
: shows solution trace [default=false]alwaysDoJacobian
: computer Jacobian each iteration [false]callback
: call back function for debuggingLevenberg-Marquardt optimization
Arguments:
f
: forward model functiong
: gradient function for the forward modelx0
: initial parameter guessroot
: Mads problem root nametolX
: parameter space tolerancetolG
: parameter space update tolerancetolOF
: objective function update tolerancemaxEval
: maximum number of model evaluationsmaxIter
: maximum number of optimization iterationsmaxJacobians
: maximum number of Jacobian solveslambda
: initial Levenberg-Marquardt lambda [eps(Float32)]lambda_scale
: lambda scaling factorlambda_mu
: lambda multiplication factor μ [10]lambda_nu
: lambda multiplication factor ν [10]np_lambda
: number of parallel lambda solvesshow_trace
: shows solution trace [default=false]alwaysDoJacobian
: computer Jacobian each iteration [false]callback
: call back function for debuggingLoad ASCII file
Load a JSON file
Load MADS input file defining a MADS problem dictionary
Mads.loadmadsfile(filename)
Mads.loadmadsfile(filename; julia=false)
Mads.loadmadsfile(filename; julia=true)
Arguments:
filename
: input file name (e.g. input_file_name.mads
)julia
: if true
, force using julia
parsing functions; if false
(default), use python
parsing functions [boolean]Returns:
madsdata
: Mads problem dictionaryExample: md = loadmadsfile("input_file_name.mads")
Load YAML file
Local sensitivity analysis based on eigen analysis of covariance matrix
Arguments:
madsdata
: MADS problem dictionarymadsdata
: MADS problem dictionaryfilename
: output file nameformat
: output plot format (png
, pdf
, etc.)par
: parameter setobs
: observations for the parameter setTurn off execution of long MADS tests (default)
Turn on execution of long MADS tests (dangerous)
MADS critical error messages
MADS debug messages (controlled by quiet
and debuglevel
)
MADS debug messages (controlled by quiet
and debuglevel
)
MADS error messages
MADS information/status messages (controlled by quiet` and verbositylevel
)
MADS information/status messages (controlled by quiet` and verbositylevel
)
MADS output (controlled by quiet` and verbositylevel
)
MADS output (controlled by quiet` and verbositylevel
)
MADS warning messages
Make a conditional log likelihood function that accepts an array containing the opt parameters' values
Model section information criteria
Make a version of the function f
that accepts an array containing the optimal parameters' values
Mads.makearrayfunction(madsdata, f)
Arguments:
madsdata
: MADS problem dictionaryf
: ...Returns:
arrayfunction
: function accepting an array containing the optimal parameters' valuesModel section information criteria
Make a log likelihood function that accepts an array containing the opt parameters' values
Setup BIG-DT problem
Arguments:
madsdata
: MADS problem dictionarychoice
: dictionary of BIG-DT choices (scenarios)Returns:
bigdtproblem
: BIG-DT problem typeSetup BIG-DT problem
Arguments:
madsdata
: MADS problem dictionarychoice
: dictionary of BIG-DT choices (scenarios)Returns:
bigdtproblem
: BIG-DT problem typeCreate a function to compute concentrations for all the observation points using Anasol
Mads.makecomputeconcentrations(madsdata)
Arguments:
madsdata
: MADS problem dictionaryReturns:
computeconcentrations
: function to compute concentrations; computeconcentrations
returns a dictionary of observations and model predicted concentrationsExamples:
computeconcentrations()
or
computeconcentrations = Mads.makecomputeconcentrations(madsdata)
paramkeys = Mads.getparamkeys(madsdata)
paramdict = OrderedDict(zip(paramkeys, map(key->madsdata["Parameters"][key]["init"], paramkeys)))
forward_preds = computeconcentrations(paramdict)
Make a version of the function f
that accepts an array containing the optimal parameters' values, and returns an array of observations
Mads.makedoublearrayfunction(madsdata, f)
Arguments:
madsdata
: MADS problem dictionaryf
: ...Returns:
doublearrayfunction
: function accepting an array containing the optimal parameters' values, and returning an array of observationsMake a version of the function f
that accepts an array containing the optimal parameters' values, and returns an array of observations
Mads.makedoublearrayfunction(madsdata, f)
Arguments:
madsdata
: MADS problem dictionaryf
: ...Returns:
doublearrayfunction
: function accepting an array containing the optimal parameters' values, and returning an array of observationsMake forward model, gradient, objective functions needed for Levenberg-Marquardt optimization
Make gradient function needed for local sensitivity analysis
Make a function to compute the prior log-likelihood of the model parameters listed in the MADS problem dictionary madsdata
Make MADS function to execute the model defined in the MADS problem dictionary madsdata
Usage:
Mads.makemadscommandfunction(madsdata)
MADS can be coupled with any internal or external model. The model coupling is defined in the MADS problem dictionary. The expectations is that for a given set of model inputs, the model will produce a model output that will be provided to MADS. The fields in the MADS problem dictionary that can be used to define the model coupling are:
Model
: execute a Julia function defined in an input Julia file. The function that should accept a parameter
dictionary with all the model parameters as an input argument and should return an observation
dictionary with all the model predicted observations. MADS will execute the first function defined in the file.MADS model
: create a Julia function based on an input Julia file. The input file should contain a function that accepts as an argument the MADS problem dictionary. MADS will execute the first function defined in the file. This function should a create a Julia function that will accept a parameter
dictionary with all the model parameters as an input argument and will return an observation
dictionary with all the model predicted observations.Julia model
: execute an internal Julia function that accepts a parameter
dictionary with all the model parameters as an input argument and will return an observation
dictionary with all the model predicted observations.Command
: execute an external UNIX command or script that will execute an external model.Julia command
: execute a Julia script that will execute an external model. The Julia script is defined in an input Julia file. The input file should contain a function that accepts as an argument the MADS problem dictionary; MADS will execute the first function defined in the file. The Julia script should be capable to (1) execute the model (making a system call of an external model), (2) parse the model outputs, (3) return an observation
dictionary with model predictions.Both Command
and Julia command
can use different approaches to pass model parameters to the external model.
Only Command
uses different approaches to get back the model outputs. The script defined under Julia command
parses the model outputs using Julia.
The available options for writing model inputs and reading model outputs are as follows.
Options for writing model inputs:
Templates
: template files for writing model input files as defined at http://mads.lanl.govASCIIParameters
: model parameters written in a ASCII fileJLDParameters
: model parameters written in a JLD fileYAMLParameters
: model parameters written in a YAML fileJSONParameters
: model parameters written in a JSON fileOptions for reading model outputs:
Instructions
: instruction files for reading model output files as defined at http://mads.lanl.govASCIIPredictions
: model predictions read from a ASCII fileJLDPredictions
: model predictions read from a JLD fileYAMLPredictions
: model predictions read from a YAML fileJSONPredictions
: model predictions read from a JSON fileMake MADS forward & gradient functions for the model defined in the MADS problem dictionary madsdata
Make MADS gradient function to compute the parameter-space gradient for the model defined in the MADS problem dictionary madsdata
Make a function to compute the conditional log-likelihood of the model parameters conditioned on the model predictions/observations. Model parameters and observations are defined in the MADS problem dictionary madsdata
.
Make a function to compute the log-likelihood for a given set of model parameters, associated model predictions and existing observations. The function can be provided as an external function in the MADS problem dictionary under LogLikelihood
or computed internally.
Scale down values larger than max(Float32) in a Dataframe df
so that Gadfly can plot the data
Modify (multiply) observation weights in the MADS problem dictionary
Modify (multiply) well weights in the MADS problem dictionary
Monte Carlo analysis
Mads.montecarlo(madsdata; N=100)
Arguments:
madsdata
: MADS problem dictionary sampling uniformly between mins/maxsN
: number of samples (default = 100)Returns:
outputdicts
: parameter dictionary containing the data arraysDumps:
<mads_root_name>.mcresults.yaml
)Naive Levenberg-Marquardt optimization: get the LM parameter space step
Naive Levenberg-Marquardt optimization
Arguments:
f
: forward model functiong
: gradient function for the forward modelx0
: initial parameter guesso
: objective functiontolX
: parameter space tolerancetolG
: parameter space update tolerancetolOF
: objective function update tolerancemaxEval
: maximum number of model evaluationsmaxIter
: maximum number of optimization iterationslambda
: initial Levenberg-Marquardt lambda [100]lambda_mu
: lambda multiplication factor μ [10]np_lambda
: number of parallel lambda solvesNaive Levenberg-Marquardt optimization
Arguments:
f
: forward model functiong
: gradient function for the forward modelx0
: initial parameter guesso
: objective functiontolX
: parameter space tolerancetolG
: parameter space update tolerancetolOF
: objective function update tolerancemaxEval
: maximum number of model evaluationsmaxIter
: maximum number of optimization iterationslambda
: initial Levenberg-Marquardt lambda [100]lambda_mu
: lambda multiplication factor μ [10]np_lambda
: number of parallel lambda solvesNaive Levenberg-Marquardt optimization: perform LM iteration
Disable MADS plotting
Match an instruction line in the Mads instruction file with model input file
Compute objective function
Convert parameter array to a parameter dictionary of arrays
Independent sampling of model parameters defined in the MADS problem dictionary
Arguments:
madsdata
: MADS problem dictionarynumsamples
: number of samplesparameterkey
: model parameter keyinit_dist
: if true
use the distribution defined for initialization in the MADS problem dictionary (defined using init_dist
parameter field); else use the regular distribution defined in the MADS problem dictionary (defined using dist
parameter field)Independent sampling of model parameters defined in the MADS problem dictionary
Arguments:
madsdata
: MADS problem dictionarynumsamples
: number of samplesparameterkey
: model parameter keyinit_dist
: if true
use the distribution defined for initialization in the MADS problem dictionary (defined using init_dist
parameter field); else use the regular distribution defined in the MADS problem dictionary (defined using dist
parameter field)Random numbers for a MADS model parameter defined by parameterkey
Arguments:
madsdata
: MADS problem dictionaryparameterkey
: model parameter keynumsamples
: number of samplesparamdist
: dictionary with parameter distributionsParse loaded Mads problem dictionary
Arguments:
madsdata
: Mads problem dictionaryParse Amanzi output provided in an external file (filename
)
Mads.parser_amanzi()
Mads.parser_amanzi("observations.out")
Arguments:
filename
: external file name (optional)Returns:
dict
: a dictionary with model observations following MADS requirementsParse Amanzi output provided in an external file (filename
)
Mads.parser_amanzi()
Mads.parser_amanzi("observations.out")
Arguments:
filename
: external file name (optional)Returns:
dict
: a dictionary with model observations following MADS requirementsCompute the sum of squared residuals for observations that match a regular expression
Plot the sensitivity analysis results for each well (Specific plot requested by Monty)
Plot a 3D grid solution based on model predictions in array s
, initial parameters, or user provided parameter values
plotgrid(madsdata, s; addtitle=true, title="", filename="", format="")
plotgrid(madsdata; addtitle=true, title="", filename="", format="")
plotgrid(madsdata, parameters; addtitle=true, title="", filename="", format="")
Arguments:
madsdata
: MADS problem dictionaryparameters
: dictionary with model parameterss
: model predictions arrayaddtitle
: add plot title [true]title
: plot titlefilename
: output file nameformat
: output plot format (png
, pdf
, etc.)Plot contaminant sources and wells defined in MADS problem dictionary
Arguments:
madsdata
: MADS problem dictionaryfilename
: output file nameformat
: output plot format (png
, pdf
, etc.)keyword
: to be added in the filenamePlot injected/reduced contaminant mass
Mads.plotmass(lambda, mass_injected, mass_reduced, filename="file_name")
Arguments:
lambda
: array with all the lambda valuesmass_injected
: array with associated total injected massmass_reduced
: array with associated total reduced massfilename
: output filename for the generated plotformat
: output plot format (png
, pdf
, etc.)Dumps: image file with name filename
and in specified format
Plot the matches between model predictions and observations
plotmatches(madsdata; filename="", format="")
plotmatches(madsdata, param; filename="", format="")
plotmatches(madsdata, result; filename="", format="")
plotmatches(madsdata, result, r"NO3"; filename="", format="")
Arguments:
madsdata
: MADS problem dictionaryparam
: dictionary with model parametersresult
: dictionary with model predictionsrx
: regular expression to filter the outputsfilename
: output file nameformat
: output plot format (png
, pdf
, etc.)Plot the sensitivity analysis results for the observations
Arguments:
madsdata
: MADS problem dictionaryresult
: sensitivity analysis resultsfilter
: string or regex to plot only observations containing filter
keyword
: to be added in the auto-generated filenamefilename
: output file nameformat
: output plot format (png
, pdf
, etc.)Plot BIG-DT robustness curves
Arguments:
madsdata
: MADS problem dictionarybigdtresults
: BIG-DT resultsfilename
: output file name used to dump plotsformat
: output plot format (png
, pdf
, etc.)Create plots of data series
Arguments:
X
: matrix with the series datafilename
: output file nameformat
: output plot format (png
, pdf
, etc.)xtitle
: x-axis titleytitle
: y-axis titletitle
: plot titlename
: series namecombined
: true
by defaultPlot the sensitivity analysis results for all the wells in the MADS problem dictionary (wells class expected)
Arguments:
madsdata
: MADS problem dictionaryresult
: sensitivity analysis resultsxtitle
: x-axis titleytitle
: y-axis titlefilename
: output file nameformat
: output plot format (png
, pdf
, etc.)Plot the sensitivity analysis results for a given well in the MADS problem dictionary (wells class expected)
Arguments:
madsdata
: MADS problem dictionaryresult
: sensitivity analysis resultswellname
: well namextitle
: x-axis titleytitle
: y-axis titlefilename
: output file nameformat
: output plot format (png
, pdf
, etc.)Print sensitivity analysis results
Make MADS not quiet
Make MADS quiet
Read MADS predictions from an ASCII file
Read MADS model predictions from a JSON file
Read observations
Read observations
Read observations using C Mads library
Read MADS model predictions from a YAML file filename
Get observations for a set of regular expressions
Reset the model runs count to be equal to zero
Compute residuals
Reweigh samples using importance sampling – returns a vector of log-likelihoods after reweighing
Arguments:
madsdata
: MADS problem dictionarypredictions
: the model predictions for each of the samplesoldllhoods
: the log likelihoods of the parameters in the old distributionReturns:
newllhoods
: vector of log-likelihoods after reweighingRosenbrock test function
Parameter gradients of the Rosenbrock test function
Rosenbrock test function (more difficult to solve)
Parameter gradients of the Rosenbrock test function
Parameter gradients of the Rosenbrock test function for LM optimization (returns the gradients for the 2 components separetely)
Parameter Hessian of the Rosenbrock test function
Rosenbrock test function for LM optimization (returns the 2 components separetely)
Saltelli sensitivity analysis
Arguments:
madsdata
: MADS problem dictionaryN
: number of samplesseed
: initial random seedrestartdir
: directory where files will be stored containing model results for fast simulation restartsparallel
: set to true if the model runs should be performed in parallelSaltelli sensitivity analysis (brute force)
Arguments:
madsdata
: MADS problem dictionaryN
: number of samplesseed
: initial random seedPrint sensitivity analysis results (method 2)
Save MADS problem dictionary madsdata
in MADS input file filename
Mads.savemadsfile(madsdata)
Mads.savemadsfile(madsdata, "test.mads")
Mads.savemadsfile(madsdata, parameters, "test.mads")
Mads.savemadsfile(madsdata, parameters, "test.mads", explicit=true)
Arguments:
madsdata
: Mads problem dictionaryparameters
: Dictinary with parameters (optional)filename
: input file name (e.g. input_file_name.mads
)julia
: if true
use Julia JSON module to saveexplicit
: if true
ignores MADS YAML file modifications and rereads the original input fileSave MADS problem dictionary madsdata
in MADS input file filename
Mads.savemadsfile(madsdata)
Mads.savemadsfile(madsdata, "test.mads")
Mads.savemadsfile(madsdata, parameters, "test.mads")
Mads.savemadsfile(madsdata, parameters, "test.mads", explicit=true)
Arguments:
madsdata
: Mads problem dictionaryparameters
: Dictinary with parameters (optional)filename
: input file name (e.g. input_file_name.mads
)julia
: if true
use Julia JSON module to saveexplicit
: if true
ignores MADS YAML file modifications and rereads the original input fileSave MCMC chain in a file
Create histogram/scatter plots of model parameter samples
Arguments:
madsdata
: MADS problem dictionarysamples
: matrix with model parametersfilename
: output file nameformat
: output plot format (png
, pdf
, etc.)Get files in the current directory or in a directory defined by path
matching pattern key
which can be a string or regular expression
Mads.searchdir(key)
Mads.searchdir(key; path = ".")
Arguments:
key
: matching pattern for Mads input files (string or regular expression accepted)path
: search directory for the mads input filesReturns:
filename
: an array with file names matching the pattern in the specified directorySet all parameters OFF
Set all parameters ON
Set MADS debug level
Set the working directory (for parallel environments)
@everywhere Mads.setdir()
@everywhere Mads.setdir("/home/monty")
Set Dynamic Model for MADS model calls using internal Julia functions
Set image file format
based on the filename
extension, or sets the filename
extension based on the requested format
. The default format
is SVG
. PNG
, PDF
, ESP
, and PS
are also supported.
setplotfileformat(filename, format)
Arguments:
filename
: output file nameformat
: output plot format (png
, pdf
, etc.)Returns:
filename
: output file nameformat
: output plot format (png
, pdf
, etc.)Set a default MADS input file
Mads.setmadsinputfile(filename)
Arguments:
filename
: input file name (e.g. input_file_name.mads
)Set observations (calibration targets) in the MADS problem dictionary based on a predictions
dictionary
Set observation time based on the observation name in the MADS problem dictionary
Usage:
Mads.setobstime!(madsdata, separator)
Mads.setobstime!(madsdata, regex)
Arguments:
madsdata
: MADS problem dictionaryseparator
: string to separatorregex
: regular expression to matchExamples:
Mads.setobstime!(madsdata, "_t")
Mads.setobstime!(madsdata, r"[A-x]*_t([0-9,.]+)")
Set observation weights in the MADS problem dictionary
Set a specific parameter with a key parameterkey
OFF
Set a specific parameter with a key parameterkey
ON
Set normal parameter distributions for all the model parameters in the MADS problem dictionary
Mads.setparamsdistnormal!(madsdata, mean, stddev)
Arguments:
madsdata
: MADS problem dictionarymean
: array with the mean valuesstddev
: array with the standard deviation valuesSet uniform parameter distributions for all the model parameters in the MADS problem dictionary
Mads.setparamsdistuniform!(madsdata, min, max)
Arguments:
madsdata
: MADS problem dictionarymin
: array with the minimum valuesmax
: array with the maximum valuesSet initial parameter guesses in the MADS dictionary
Mads.setparamsinit!(madsdata, paramdict)
Arguments:
madsdata
: MADS problem dictionaryparamdict
: dictionary with initial model parameter valuesSet the available processors based on environmental variables. Supports SLURM only at the moment.
Usage:
Mads.setprocs()
Mads.setprocs(ntasks_per_node=4)
Mads.setprocs(ntasks_per_node=32, mads_servers=true)
Mads.setprocs(ntasks_per_node=64, machinenames=["madsmax", "madszem"])
Mads.setprocs(ntasks_per_node=64, mads_servers=true, exename="/home/monty/bin/julia", dir="/home/monty")
Optional arguments:
ntasks_per_node
: number of parallel tasks per nodemachinenames
: array with machines names to invokeddir
: common directory shared by all the jobsexename
: location of the julia executable (the same version of julia is needed on all the workers)mads_servers
: if true
use MADS servers (LANL only)quiet
: suppress output [default true
]test
: test the servers and connect to each one ones at a time [default false
]Set the number of processors to np
and the number of threads to nt
Usage:
Mads.setprocs(4)
Mads.setprocs(4, 8)
Arguments:
np
: number of processorsnt
: number of threadsSet current seed
Set observation target
Set observation time
Set MADS verbosity level
Set observation weight
Set well weights in the MADS problem dictionary
Show all parameters in the MADS problem dictionary
Show observations in the MADS problem dictionary
Show optimizable parameters in the MADS problem dictionary
Sine transformation of model parameters
Sine transformation of a function
Sine transformation of a gradient function
Generate a combined spaghetti plot for the selected
(type != null
) model parameter
Mads.spaghettiplot(madsdata, paramdictarray; filename="", keyword = "", format="", xtitle="X", ytitle="Y", obs_plot_dots=true)
Mads.spaghettiplot(madsdata, obsmdictarray; filename="", keyword = "", format="", xtitle="X", ytitle="Y", obs_plot_dots=true)
Mads.spaghettiplot(madsdata, number_of_samples; filename="", keyword = "", format="", xtitle="X", ytitle="Y", obs_plot_dots=true)
Arguments:
madsdata
: MADS problem dictionaryparamdictarray
: parameter dictionary array containing the data arrays to be plottedobsdictarray
: observation dictionary array containing the data arrays to be plottednumber_of_samples
: number of samplesfilename
: output file name used to output the produced plotskeyword
: keyword to be added in the file name used to output the produced plots (if filename
is not defined)format
: output plot format (png
, pdf
, etc.)xtitle
: x
axis titleytitle
: y
axis titleobs_plot_dots
: plot observation as dots (true
[default] or false
)seed
: initial random seedReturns: none
Dumps:
<mads_rootname>-<keyword>-<number_of_samples>-spaghetti.<default_image_extension>
)Generate separate spaghetti plots for each selected
(type != null
) model parameter
Mads.spaghettiplots(madsdata, paramdictarray; format="", keyword="", xtitle="X", ytitle="Y", obs_plot_dots=true)
Mads.spaghettiplots(madsdata, number_of_samples; format="", keyword="", xtitle="X", ytitle="Y", obs_plot_dots=true)
Arguments:
madsdata
: MADS problem dictionaryparamdictarray
: parameter dictionary containing the data arrays to be plottednumber_of_samples
: number of sampleskeyword
: keyword to be added in the file name used to output the produced plotsformat
: output plot format (png
, pdf
, etc.)xtitle
: x
axis titleytitle
: y
axis titleobs_plot_dots
: plot observation as dots (true
[default] or false
)seed
: initial random seedDumps:
selected
(type != null
) model parameter (<mads_rootname>-<keyword>-<param_key>-<number_of_samples>-spaghetti.<default_image_extension>
)Convert @sprintf
macro into sprintf
function
Status of the Mads modules
Tag the Mads modules with a default argument :patch
Tag the Mads modules with a default argument :patch
Execute Mads tests (the tests will be in parallel if processors are defined)
Execute Mads tests (the tests will be in parallel if processors are defined)
Execute Mads tests using Julia Pkg.test (the default Pkg.test in Julia is executed in serial)
Execute Mads tests using Julia Pkg.test (the default Pkg.test in Julia is executed in serial)
Convert Void's into NaN's in a dictionary
Get weighted mean and variance samples
Arguments:
samples
: array of samplesllhoods
: vector of log-likelihoodsReturns:
mean
: vector of sample meansvar
: vector of sample variancesTurn off a specific well in the MADS problem dictionary
Turn on a specific well in the MADS problem dictionary
Convert Wells
class to Observations
class in the MADS problem dictionary
Write initial parameters
Write parameters
Write parameters
via MADS template (templatefilename
) to an output file (outputfilename
)