Adds information about treatment and experimental set up to viewr objects for analysis in other pathviewR functions

insert_treatments(
  obj_name,
  vertex_height = NULL,
  vertex_angle = NULL,
  pos_wall = NULL,
  neg_wall = NULL,
  front_wall = NULL,
  stim_param_pos = NULL,
  stim_param_neg = NULL,
  stim_param_front = NULL,
  treatment = NULL
)

Arguments

obj_name

The input viewr object; a tibble or data.frame with attribute pathviewR_steps that includes "viewr"

vertex_height

If using a V-shaped chamber, this is the height of the vertex. This value should be negative and represents the distance between the origin (0,0,0) and the vertex.

vertex_angle

If using a V-shaped chamber, this is the angle (in degrees) subtended by a vertical axis and the sides of the V-shaped chamber. Equivalent to half the angle of the "V". vertex_angle defaults to 45.

pos_wall

If using a box-shaped chamber, this is the distance in meters between the origin (0,0,0) and the positive wall.

neg_wall

If using a box-shaped chamber, this is the distance in meters between the origin (0,0,0) and the negative wall.

front_wall

If using a box-shaped chamber, this is the distance in meters between the origin (0,0,0) and the front wall.

stim_param_pos

The width of the visual stimulus cycle displayed on the positive wall of the chamber.

stim_param_neg

The width of the visual stimulus cycle displayed on the negative wall of the chamber.

stim_param_front

If using a box-shaped chamber, the width of the visual stimulus cycle on the front wall.

treatment

The name of the treatment assigned to all rows of the viewr object. Currently only able to accept a single treatment per viewr object.

Value

A viewr object (tibble or data.frame with attribute pathviewR_steps that includes "treatments added"). Depending on the chamber configuration, it also includes columns for vertex_height, vertex_angle, pos_wall, neg_wall, front_wall, and treatment. This experiment information is also stored in the viewr object's metadata

Details

All length measurements reported in meters.

Author

Eric R. Press

Examples

## Import sample data from package motive_data <- read_motive_csv(system.file("extdata", "pathviewR_motive_example_data.csv", package = 'pathviewR')) ## Clean data up to and including get_full_trajectories() motive_data_full <- motive_data %>% relabel_viewr_axes() %>% gather_tunnel_data() %>% trim_tunnel_outliers() %>% rotate_tunnel() %>% get_velocity() %>% select_x_percent(desired_percent = 50) %>% separate_trajectories(max_frame_gap = "autodetect") %>% get_full_trajectories(span = 0.95)
#> autodetect is an experimental feature -- please report issues.
## Now add information about the experimental configuration. In this example, ## a V-shaped chamber in which the vertex is 90deg and lies 0.40m below the ## origin. The visual stimuli on the lateral walls both have a cycle of 0.1m ## and the treatment is labeled "latA" motive_data_V <- motive_data_full %>% insert_treatments(vertex_height = -0.40, vertex_angle = 45, stim_param_pos = 0.1, stim_param_neg = 0.1, treatment = "latA") ## For an experiment using the box-shaped configuration where the origin lies ## 0.5m away from the front and lateral walls and the treatment is labeled ## "latB". #motive_data_box %>% #insert_treatments(pos_wall = 0.5, # neg_wall = 0.5, # front_wall = 0.5, # treatment = "latB")