simulTrajec: Simulate trajectories and save as png files.

Description Usage Arguments Author(s) Examples

View source: R/simulationFunctions.R

Description

simulTrajec simulates movement trajectories within a bounded space, movements are set with speed (h) and may be correlated in direction (rho). Function simulates movement of particles in a video sequence of certain number of frames (nframes) in length. Images are saved as png files.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
simulTrajec(
  nframes = 20,
  nIndividuals = 10,
  h = 0.02,
  rho = 0,
  domain = "square",
  correctBoundary = TRUE,
  sizes = stats::runif(nIndividuals) * 0.012 + 0.01,
  staticNoise = FALSE,
  movingNoise = FALSE,
  name = "trajectory",
  path = NULL,
  parsMoving = list(density = 10, duration = 10, size = 1, speed = 10, colRange = c(0,
    1)),
  parsStatic = list(density = 10, blur = TRUE, blurCoef = 0.025, sizes = NULL, col =
    "red"),
  width = 480,
  height = NULL
)

Arguments

nframes

Number of time frames(steps).

nIndividuals

Number of individual trajectories.

h

Displacement speed in pixels.

rho

Correlation parameter for angle of displacement.

domain

One of "square" or "circle", imposing a [0-1,0-1] rectangle domain, or a circular domain of radius 1, respectively. correct boundary ensure individual trajectories do not cross the domain

correctBoundary

Logical. TRUE to make sure that individuals cannot leave the image.

sizes

Vector of sizes for each simulated particle of length nIndividuals.

staticNoise

Logical. If TRUE, static noise is added.

movingNoise

Logical. If TRUE, moving noise is added.

name

Stem of the filename.

path

to location where the created images should be saved. By default the working directory is used.

parsMoving

List of parameters used to generate moving noise these include the density of noise particles (density), their duration (in n frames; duration), their size (size=1), their speed (speed=10) and the range or colors they are randomly drawn from (colRange=c(0,1)).

parsStatic

List of parameters used to generate static noise. These include the density (per image) of noise particles (density), whether spots look blurry (blur=TRUE or blur=FALSE), a blurring coefficient (blurCoef=0.025), and the size of the spots (with sizes).

width

of created png image. By default 480.

height

of create png image. If NULL, width is used.

Author(s)

Caspar A. Hallmann, Marjolein Bruijning & Marco D. Visser

Examples

1
2
3
4
5
6
7
8
9
## Not run: 
dir.create("images")
## Create image sequence and save as png's in the working directory.
traj <- simulTrajec(path="images",
                    nframes=30,nIndividuals=20,domain="square",
                    h=0.01,rho=0.9,
                    sizes=runif(20,0.004,0.006))

## End(Not run)

marjoleinbruijning/trackdem documentation built on Sept. 29, 2021, 7:52 a.m.