calc_min_dist_box: Calculate minimum distance to lateral and end walls in a...

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/analytical_functions.R

Description

Calculate minimum distance to lateral and end walls in a box-shaped experimental tunnel

Usage

1

Arguments

obj_name

The input viewr object; a tibble or data.frame with attribute pathviewr_steps that include "viewr" and treatments_added.

Details

calc_min_dist_box() assumes the subject locomotes facing forward, therefore min_dist_end represents the minimum distance between the subject and the end wall to which it is moving towards. All outputs are in meters.

Value

A tibble or data.frame with added variables for min_dist_pos, min_dist_neg, and min_dist_end,.

Author(s)

Eric R. Press

See Also

Other visual perception functions: get_sf(), get_vis_angle()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
## Import sample data from package
 flydra_data <-
 read_flydra_mat(system.file("extdata", "pathviewr_flydra_example_data.mat",
                               package = 'pathviewr'),
                               subject_name = "birdie_sanders")

   ## Process data up to and including insert_treatments()
  flydra_data_full <-
   flydra_data %>%
   redefine_tunnel_center(length_method = "middle",
                         height_method = "user-defined",
                         height_zero = 1.44) %>%
   select_x_percent(desired_percent = 50) %>%
   separate_trajectories(max_frame_gap = "autodetect") %>%
   get_full_trajectories(span = 0.95) %>%
   insert_treatments(tunnel_config = "box",
                    tunnel_length = 3,
                    tunnel_width = 1,
                    stim_param_lat_pos = 0.1,
                    stim_param_lat_neg = 0.1,
                    stim_param_end_pos = 0.3,
                    stim_param_end_neg = 0.3,
                    treatment = "lat10_end_30") %>%

   ## Now calculate the minimum distances to each wall
   calc_min_dist_box()

   ## See 3 new variables for calculations to lateral and end walls
   names(flydra_data_full)

pathviewr documentation built on May 6, 2021, 9:07 a.m.