toad.postprocessing.stats.space¶
Classes
|
Class containing functions for calculating space-related statistics for clusters, such as mean, median, std, etc. |
- class toad.postprocessing.stats.space.SpaceStats(toad, var)¶
Bases:
objectClass containing functions for calculating space-related statistics for clusters, such as mean, median, std, etc.
- all_stats(cluster_id)¶
Return all cluster stats
- Return type:
dict
- central_point_for_labeling(cluster_id)¶
Calculates a central point within the cluster’s spatial footprint suitable for labeling.
This method uses the Euclidean Distance Transform to find the point within the cluster footprint that is furthest from any edge (the “pole of inaccessibility”). This ensures the point is robustly inside the cluster shape, even for complex geometries like rings or C-shapes.
- Parameters:
cluster_id – The ID of the cluster to analyze.
- Returns:
A tuple containing the (y, x) coordinates of the calculated central point. Returns (np.nan, np.nan) if the footprint is empty.
- Return type:
tuple[float, float]
- footprint_cumulative_area(cluster_id)¶
Returns the total number of spatial cells that were ever touched by the cluster.
- Return type:
int
- footprint_mean(cluster_id)¶
Returns the mean of the spatial coordinates of the cluster footprint.
- footprint_median(cluster_id)¶
Returns the median of the spatial coordinates of the cluster footprint.
- footprint_std(cluster_id)¶
Returns the standard deviation of the spatial coordinates of the cluster footprint.
- mean(cluster_id)¶
Returns the mean of the spatial coordinates across space and time.
- median(cluster_id)¶
Returns the median of the spatial coordinates across space and time.
- std(cluster_id)¶
Returns the standard deviation of the spatial coordinates across space and time.