Skip to content

Latest commit

 

History

History
94 lines (59 loc) · 4.88 KB

REPRODUCEME.md

File metadata and controls

94 lines (59 loc) · 4.88 KB

Instructions for Repetition of Study

This file describes how to reproduce the analysis of "Identification of the Mode of Evolution in Incomplete Carbonate Successions"

Authors

Niklas Hohmann
Utrecht University
email: n.hohmann [at] uu.nl
Web page: uu.nl/staff/NHohmann
Orcid: 0000-0003-1559-1838

Reproducibility

There are multiple ways to reproduce and repeat the study:

  1. Full reproduction, where all data is generated anew from scratch
  2. Inspection of the provided data
  3. Reproduction of figures alone

Each point is described separately, and can be performed independent of the others.

To get started, download all required data from OSF. For this, open the RProject as described in the README, and run the following in R:

source("code/utils.R")
get_data_from_osf(link = "https://osf.io/zbpwa/")

1. Full reproduction of data

1.1 Simulate carbonate platform in CarboCATLite

  1. Clone the "scenarioA" branch of the CarboCATLite repository from here.
  2. Run the file "carbocatGUI.m" in Matlab.
  3. Click initialize in the GUI. The GUI after initialization is saved under "figs/matlab/scenarioA_initial_conditions.pdf".
  4. Click "Run CA model". This will start the model run, progress is displayed in the console.
  5. Once the console outputs indicates the run is finished, save the glob variable in your workspace. The generated data is identical to the data saved under "data/matlab_outputs/scenarioA_glob_matlab_outputs.mat". It constains all the raw data generated by CarboCAT.
  6. Click "Plot run" to generate the chronostratigraphic chart and dip section. This figure is saved under "data/matlab_outputs/figs/scenarioA_dip_section_and_chronostrat.pdf". This might take a while.

Repeat for the branch scenarioB, which is available here. The generated data is available in "data/matlab_outputs/scenarioB_glob_matlab_outputs.mat", the figures are "data/matlab_outputs/figs/scenarioB_initial_conditions.pdf" and "data/matlab_outputs/figs/scenarioB_dip_section_and_chronostrat.pdf"

For a description of the data generated by Matlab, see codebook.md in the data/matlab_outputs/ folder.

1.2 Extract age-depth models from CarboCATLite

Run _data/matlab_outputs/get_adm_from_carbocat_outputs.m" in Matlab. This extracts age-depth information from the CarboCATLite outputs and generates the file "scenarioA_and_B_matlab_to_R.mat", which can be read into R.

1.3 Run analyses in R

Open the R Project in Rstudio as described in README. Then run

source("code/process_adm_from_matlab.R")

in R. This imports the age-depth models into R, calculates hiatus durations and (in)completeness, and saves the results in "data/R_outputs/ageDepthModelsScenariosAandB.Rdata". See codebook.md in the same folder for a description of the data saved.

Next, run

source("code/parameters_for_tests.R")

to load the parameters for the sets, and save them under "data/R_outputs/parameters_for_tests.Rdata". See codebook.md in the same folder for a description of the data saved.

Last, run

source("code/simulate_and_test_modes_of_evolution.R")

to run the tests based on the specified parameters and age-depth models. Runtime is multiple hours! The results are saved under under "data/R_outputs/results_modes_of_evolution.Rdata". See codebook.md in the same folder for a description of the data saved.

From here, you can continue to inspect the generated data or generate the plots as described below.

2. Inspection of provided data

All data is in the folder /data/. For a detailed description of the data structure and contents see the file /data/R_outputs/codebook.md (for outputs from R) and /data/matlab_outputs/codebook.md (for outputs from matlab).

R outputs can be visualized using the scripts in code/visualize_data.R.

3. Reproduction of figures

To reproduce the figures in the main test and supplementary material, open the R project ad described in the README, download the data as described in the section above, and run

source("code/make_plots.R")

This will use the data in /data/R_outputs/ to generate summary figures in the folder /figs/R/

NOTE: Only the figures displaying AIC weights make use of the test results stored in /data/R_outputs/results_modes_of_evolution.Rdata. All lineages are simulated anew when make_plots is run. To make the plots reproducible, they can be seeded via the parameter plot_seed for each figure.
This is a result of the study design. The tests simulate lineages at a specific basin position. Because trait values are random, this makes it impossible to compare identical simulated lineages across multiple basin positions. This problem is circumvented in the functions used for plotting, see /code/make_plots.R for details.