View source: R/analytical_functions.R
calc_min_dist_v | R Documentation |
Calculate minimum distance to lateral and end walls in a V-shaped experimental tunnel
calc_min_dist_v(obj_name, simplify_output = TRUE)
obj_name |
The input viewr object; a tibble or data.frame with attribute
|
simplify_output |
If TRUE, the returned object includes only the minimum distance between the subject and the lateral/end walls. If FALSE, the returned object includes all variables internal to the calculation. |
For tunnels in which vertex_angle
is >90 degree,
bound_pos
and bound_neg
represent a planes orthogonal to the
lateral walls and are used to modify min_dist_pos
and
min_dist_neg
calculations to prevent erroneous outputs.
calc_min_dist_v()
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.
A tibble or data.frame with added variables for
height_2_vertex
, height_2_screen
, width_2_screen_pos
,
width_2_screen_neg
, min_dist_pos
, min_dist_neg
,
min_dist_end
, bound_pos
, and bound_neg
.
Eric R. Press
Other mathematical functions:
deg_2_rad()
,
find_curve_elbow()
,
get_2d_angle()
,
get_3d_angle()
,
get_3d_cross_prod()
,
get_dist_point_line()
,
get_traj_velocities()
,
get_velocity()
,
rad_2_deg()
## Import sample data from package
motive_data <-
read_motive_csv(system.file("extdata", "pathviewr_motive_example_data.csv",
package = 'pathviewr'))
## Process data up to and including insert_treatments()
motive_data_full <-
motive_data %>%
relabel_viewr_axes() %>%
gather_tunnel_data() %>%
trim_tunnel_outliers() %>%
rotate_tunnel() %>%
select_x_percent(desired_percent = 50) %>%
separate_trajectories(max_frame_gap = "autodetect") %>%
get_full_trajectories(span = 0.95) %>%
insert_treatments(tunnel_config = "v",
perch_2_vertex = 0.4,
vertex_angle = 90,
tunnel_length = 2,
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_v(simplify_output = TRUE)
## See 3 new variables for calculations to lateral and end walls
names(motive_data_full)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.