This repository contains the R and python code for simulating demic diffusion of tropical forest farmers in lowland South America, namely the Tupi language family, and the role of climate change/forest expansion in shaping their dispersal.
For details, please see:
Souza J.G., Noelli F.S., Madella M. Reassessing the role of climate change in the Tupi expansion.
The python model implements a cellular automaton simulating population growth and dispersal in a dynamic environment. Every run starts with a single settled cell, whose population is initialised at K, immediately dispersing to the neighbouring cells. Each time step, for every cell that is inhabited, population growth and dispersal methods are applied, and simulated dates of arrival are recorded. Models can be run in which all land cells may be settled, and others in which settlement is restricted to tropical moist forest.
To run:
>>> python3 python/main.py
This will run a number of models with different parameters and calculate the scores based on the difference from the empirical 14C dates. The scores will be written to results/ca_scores.csv
and the simulated dates with the default parameters will be written to results/sim_dates.csv
. Time slices (every 30 generations) and the final simulated arrival times will be written as rasters to the folder results/rasters
.
The R code implements an equation-based model of front propagation with an underlying cost surface. The cost of traversing different biomes can be adjusted for the cost surface, e.g. slowing down the expansion in non-forested biomes. All simulations start 5000 BP at the coordinates of the Tupi site with the earliest date.
To run, start R and change to the respective directory:
> setwd("R")
> source("main.R")
This will run a number of models with different parameters and values for the cost surface. Scores will be written to results/ebm_scores.csv
. The figures used in the article (arrival times under different models, scatterplots of real and simulated dates vs distances from origin, time slices) will also be written to folder img
.