Title: | Stable Isotope Box Modelling in R |
---|---|
Description: | A set of functions to run simple and composite box-models to describe the dynamic or static distribution of stable isotopes in open or closed systems. The package also allows the sweeping of many parameters in both static and dynamic conditions. The mathematical models used in this package are derived from Albarede, 1995, Introduction to Geochemical Modelling, Cambridge University Press, Cambridge <doi:10.1017/CBO9780511622960>. |
Authors: | Theo Tacail [aut, cre] |
Maintainer: | Theo Tacail <[email protected]> |
License: | GPL-3 |
Version: | 2.0.0.9000 |
Built: | 2024-11-02 04:28:31 UTC |
Source: | https://github.com/ttacail/isobxr |
A function to find the combinations of values of n parameters producing final state delta values fitting within confidence intervals of observations.
fit.final_space( workdir, obs_file_name, sweep_space_digest_folders, fit_name = NULL, output_dir = NULL, delta_reference_box = NaN, excluded_boxes = NULL, print_correlogram = FALSE, print_lda = FALSE, print_LS_surfaces = FALSE, parameter_subsets = NULL, custom_expressions = NULL, save_outputs = FALSE, export_fit_data = FALSE )
fit.final_space( workdir, obs_file_name, sweep_space_digest_folders, fit_name = NULL, output_dir = NULL, delta_reference_box = NaN, excluded_boxes = NULL, print_correlogram = FALSE, print_lda = FALSE, print_LS_surfaces = FALSE, parameter_subsets = NULL, custom_expressions = NULL, save_outputs = FALSE, export_fit_data = FALSE )
workdir |
Working directory of 0_ISOBXR_MASTER.xlsx master file, |
obs_file_name |
Name of csv file containing observations with csv extension.
|
sweep_space_digest_folders |
Name of sweep.final_nD digest directory. |
fit_name |
Name given to specific fit. If NULL, output are named after date and time of fit. |
output_dir |
Destination directory for fit outputs. If NULL, outputs are stored in sweep_space_digest_folders directory. Default is NULL. |
delta_reference_box |
BOX ID of reference box, used to calculate difference
between any box delta and reference box delta. Default is NaN. |
excluded_boxes |
list of boxes to exclude from fit. Default is NULL. |
print_correlogram |
If TRUE, includes correlograms to final report when applicable. |
print_lda |
If TRUE, includes linear discriminant analysis to final report
when applicable. |
print_LS_surfaces |
If TRUE, includes surfaces of least squarred residuals
to final report when applicable. |
parameter_subsets |
List of limits vectors for parameters to subset before fit. |
custom_expressions |
Vector of expressions to add to the list of fitted parameters. |
save_outputs |
If TRUE, saves all run outputs to local working directory (workdir). |
export_fit_data |
If TRUE, exports fitted data as csv and rds files. |
A observation fit graphical report, in R session or exported as pdf, and a data report as R list or xlsx if required.
Merge results from all chunks of a given sweep.final_nD run
merge_FINnD_chunks(workdir, FINnD_digest_dir.to_merge, save_outputs = FALSE)
merge_FINnD_chunks(workdir, FINnD_digest_dir.to_merge, save_outputs = FALSE)
workdir |
Working directory of 0_ISOBXR_MASTER.xlsx master file, |
FINnD_digest_dir.to_merge |
Name of sweep.final_nD digest directory
to which current chunks should be merged. |
save_outputs |
If TRUE, saves merged chunks outputs to sweep.final_nD digest directory. |
Merged chunks sweep.final_nD outputs, including results, chunk logs, chunked parameter spaces.
A function to plot delta vs time from the sweep.dyn_2D runs
plot_dyn_2D( workdir, sweep_dir_name, time_unit = NULL, time_range = NULL, hidden_boxes = NULL, return_as_print = TRUE, free_y_scale = TRUE, swap_sweep_params = FALSE, show.delta_drift = FALSE, time_as_log10 = TRUE )
plot_dyn_2D( workdir, sweep_dir_name, time_unit = NULL, time_range = NULL, hidden_boxes = NULL, return_as_print = TRUE, free_y_scale = TRUE, swap_sweep_params = FALSE, show.delta_drift = FALSE, time_as_log10 = TRUE )
workdir |
Working directory of isobxr excel master file and where output files will be stored if exported by user. (character string) |
sweep_dir_name |
Full name of sweep.dyn_2D SERIES directory (character string) |
time_unit |
Time unit to use on plot if different from native time unit. |
time_range |
Time range to zoom on as vector of two values, such as: c(0,100) |
List of boxes to hide from plots, as a vector of character strings. |
|
return_as_print |
If TRUE, prints delta and size vs. time plots in a single page figure on R. |
free_y_scale |
If TRUE, frees Y axis scale. |
swap_sweep_params |
If TRUE, swaps the sweep parameter 1 and 2 representations
from color to facet scales. |
show.delta_drift |
If TRUE, displays drift of delta values from t0. |
time_as_log10 |
If TRUE, uses logarithmic time scale in plot. |
A set of plots showing the evolution of delta and sizes with time.
A function to plot the relaxation of isotope ratios in a system, including characteristic times
plot_relaxation( workdir, flux_list, coeff_list, spiked_boxes, spike.max_delta = 100, n_steps = 10000, hidden_boxes = NULL, show.residence_time = TRUE, show.facets = FALSE, time_landmarks = NULL, time_as_log10 = TRUE, isobxr_master_file = "0_ISOBXR_MASTER", time.resolution_cut = NULL )
plot_relaxation( workdir, flux_list, coeff_list, spiked_boxes, spike.max_delta = 100, n_steps = 10000, hidden_boxes = NULL, show.residence_time = TRUE, show.facets = FALSE, time_landmarks = NULL, time_as_log10 = TRUE, isobxr_master_file = "0_ISOBXR_MASTER", time.resolution_cut = NULL )
workdir |
Working directory of isobxr excel master file and where output files will be stored if exported by user. (character string) |
flux_list |
Name of the list of fluxes and initial box sizes to be used for the run, |
coeff_list |
Name of the list of fractionation coefficients to be used for the run, |
spiked_boxes |
Vector of box names ("BOX_ID") to be spiked. |
spike.max_delta |
Value of the maximum spike isotope composition |
n_steps |
Number of calculation steps. Determines the resolution of the run. |
Vector of boxes to hide from plots. |
|
show.residence_time |
If TRUE, displays box-specific residence times on plot. |
show.facets |
If TRUE, displays results in box-specific facets. |
time_landmarks |
Vector of time landmarks to display on x-axis (numerical values). |
time_as_log10 |
If TRUE, uses logarithmic time scale in plot. |
isobxr_master_file |
Name of isobxr excel master file. |
time.resolution_cut |
Time below which resolution is increased. Default is NULL. |
A plots showing the evolution of the isotopic ratios in the system until full relaxation,
defined as the maximum relaxation time multiplied by 10.
## Not run: plot_relaxation(workdir = "/Users/username/Documents/1_ABC_tutorial", flux_list = "Fx6_ABC_open_bal", coeff_list = "a0", n_steps = 1000, spiked_boxes = c("SOURCE")) ## End(Not run)
## Not run: plot_relaxation(workdir = "/Users/username/Documents/1_ABC_tutorial", flux_list = "Fx6_ABC_open_bal", coeff_list = "a0", n_steps = 1000, spiked_boxes = c("SOURCE")) ## End(Not run)
A function to plot delta and size vs time from the sim.scenario runs and to include observations along simulations.
plot_scenario( workdir, scenario_dir_name, shown_runs = NULL, time_unit = NULL, hidden_boxes = NULL, return_as_print = TRUE, show.facets = FALSE, show.run_separations = TRUE, observations_file = NULL, observations_groups = NULL )
plot_scenario( workdir, scenario_dir_name, shown_runs = NULL, time_unit = NULL, hidden_boxes = NULL, return_as_print = TRUE, show.facets = FALSE, show.run_separations = TRUE, observations_file = NULL, observations_groups = NULL )
workdir |
Working directory of isobxr excel master file and where output files will be stored if exported by user. (character string) |
scenario_dir_name |
name of sim.scenario SERIES directory (starts with 3_SCEN) |
shown_runs |
Vector of successive run numbers (RUN_n) to be displayed (e.g., 1:5). |
time_unit |
Time unit to use on plot if different from native time unit. |
List of boxes to hide from plots, as a vector of character strings. |
|
return_as_print |
If TRUE, prints delta and size vs. time plots in a single page figure on R. |
show.facets |
If TRUE, shows delta vs. time as faceted by BOX. |
show.run_separations |
If TRUE, shows limits between subruns. |
observations_file |
Name of the csv file containing observations (without csv extension).
Default is NULL. |
observations_groups |
vector of observations groups to include in plot, |
A set of plots showing the evolution of delta and sizes with time.
A function to plot delta and size vs time from the sim.single_run outputs
plot_single_run( workdir, RUN_ID, time_as_log10 = TRUE, time_unit = NULL, hidden_boxes = NULL, return_as_print = TRUE )
plot_single_run( workdir, RUN_ID, time_as_log10 = TRUE, time_unit = NULL, hidden_boxes = NULL, return_as_print = TRUE )
workdir |
Working directory of isobxr excel master file and where output files will be stored if exported by user. (character string) |
RUN_ID |
ID of the run (formerly SERIES_RUN_ID). Corresponds to the name of the .rds file storing the results of the run. |
time_as_log10 |
If TRUE, uses logarithmic time scale in plot. |
time_unit |
Time unit to use on plot if different from native time unit. |
List of boxes to hide from plots, as a vector of character strings. |
|
return_as_print |
If TRUE, prints delta and size vs. time plots in a single page figure on R. |
A set of plots showing the evolution of delta and sizes with time.
A function to read and inspect the sweep.dyn_2D master files and obtain a master formatted list.
read.dyn_2D_master(workdir, dyn_2D_master_file, isobxr_master_file)
read.dyn_2D_master(workdir, dyn_2D_master_file, isobxr_master_file)
workdir |
Working directory of isobxr excel master file and where output files will be stored if exported by user. (character string) |
dyn_2D_master_file |
Name of sweep.dyn_2D excel master file. (without file "xlsx" extension). |
isobxr_master_file |
Name of isobxr excel master file. (without file "xlsx" extension). Default is "0_ISOBXR_MASTER". |
List of formatted dyn_2D_master_file master inputs.
read.dyn_2D_master(workdir = "/Users/username/Documents/1_ABC_tutorial", dyn_2D_master_file = "0_SWEEP_DYN_demo", isobxr_master_file = "0_ISOBXR_MASTER")
read.dyn_2D_master(workdir = "/Users/username/Documents/1_ABC_tutorial", dyn_2D_master_file = "0_SWEEP_DYN_demo", isobxr_master_file = "0_ISOBXR_MASTER")
A function to read and inspect the sweep.final_nD master files and obtain a master formatted list.
read.final_nD_master(workdir, final_nD_master_file, isobxr_master_file)
read.final_nD_master(workdir, final_nD_master_file, isobxr_master_file)
workdir |
Working directory of isobxr excel master file and where output files will be stored if exported by user. (character string) |
final_nD_master_file |
Name of sweep.final_nD excel master file. (without file "xlsx" extension). |
isobxr_master_file |
Name of isobxr excel master file. (without file "xlsx" extension). Default is "0_ISOBXR_MASTER". |
List contains:
param_space data frame of shuffled all combinations of all parameters values.
sweep.DEFAULT data frame of default run conditions
(flux and coeff lists, t_max, chunk size)
sweep_lists_ids list of names of swept parameters
List of formatted sweep.final_nD master inputs
read.final_nD_master(workdir = "/Users/username/Documents/1_ABC_tutorial", final_nD_master_file = "0_SWEEP_FINnD_demo", isobxr_master_file = "0_ISOBXR_MASTER")
read.final_nD_master(workdir = "/Users/username/Documents/1_ABC_tutorial", final_nD_master_file = "0_SWEEP_FINnD_demo", isobxr_master_file = "0_ISOBXR_MASTER")
A function to read and inspect the isobxr master files and obtain a master formatted list.
read.isobxr_master( workdir, isobxr_master_file = "0_ISOBXR_MASTER", inspect = TRUE, export_rds = FALSE )
read.isobxr_master( workdir, isobxr_master_file = "0_ISOBXR_MASTER", inspect = TRUE, export_rds = FALSE )
workdir |
Working directory of isobxr excel master file and where output files will be stored if exported by user. (character string) |
isobxr_master_file |
Name of isobxr excel master file. (without file "xlsx" extension). Default is "0_ISOBXR_MASTER". |
inspect |
If TRUE, checks all inputs from isobxr master file for format
and structure errors. |
export_rds |
If TRUE, exports rds version of isobxr master file
to working directory. |
A formatted list of data frames containing constants, box, fluxes and fractionation coefficients descriptions.
read.isobxr_master(workdir = "/Users/username/Documents/1_ABC_tutorial", isobxr_master_file = "0_ISOBXR_MASTER", export_rds = FALSE, inspect = TRUE)
read.isobxr_master(workdir = "/Users/username/Documents/1_ABC_tutorial", isobxr_master_file = "0_ISOBXR_MASTER", export_rds = FALSE, inspect = TRUE)
A function to read and inspect the scenario master files and obtain a master formatted list.
read.scenario_master( workdir, scenario_master_file, isobxr_master_file = "0_ISOBXR_MASTER" )
read.scenario_master( workdir, scenario_master_file, isobxr_master_file = "0_ISOBXR_MASTER" )
workdir |
Working directory of isobxr excel master file and where output files will be stored if exported by user. (character string) |
scenario_master_file |
Name of scenario excel master file. (without file "xlsx" extension). |
isobxr_master_file |
Name of isobxr excel master file. (without file "xlsx" extension). Default is "0_ISOBXR_MASTER". |
List of formatted scenario master inputs.
read.scenario_master(workdir = "/Users/username/Documents/1_ABC_tutorial", scenario_master_file = "0_SCENARIO_source_change", isobxr_master_file = "0_ISOBXR_MASTER")
read.scenario_master(workdir = "/Users/username/Documents/1_ABC_tutorial", scenario_master_file = "0_SCENARIO_source_change", isobxr_master_file = "0_ISOBXR_MASTER")
A function to compose an isotope box model scenario,
defined by a series of successive runs,
each run inheriting from the final state conditions of the previous run.
It is possible to force parameters at each run, namely:
fluxes
(overwriting all or a subset of fluxes defined in 0_ISOBXR_MASTER.xlsx master file)
isotope fractionation coefficients
(overwriting all or a subset of coefficients defined in 0_ISOBXR_MASTER.xlsx master file)
box sizes
(overwriting all or a subset of box sizes defined in 0_ISOBXR_MASTER.xlsx master file)
rayleigh isotope distillation
isotope composition of a source box at initial state
sim.scenario( workdir, SERIES_ID, scenario_master_file, isobxr_master_file = "0_ISOBXR_MASTER", plot.hidden_boxes = NULL, plot.time_unit = NULL, export.single_run_digests = FALSE, export.data_as_csv_xlsx = FALSE, show.delta_plot = TRUE, save_outputs = FALSE, inspect_inputs = TRUE )
sim.scenario( workdir, SERIES_ID, scenario_master_file, isobxr_master_file = "0_ISOBXR_MASTER", plot.hidden_boxes = NULL, plot.time_unit = NULL, export.single_run_digests = FALSE, export.data_as_csv_xlsx = FALSE, show.delta_plot = TRUE, save_outputs = FALSE, inspect_inputs = TRUE )
workdir |
Working directory of isobxr excel master file and where output files will be stored if exported by user. |
SERIES_ID |
Name of the series the scenario run belongs to. It determines the folder in which the output files will be stored inside workdir. |
scenario_master_file |
Name of scenario excel master file. |
isobxr_master_file |
Name of isobxr excel master file. |
list of box names (BOX_ID) to hide in scenario plot. |
|
plot.time_unit |
Time unit to use on plot if different from native time unit. |
export.single_run_digests |
If TRUE, exports full digest of each single run of the scenario. Default is FALSE. |
export.data_as_csv_xlsx |
If TRUE, exports full scenario result data as csv and xlsx fo full
to scenario digest directory. |
show.delta_plot |
If TRUE, prints delta and size time evolution plots in R. |
save_outputs |
If TRUE, saves all run outputs to local working directory (workdir). |
inspect_inputs |
If TRUE, inspects and proof checks format of input taken from
isobxr excel master file. |
Delta values and box sizes as a function of time.
sim.scenario outputs are saved to workdir if save_outputs = TRUE.
single run results in SERIES directory: all single runs results as rds files
scenario digest in scenario DIGEST directory (SERIES/DIGEST):
isobxr master file archive as xlsx
scenario master file archive as xlsx
plot of delta and size vs. time as pdf
scenario results data set as rds, containing:
delta_vs_t data frame of delta as a function of time
size_vs_t data frame of box sizes as a function of time
scenario_master list containing all inputs from scenario master file
scenario_log data frame of scenario specific LOG excerpt
isobxr_master list containing all inputs from isobxr master file
paths list of scenario specific paths
## Not run: sim.scenario(workdir = "/Users/username/Documents/1_ABC_tutorial", SERIES_ID = "1_source_change", scenario_master_file = "0_SCENARIO_source_change", isobxr_master_file = "0_ISOBXR_MASTER") ## End(Not run)
## Not run: sim.scenario(workdir = "/Users/username/Documents/1_ABC_tutorial", SERIES_ID = "1_source_change", scenario_master_file = "0_SCENARIO_source_change", isobxr_master_file = "0_ISOBXR_MASTER") ## End(Not run)
A function to run the isobxr stable isotope box model,
assessing the design of the model and automatically running solve_numerically
or solve_analytically
depending on system design.
sim.single_run( workdir, SERIES_ID, flux_list, coeff_list, t_max, n_steps, isobxr_master_file = "0_ISOBXR_MASTER", suppress_messages = FALSE, export.diagrams = FALSE, export.delta_plot = FALSE, export.data_as_csv_xlsx = FALSE, plot.time_as_log10 = TRUE, plot.time_unit = NULL, show.delta_plot = TRUE, inspect_inputs = TRUE, save_outputs = FALSE, return_data = FALSE, solver = "auto", n_zeros_RUN_IDs = 4, FORCING_RAYLEIGH = NULL, FORCING_SIZE = NULL, FORCING_DELTA = NULL, FORCING_ALPHA = NULL, COMPOSITE = FALSE, COMPO_SERIES_n = NaN, COMPO_SERIES_FAMILY = NaN, EXPLORER = FALSE, EXPLO_SERIES_n = NaN, EXPLO_SERIES_FAMILY = NaN, isobxr_master = NULL, diagram_pdf.widh_height = NULL )
sim.single_run( workdir, SERIES_ID, flux_list, coeff_list, t_max, n_steps, isobxr_master_file = "0_ISOBXR_MASTER", suppress_messages = FALSE, export.diagrams = FALSE, export.delta_plot = FALSE, export.data_as_csv_xlsx = FALSE, plot.time_as_log10 = TRUE, plot.time_unit = NULL, show.delta_plot = TRUE, inspect_inputs = TRUE, save_outputs = FALSE, return_data = FALSE, solver = "auto", n_zeros_RUN_IDs = 4, FORCING_RAYLEIGH = NULL, FORCING_SIZE = NULL, FORCING_DELTA = NULL, FORCING_ALPHA = NULL, COMPOSITE = FALSE, COMPO_SERIES_n = NaN, COMPO_SERIES_FAMILY = NaN, EXPLORER = FALSE, EXPLO_SERIES_n = NaN, EXPLO_SERIES_FAMILY = NaN, isobxr_master = NULL, diagram_pdf.widh_height = NULL )
workdir |
Working directory of isobxr excel master file and where output files will be stored if exported by user. (character string) |
SERIES_ID |
Name of the series the run belongs to. |
flux_list |
Name of the list of fluxes and initial box sizes to be used for the run, |
coeff_list |
Name of the list of fractionation coefficients to be used for the run, |
t_max |
Run duration, given in the same time units as unit declared in CONSTANTS |
n_steps |
Number of calculation steps. |
isobxr_master_file |
Name of isobxr excel master file. |
suppress_messages |
If TRUE, hides all information and warning messages regarding run. |
export.diagrams |
If TRUE, exports box-model flux and fractionation diagrams as pdf. |
export.delta_plot |
If TRUE, exports delta and size time evolution plots of the evolution
of the system, as pdf. |
export.data_as_csv_xlsx |
If TRUE, exports all results and run conditions as csv and xlsx files, |
plot.time_as_log10 |
If TRUE, uses logarithmic time scale in plot. |
plot.time_unit |
Time unit to use on plot if different from native time unit. |
show.delta_plot |
If TRUE, prints delta and size time evolution plots in R. Default is TRUE. |
inspect_inputs |
If TRUE, inspects and proof checks format of input taken from
isobxr excel master file. |
save_outputs |
If TRUE, saves all run outputs to local working directory (workdir). |
return_data |
If TRUE, returns all data (inputs and outputs) as a list. |
solver |
Determines what solver to used: "analytical" or "numerical". |
n_zeros_RUN_IDs |
Number of figures used in iteration of RUNs of a given series (SERIES_ID). |
FORCING_RAYLEIGH |
OPTIONAL |
FORCING_SIZE |
OPTIONAL |
FORCING_DELTA |
OPTIONAL |
FORCING_ALPHA |
OPTIONAL |
COMPOSITE |
NOT TO BE USED IN SINGLE RUN |
COMPO_SERIES_n |
NOT TO BE USED IN SINGLE RUN |
COMPO_SERIES_FAMILY |
NOT TO BE USED IN SINGLE RUN |
EXPLORER |
NOT TO BE USED IN SINGLE RUN |
EXPLO_SERIES_n |
NOT TO BE USED IN SINGLE RUN |
EXPLO_SERIES_FAMILY |
NOT TO BE USED IN SINGLE RUN |
isobxr_master |
isobxr_master list of input dataframes formatted by
|
diagram_pdf.widh_height |
Vector of width and height in inches of the pdf diagrams. |
A results data set as a list containing the following components:
inputs input data:
CONSTS data frame of all run specific constants.
INITIAL data frame of delta and sizes at t = 0 in all boxes.
FLUXES data frame of all fluxes intensities (row ID: FROM / col ID: TO)
COEFFS data frame of all fractionation coefficient values (row ID: FROM / col ID: TO)
BOX_META data frame of box specific metadata (e.g., flux balance, residence times, layout position )
bx.groups list of box names grouped by relevant categories (e.g., disconnected boxes, infinite boxes)
LOG data frame of run specific LOG excerpt.
outputs output data:
solver
final_state
delta_vs_t
size_vs_t
for analytical solutions
diffeq_solutions solutions of differential equations,
including relaxation times, eigenvalues, constants, eigenvectors
paths list of run specific paths
## Not run: sim.single_run(workdir = "/Users/username/Documents/1_ABC_tutorial", SERIES_ID = "1_ABC_balanced_closed", flux_list = "Fx1_ABC_bal", coeff_list = "a1", t_max = 2500, n_steps = 2500) ## End(Not run)
## Not run: sim.single_run(workdir = "/Users/username/Documents/1_ABC_tutorial", SERIES_ID = "1_ABC_balanced_closed", flux_list = "Fx1_ABC_bal", coeff_list = "a1", t_max = 2500, n_steps = 2500) ## End(Not run)
An analytical solver of the system of ordinary differential
equations (ODES) of stable isotope ratios of element X in all boxes.
Not intended for manual use.
The analytical solver finds the eigenvalues and eigenvectors of the ODES.
It determines the set of analytical solutions that describes
the evolution of isotope ratios in each box over time.
solve_analytically(IN, paths, to_DIGEST_csv = FALSE, return_results = FALSE)
solve_analytically(IN, paths, to_DIGEST_csv = FALSE, return_results = FALSE)
IN |
input data, edited by |
paths |
paths object edited by |
to_DIGEST_csv |
if TRUE, edits csv outputs to DIGEST directory |
return_results |
if TRUE, results returned as a list of R objects. |
Analytically determined evolution of stable isotope compositions
in all boxes over the run duration as specified in INPUT file.
Run outputs are stored in a temporary directory and not exported by solve_numerically
.
The outputs of the run are stored in the rds output file in the SERIES directory
with the following file name structure:
SERIES_ID + RUN_n.rds
OUT data file with initial and final size and delta values in all boxes.
(file name structure: out_1_A_OUT + SERIES_ID + RUN_n + .csv)
ODE_SOLNs data file summarizing outputs of the analytical solutions of the ODES
(eigenvalues, eigenvectors, relaxation times, constants according to initial conditions).
(file name structure: out_2_A_ODE_SOLNs + SERIES_ID + RUN_n + .csv)
evD data file of the evolution with time of the delta values in all boxes.
(file name structure: out_3_A_evD + SERIES_ID + RUN_n + .csv)
A numerical solver of the system of ordinary differential equations (ODES),
describing the evolution of stable isotope ratios in all boxes of a system.
Not intended for manual use.
The numerical solver uses the deSolve::ode function
to integrate the stable isotopes ratios over time in each box. It allows the
calculation of the evolution of stable isotope ratio in the case of
unbalanced outward and inward fluxes of element X in a given box
resulting in the accumulation or loss of element X.
solve_numerically(IN, paths, to_DIGEST_csv = FALSE, return_results = FALSE)
solve_numerically(IN, paths, to_DIGEST_csv = FALSE, return_results = FALSE)
IN |
input data, edited by |
paths |
paths object edited by |
to_DIGEST_csv |
if TRUE, edits csv outputs to DIGEST directory |
return_results |
if TRUE, results returned as a list of R objects. |
Numerically determined evolution of stable isotope compositions
and masses of element X in all boxes over the run duration as specified in INPUT file.
Run outputs are stored in a temporary directory and not exported by solve_numerically
.
The outputs of the run are stored in the rds output file in the SERIES directory
with the following file name structure:
SERIES_ID + RUN_n.rds
OUT data file storing initial and final size and delta values in all boxes.
(file name structure: out_1_N_OUT + RUN name + .csv)
evS data file storing the evolution with time of the sizes (masses of element X) of all boxes.
(file name structure: out_2_N_evS + RUN name + .csv)
evD data file storing the evolution with time of the delta values in all boxes.
(file name structure: out_3_N_evD + RUN name + .csv)
A function to assess the influence of two parameters (varying over a range of values) on dynamic evolution of a system in response to a given perturbation.
sweep.dyn_2D( workdir, SERIES_ID, plot.time_unit = NULL, isobxr_master_file = "0_ISOBXR_MASTER", sweep_master_file, swept_param_1, swept_param_2, export.data_as_csv_xlsx = TRUE, show.delta_plot = TRUE, save_outputs = FALSE, ask_confirmation = TRUE, keep_single_run_rds = FALSE )
sweep.dyn_2D( workdir, SERIES_ID, plot.time_unit = NULL, isobxr_master_file = "0_ISOBXR_MASTER", sweep_master_file, swept_param_1, swept_param_2, export.data_as_csv_xlsx = TRUE, show.delta_plot = TRUE, save_outputs = FALSE, ask_confirmation = TRUE, keep_single_run_rds = FALSE )
workdir |
Working directory of 0_ISOBXR_MASTER.xlsx master file, |
SERIES_ID |
Name of the sweep series belongs to. |
plot.time_unit |
Time unit to use on plot if different from native time unit. |
isobxr_master_file |
Name of isobxr excel master file. |
sweep_master_file |
Name of sweep.dyn_2D excel master file. (without file "xlsx" extension). |
swept_param_1 |
Set of values of sweeping parameter 1. |
swept_param_2 |
Set of values of sweeping parameter 2. |
export.data_as_csv_xlsx |
If TRUE, exports full sweep result data as csv and xlsx fo full
to sweep digest directory. |
show.delta_plot |
If TRUE, prints delta and size time evolution plots in R. |
save_outputs |
If TRUE, saves all run outputs to local working directory (workdir). |
ask_confirmation |
If TRUE, asks confirmation to run in interactive sessions. |
keep_single_run_rds |
If TRUE, keeps single runs outputs (rds files in SERIES directory). |
Delta values and box sizes as a function of time in response to a perturbation, in a 2D space of parameters sweep.dyn_2D outputs are saved to workdir if save_outputs = TRUE.
single run results in SERIES directory: all single runs results as rds files
(keep_single_run_rds = TRUE)
sweep digest in sweep DIGEST directory (SERIES/DIGEST):
isobxr master file archive as xlsx (export.data_as_csv_xlsx = TRUE)
sweep.dyn_2D master file archive as xlsx (export.data_as_csv_xlsx = TRUE)
sweep.dyn_2D LOG excerpt as csv (export.data_as_csv_xlsx = TRUE)
delta_size_vs_t csv of delta and size vs time in 2D space (export.data_as_csv_xlsx = TRUE)
plot of delta and size vs. time in 2D space as pdf
sweep.dyn_2D results data set as rds, containing:
delta_size_vs_t data frame of delta and size as a function of time
sweeep_master list containing all inputs from sweep master file
sweep_log data frame of sweep specific LOG excerpt
isobxr_master list containing all inputs from isobxr master file
paths list of sweep specific paths
## Not run: sweep.dyn_2D(workdir = "/Users/username/Documents/1_ABC_tutorial", SERIES_ID = "sweep_dyn_test", isobxr_master_file = "0_ISOBXR_MASTER", sweep_master_file = "0_SWEEP_DYN_demo", swept_param_1 = data.frame(FROM = c("A"), TO = c("C"), ALPHA_MIN = 0.999, ALPHA_MAX = 1, ALPHA_STEPS = 0.0005, EXPLO_TYPES = "EXPLO_1_ALPHA"), swept_param_2 = data.frame(BOX_ID = c("B"), SIZE_MIN = 2100, SIZE_MAX = 3000, SIZE_STEPS = 300, EXPLO_TYPES = "EXPLO_1_SIZE"), ask_confirmation = FALSE) ## End(Not run)
## Not run: sweep.dyn_2D(workdir = "/Users/username/Documents/1_ABC_tutorial", SERIES_ID = "sweep_dyn_test", isobxr_master_file = "0_ISOBXR_MASTER", sweep_master_file = "0_SWEEP_DYN_demo", swept_param_1 = data.frame(FROM = c("A"), TO = c("C"), ALPHA_MIN = 0.999, ALPHA_MAX = 1, ALPHA_STEPS = 0.0005, EXPLO_TYPES = "EXPLO_1_ALPHA"), swept_param_2 = data.frame(BOX_ID = c("B"), SIZE_MIN = 2100, SIZE_MAX = 3000, SIZE_STEPS = 300, EXPLO_TYPES = "EXPLO_1_SIZE"), ask_confirmation = FALSE) ## End(Not run)
A function to assess the influence of n parameters (varying over a range of values) on the final state of a system.
sweep.final_nD( workdir, sweep_master_file, sweep_dir_to_complete = NULL, export.data_as_csv_xlsx = FALSE, isobxr_master_file = "0_ISOBXR_MASTER", save_outputs = FALSE )
sweep.final_nD( workdir, sweep_master_file, sweep_dir_to_complete = NULL, export.data_as_csv_xlsx = FALSE, isobxr_master_file = "0_ISOBXR_MASTER", save_outputs = FALSE )
workdir |
Working directory of 0_ISOBXR_MASTER.xlsx master file, |
sweep_master_file |
Name of sweep.final_nD excel master file. (without file "xlsx" extension). |
sweep_dir_to_complete |
Name of directory of previously halted sweep.final_nD
run that the user wishes to continue. Starts with "4_FINnD". |
export.data_as_csv_xlsx |
If TRUE, exports chunk sweep result data as csv and xlsx fo full
to chunk digest directory. |
isobxr_master_file |
Name of isobxr excel master file. |
save_outputs |
If TRUE, saves all run outputs to local working directory (workdir). |
Delta values and box sizes at final state of the system, in the n-dimensions space of parameters. sweep.final_nD outputs are saved to workdir if save_outputs = TRUE.
digest sweep.final_nD outputs full sweep.final_nD outputs are stored in a digest directory directly in workdir:
isobxr master file archive as xlsx
global chunk_log as csv
global chunk_log as rds
sweep.final_nD master file archive as xlsx
sweep.final_nD merged chunks LOG excerpt as csv
sweep.final_nD merged param_space, current progress, as rds (space of swept parameters)
sweep.final_nD merged results, current progress, as rds
data frame containing delta and size at final state across whole n-dimensions space of parameters
sweep.final_nD param_space as planned, as rds
sweep.final_nD sweep_default data frame of default run conditions, as rds
sweep.final_nD sweep progress plot as pdf, follows merging of chunks
chunks sweep.final_nD outputs chunk directories are edited in case total number. of runs exceeds chunk size defined in sweep.final_nD master file. They are removed after full sweep.