Adjust trajectories so that all trajectories have the same start position.

mt_align_start(
  data,
  use = "trajectories",
  save_as = use,
  dimensions = c("xpos", "ypos"),
  start = c(0, 0),
  verbose = FALSE
)

Arguments

data

a mousetrap data object created using one of the mt_import functions (see mt_example for details). Alternatively, a trajectory array can be provided directly (in this case use will be ignored).

use

a character string specifying which trajectory data should be used.

save_as

a character string specifying where the resulting trajectory data should be stored.

dimensions

a character vector specifying the dimensions in the trajectory array that should be aligned.

start

a numeric vector specifying the start values for each dimension, i.e., the values the first recorded position should have in every trial. If NULL, trajectories are aligned to the mean first position across all trials.

verbose

logical indicating whether function should report its progress.

Value

A mousetrap data object (see mt_example) with aligned trajectories. All other trajectory dimensions not specified in dimensions (e.g., timestamps) will be kept as is in the resulting trajectory array. If the trajectory array was provided directly as data, only the trajectory array will be returned.

See also

mt_align_start_end for aligning the start and end position of trajectories.

mt_align as a general purpose function for aligning and rescaling trajectories.

mt_remap_symmetric for remapping trajectories.

Author

Pascal J. Kieslich

Felix Henninger

Examples

# Import raw trajectories for demonstration
mt_example <- mt_import_mousetrap(mt_example_raw)

# Align trajectories to start coordinates (0,0)
mt_example <- mt_align_start(mt_example,
  start=c(0,0))
  

# Import raw trajectories for demonstration
mt_example <- mt_import_mousetrap(mt_example_raw)

# Align trajectories to mean first coordinates
mt_example <- mt_align_start(mt_example,
  start=NULL)