The DEoptim calibration fits seven parameters on a transformed scale: the four spawnNewActive probabilities and the two sizeCutoffs are fitted as base-10 logarithms, while spreadProb is fitted directly. This function is the single definition of that convention – it was previously repeated at eight call sites.

The calibration results live in a CSV (LandMine_DEoptim_params.csv) whose schema is date, pixelSize, then par1..par7. These accessors are the single definition of that schema; previously it was written in one place and read in two others, and the two writers disagreed (one appended, one overwrote).

landmine_optim_unpack(par)

landmine_optim_params_read(file, rowID = NULL)

landmine_optim_params_append(
  file,
  par,
  pixelSize,
  objective = NA_character_,
  date = format(Sys.time(), "%Y-%m-%d")
)

Arguments

par

Numeric vector of length 7 to append (see landmine_optim_unpack()).

file

Path to the calibration CSV.

rowID

Optional row number to extract. If NULL (default), all rows are returned.

pixelSize

Pixel resolution (m) the calibration was run at.

objective

Name of the objective the fit was made against. Recorded because parameter values are only comparable within one objective: fits made against landmine_optim_fitSN() before its size penalty was repaired, or before fire sizes were specified in hectares, are not comparable to anything fitted since.

date

Date of the run, as a string. Defaults to today.

Value

A named list with elements spawnNewActive (length 4), sizeCutoffs (length 2), and spreadProb (length 1), all on the natural scale.

landmine_optim_params_read() returns a named numeric vector of length 7 when rowID is given, otherwise a matrix with one row per calibration run.

landmine_optim_params_append() invisibly returns the full table as written.

Examples

landmine_optim_unpack(c(-0.22, -1.55, -0.65, -1.48, 3.21, 4.72, 0.856))
#> $spawnNewActive
#> [1] 0.60255959 0.02818383 0.22387211 0.03311311
#> 
#> $sizeCutoffs
#> [1]  1621.81 52480.75
#> 
#> $spreadProb
#> [1] 0.856
#>