flapper is an R package that provides routines for the analysis of passive acoustic telemetry data, including for data processing, description (via detection statistics and movement metrics), modelling and simulation. These routines are supported by a series of helper functions (including distance calculators, spatial tools and parallelisation options). The main contribution is the provision of a family of algorithms for movement modelling in passive acoustic telemetry systems that permits the reconstruction of fine-scale movement paths and emergent patterns of space use. Package development has been motivated by passive acoustic telemetry data from a Critically Endangered benthic elasmobranch (the flapper skate, Dipturus intermedius) off the west coast of Scotland.

Data processing

Some functions facilitate the acquisition, assembly, processing and checking of passive acoustic telemetry time series:

  • Data acquisition

    • query_open_topo queries the Topo Data Application Programming Interface for elevation/bathymetry data;

  • Data assembly

  • Data processing

    • process_receiver_id adds unique receiver IDs to a dataframe (e.g., if the same receiver has been deployed more than once);

    • process_false_detections_sf passes putative false detections through a spatial filter which incorporates ancillary information on receiver locations and animal swimming speeds to interrogate their plausibility;

    • process_quality_check passes acoustic data through some basic quality checks prior to analysis;

    • process_surface determines an 'optimum' raster aggregation method and error induced by this process;

Spatial tools

Some functions facilitate spatial operations that support common tasks and modelling algorithms:

  • buffer_and_crop buffers a spatial object (e.g., receiver locations) and uses this buffered object to crop another (e.g., the local bathymetry);

  • get_intersection intersects spatial geometries;

  • xy_from_click gets location coordinates from mouse clicks;

  • crop_from_click crops a raster to an area defined by mouse clicks;

  • cells_from_val returns the cells (or a raster of the cells) of a raster that are equal to a specified value or lie within a specified range of values;

  • invert_poly inverts a polygon (e.g, to define the `sea' from a polygon of the `land');

  • mask_io masks values in a raster that lie inside or outside of a spatial mask (e.g., to mask the `land' from the `sea');

  • sim_surface populates a raster with simulated values;

  • split_raster_equally splits a raster into equal pieces (using code from the greenbrown (http://greenbrown.r-forge.r-project.org) package);

  • update_extent shrinks or inflates an extent object;

  • segments_cross_barrier determines if Euclidean transects cross a barrier;

Distance calculations

Some functions facilitate distance calculations, including the calculation of distances between receivers, along 3-dimensional movement paths, and of the shortest paths over a surface.

  • Euclidean distances

    • dist_btw_clicks calculates distances and draws segments between sequential mouse clicks on a map;

    • dist_btw_receivers calculates the Euclidean distances between all combinations of receivers;

    • dist_btw_points_3d calculates the Euclidean distances between points in three-dimensional space;

    • dist_over_surface calculates the Euclidean distance along a path over a three-dimensional surface;

  • Shortest (least-cost) distances

    • lcp_costs calculates the distances between connected cells in a raster, accounting for planar (x, y, diagonal) and vertical (z) distances;

    • lcp_graph_surface constructs connected graphs for least-cost paths analysis;

    • lcp_from_point calculates least-cost distances from a point on a raster to all of the other cells of a raster;

    • lcp_over_surface calculates the shortest path(s) and/or the distances of the shortest path(s) over a surface between origin and destination coordinates;

    • lcp_interp interpolates paths between sequential locations using least-cost paths analysis;

    • lcp_comp compares Euclidean and shortest distance metrics for an area;

Detection statistics

Some functions facilitate the calculation of detection statistics, including those related to sampling effort and to detections of individuals:

Movement metrics

Building on the analysis of detection time series, some functions provide movement metrics:

Modelling algorithms

The main thrust of flapper is the implementation of existing and new algorithms designed to reconstruct fine-scale movement paths and emergent patterns of space use in passive acoustic telemetry systems:

Simulations

A set of sim_*() functions provide an integrated workflow for the simulation of receiver arrays, movement paths and detections under different array designs, movement models and detection models:

  • sim_array simulates alternative array designs;

  • sim_path_* functions simulate discrete-time movement paths, including:

    • sim_path_sa, supported by sim_steps and sim_angles, simulates movement paths (possibly in restricted areas) from step lengths and turning angles;

    • sim_path_ou_1 simulates movement paths under Ornstein-Uhlenbeck processes;

  • sim_detections simulates detections at receivers arising from movement paths under a diversity of detection probability models;

Another set of functions facilitate the evaluation of the performance of alternative algorithms for inferring patterns of space use under different array designs, movement models and detections models:

  • eval_by_kud compares patterns of space use inferred from simulated and estimated movement paths using kernel utilisation distributions;

Parallelisation

Parallelisation is facilitated by the cl_*() function family:

See also

https://github.com/edwardlavender/flapper

Author

Edward Lavender