trajectory_data: Convert experimental particle tracking data to particle.data...

View source: R/particle_functions.R

trajectory_dataR Documentation

Convert experimental particle tracking data to particle.data object

Description

Processes experimental particle tracking data and creates a standardized particle.data object. This function handles time series data with varying numbers of particles across time steps and maintains particle identity tracking between consecutive frames.

Usage

trajectory_data(particle_data)

Arguments

particle_data

A data frame containing particle tracking data with the following required columns:

  • px, py: Particle positions in x and y coordinates

  • vx, vy: Particle velocities in x and y directions

  • time: Time step identifier (integer). Must be consecutive integers starting from the minimum time value

  • particleID: Unique particle identifier for tracking across frames

Value

Returns an S4 object of class particle.data with:

px_list, py_list

Lists of particle x and y positions at each time step

vx_list, vy_list

Lists of particle x and y velocities at each time step

theta_list

List of particle angles computed from velocities

particle_tracking

List of data frames containing particle mappings between consecutive frames

data_type

"experiment"

n_particles

Vector recording number of particles at each time step

T_time

Total number of time steps

D_y

Dimension of the output space (set to 1)

See Also

particle.data-class for details on the particle.data class structure

Examples

# Create sample tracking data
sample_data <- data.frame(time = rep(1:3, each = 5),
                          particleID = rep(1:5, 3),
                          px = rnorm(15),py = rnorm(15),
                          vx = rnorm(15),vy = rnorm(15)
)
# Convert to particle.data object
traj <- trajectory_data(sample_data)
# Display summary
show(traj)

FastGaSP documentation built on April 4, 2025, 5:16 a.m.