First, compiles the vectorized population spatial maps into a series of binary raster PNG files, which is the format that SLiM understands and uses it to define population boundaries. Then extracts the demographic model defined by the user (i.e. population divergences and gene flow events) into a series of tables which are later used by the built-in SLiM script to program the timing of simulation events.

compile(
  populations,
  dir,
  generation_time,
  resolution = NULL,
  competition_dist = NULL,
  mate_dist = NULL,
  dispersal_dist = NULL,
  geneflow = list(),
  overwrite = FALSE,
  sim_length = NULL,
  direction = NULL
)

Arguments

populations

Object(s) of the slendr_pop class (multiple objects need to be specified in a list)

dir

Output directory for the model configuration files which will be loaded by the backend SLiM script

generation_time

Generation time (in model time units)

resolution

How many distance units per pixel?

competition_dist, mate_dist

Maximum spatial competition and mating choice distance

dispersal_dist

Standard deviation of the normal distribution of the parent-offspring distance

geneflow

Geneflow events generated by the geneflow function (either a list of data.frame objects in the format defined by the geneflow function, or a single data.frame)

overwrite

Overwrite the contents of the output directory in case it already exists?

sim_length

Total length of the simulation (required for forward time models, optional for models specified in backward time units which by default run to "the present time")

direction

Intended direction of time. Under normal circumstances this parameter is inferred from the model and does not need to be set manually.

Value

Compiled slendr_model model object