get_vis_angle: Estimate visual angles from a subject's perspective in an...

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

View source: R/analytical_functions.R

Description

Estimate visual angles from a subject's perspective in an experimental tunnel

Usage

1
get_vis_angle(obj_name)

Arguments

obj_name

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

Details

get_vis_angle() assumes the following:

Value

A tibble or data.frame with added variables for vis_angle_pos_rad, vis_angle_pos_deg, vis_angle_neg_rad, vos_angle_neg_deg, vis_angle_end_rad, and vis_angle_end_deg.

Author(s)

Eric R. Press

See Also

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

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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
 ## Import sample data from package
motive_data <-
  read_motive_csv(system.file("extdata", "pathviewr_motive_example_data.csv",
                              package = 'pathviewr'))
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 get_min_dist()
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") %>%
  calc_min_dist_v(simplify_output = TRUE) %>%

  ## Now calculate the visual angles
  get_vis_angle()

  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") %>%
  calc_min_dist_box() %>%

   ## Now calculate the visual angles
  get_vis_angle()

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