tobac.analysis.feature_analysis#
Description
Perform analysis on the properties of detected features
- tobac.analysis.feature_analysis.area_histogram(features, mask, bin_edges=array([0, 500, 1000, 1500, 2000, 2500, 3000, 3500, 4000, 4500, 5000, 5500, 6000, 6500, 7000, 7500, 8000, 8500, 9000, 9500, 10000, 10500, 11000, 11500, 12000, 12500, 13000, 13500, 14000, 14500, 15000, 15500, 16000, 16500, 17000, 17500, 18000, 18500, 19000, 19500, 20000, 20500, 21000, 21500, 22000, 22500, 23000, 23500, 24000, 24500, 25000, 25500, 26000, 26500, 27000, 27500, 28000, 28500, 29000, 29500]), density=False, method_area=None, return_values=False, representative_area=False)#
Create an area histogram of the features. If the DataFrame does not contain an area column, the areas are calculated.
- Parameters:
features (pandas.DataFrame) – DataFrame of the features.
mask (iris.cube.Cube) – Cube containing mask (int for tracked volumes 0 everywhere else). Needs to contain either projection_x_coordinate and projection_y_coordinate or latitude and longitude coordinates. The output of a segmentation should be used here.
bin_edges (int or ndarray, optional) – If bin_edges is an int, it defines the number of equal-width bins in the given range. If bins is a ndarray, it defines a monotonically increasing array of bin edges, including the rightmost edge. Default is np.arange(0, 30000, 500).
density (bool, optional) – If False, the result will contain the number of samples in each bin. If True, the result is the value of the probability density function at the bin, normalized such that the integral over the range is 1. Default is False.
return_values (bool, optional) – Bool determining wether the areas of the features are returned from this function. Default is False.
representive_area (bool, optional) – If False, no weights will associated to the values. If True, the weights for each area will be the areas itself, i.e. each bin count will have the value of the sum of all areas within the edges of the bin. Default is False.
- Returns:
hist (ndarray) – The values of the histogram.
bin_edges (ndarray) – The edges of the histogram.
bin_centers (ndarray) – The centers of the histogram intervalls.
areas (ndarray, optional) – A numpy array approximating the area of each feature.
- tobac.analysis.feature_analysis.histogram_featurewise(Track, variable=None, bin_edges=None, density=False)#
Create a histogram of a variable from the features (detected objects at a single time step) of a track. Essentially a wrapper of the numpy.histogram() method.
- Parameters:
Track (pandas.DataFrame) – The track containing the variable to create the histogram from.
variable (string, optional) – Column of the DataFrame with the variable on which the histogram is to be based on. Default is None.
bin_edges (int or ndarray, optional) – If bin_edges is an int, it defines the number of equal-width bins in the given range. If bins is a sequence, it defines a monotonically increasing array of bin edges, including the rightmost edge.
density (bool, optional) – If False, the result will contain the number of samples in each bin. If True, the result is the value of the probability density function at the bin, normalized such that the integral over the range is 1. Default is False.
- Returns:
hist (ndarray) – The values of the histogram
bin_edges (ndarray) – The edges of the histogram
bin_centers (ndarray) – The centers of the histogram intervalls
- tobac.analysis.feature_analysis.nearestneighbordistance_histogram(features, bin_edges=array([0, 500, 1000, 1500, 2000, 2500, 3000, 3500, 4000, 4500, 5000, 5500, 6000, 6500, 7000, 7500, 8000, 8500, 9000, 9500, 10000, 10500, 11000, 11500, 12000, 12500, 13000, 13500, 14000, 14500, 15000, 15500, 16000, 16500, 17000, 17500, 18000, 18500, 19000, 19500, 20000, 20500, 21000, 21500, 22000, 22500, 23000, 23500, 24000, 24500, 25000, 25500, 26000, 26500, 27000, 27500, 28000, 28500, 29000, 29500]), density=False, method_distance=None, return_values=False)#
Create an nearest neighbor distance histogram of the features. If the DataFrame does not contain a ‘min_distance’ column, the distances are calculated.
- bin_edgesint or ndarray, optional
If bin_edges is an int, it defines the number of equal-width bins in the given range. If bins is a ndarray, it defines a monotonically increasing array of bin edges, including the rightmost edge. Default is np.arange(0, 30000, 500).
- densitybool, optional
If False, the result will contain the number of samples in each bin. If True, the result is the value of the probability density function at the bin, normalized such that the integral over the range is 1. Default is False.
- method_distance{None, ‘xy’, ‘latlon’}, optional
Method of distance calculation. ‘xy’ uses the length of the vector between the two features, ‘latlon’ uses the haversine distance. None checks wether the required coordinates are present and starts with ‘xy’. Default is None.
- return_valuesbool, optional
Bool determining wether the nearest neighbor distance of the features are returned from this function. Default is False.
- Returns:
hist (ndarray) – The values of the histogram.
bin_edges (ndarray) – The edges of the histogram.
distances, optional (ndarray) – A numpy array with the nearest neighbor distances of each feature.
Functions
|
Create an area histogram of the features. |
|
Calculate the area of the segments for each feature. |
|
Calculate the distance between a feature and the nearest other feature in the same timeframe. |
|
Create a histogram of a variable from the features (detected objects at a single time step) of a track. |
|
Create an nearest neighbor distance histogram of the features. |