ecoscope.analysis#

Subpackages#

Submodules#

Package Contents#

class ecoscope.analysis.Ecograph(trajectory, resolution=15, radius=2, cutoff=None, tortuosity_length=3)[source]#

A class that analyzes movement tracking data using Network Theory.

Parameters:
  • trajectory (ecoscope.base.Trajectory) – Trajectory dataframe

  • resolution (float) – Pixel size, in meters

  • radius (int) – Radius to compute Collective Influence (Default : 2)

  • cutoff (int) – Cutoff to compute an approximation of betweenness index if the standard algorithm is too slow. Can be useful for very large graphs (Default : None)

  • tortuosity_length (int) – The number of steps used to compute the two tortuosity metrics (Default : 3 steps)

to_csv(output_path)[source]#

Saves the features of all nodes in a CSV file

Parameters:

output_path (str, Pathlike) – Output path for the CSV file

to_geotiff(feature, output_path, individual='all', interpolation=None, transform=None)[source]#

Saves a specific node feature as a GeoTIFF

Parameters:
  • feature (str) – Feature of interest

  • output_path (str, Pathlike) – Output path for the GeoTIFF file

  • individual (str) – The individual for which we want to output the node feature (Default : “all”)

  • interpolation (str or None) – Whether to interpolate the feature for each step in the trajectory (Default : None). If provided, has to be one of those four types of interpolation : “mean”, “median”, “max” or “min”

  • transform (sklearn.base.TransformerMixin or None) – A feature transform method (Default : None)

static _get_ecograph(self, trajectory_gdf, individual_name, radius, cutoff, tortuosity_length)[source]#
static _update_node(G, node_id, attributes)[source]#
static _get_day_night_value(day_night_value)[source]#
static _initialize_node(G, node_id, attributes, empty=False)[source]#
static _get_dot_product(x, y, z, w)[source]#
static _get_tortuosities(self, lines, time_delta)[source]#
static _compute_network_metrics(self, G, radius, cutoff)[source]#
static _compute_degree(G)[source]#
static _compute_collective_influence(self, G, radius)[source]#
static _get_collective_influence(G, start, radius)[source]#
static _compute_betweenness(G, cutoff)[source]#
static _get_feature_mosaic(self, feature, interpolation=None)[source]#
static _get_feature_map(self, feature, individual, interpolation)[source]#
static _get_regular_feature_map(self, feature, individual)[source]#
static _get_interpolated_feature_map(self, feature, individual, interpolation)[source]#
ecoscope.analysis.get_feature_gdf(input_path)[source]#

Convert a GeoTIFF feature map into a GeoDataFrame

Parameters:

input_path (str, Pathlike) – Input path for the GeoTIFF file

ecoscope.analysis.get_percentile_area(percentile_levels, raster_path, subject_id='')[source]#
Parameters:
  • percentile_levels (Typing.List[Int]) – list of k-th percentile scores.

  • raster_path (str or os.PathLike) – file path to where the raster is stored.

  • subject_id (str) – unique identifier for the subject

Return type:

GeoDataFrame

class ecoscope.analysis.SpeedDataFrame(data=None, *args, **kwargs)[source]#

Bases: ecoscope.base.EcoDataFrame

EcoDataFrame extends geopandas.GeoDataFrame to provide customizations and allow for simpler extension.

classmethod from_trajectory(trajectory, classification_method='equal_interval', num_classes=6, bins=None, speed_colors=None)[source]#
Parameters:
  • trajectory (ecoscope.base.Trajectory) –

  • classification_method (str) –

  • num_classes (int) –

  • bins (List) –

  • speed_colors (List) –