Statistics

Distance Metrics

Contains utilities for calculating distance values.

This module defines utility functions for distance metrics that can be used to compare simulated and observational data.

class deeprootgen.statistics.distance_metrics.DistanceMetricBase(**_)[source]

The distance metric abstract class.

abstract calculate(observed: ndarray, simulated: ndarray) float | ndarray[source]

Calculate the distance between observed and simulated data.

Args:
observed (np.ndarray):

The observed data.

simulated (np.ndarray):

The simulated data.

Raises:
NotImplementedError:

Error raised for the unimplemented abstract method.

class deeprootgen.statistics.distance_metrics.L1Norm(**_)[source]

The L1 norm distance.

calculate(observed: ndarray, simulated: ndarray) float | ndarray[source]

Calculate the distance between observed and simulated data.

Args:
observed (np.ndarray):

The observed data.

simulated (np.ndarray):

The simulated data.

class deeprootgen.statistics.distance_metrics.MeanAbsoluteError(**_)[source]

The mean absolute error distance.

calculate(observed: ndarray, simulated: ndarray) float | ndarray[source]

Calculate the distance between observed and simulated data.

Args:
observed (np.ndarray):

The observed data.

simulated (np.ndarray):

The simulated data.

class deeprootgen.statistics.distance_metrics.MeanAbsolutePercentageError(**_)[source]

The mean absolute percentage error distance.

calculate(observed: ndarray, simulated: ndarray) float | ndarray[source]

Calculate the distance between observed and simulated data.

Args:
observed (np.ndarray):

The observed data.

simulated (np.ndarray):

The simulated data.

class deeprootgen.statistics.distance_metrics.MeanPinballLoss(**_)[source]

The mean pinball loss distance.

calculate(observed: ndarray, simulated: ndarray) float | ndarray[source]

Calculate the distance between observed and simulated data.

Args:
observed (np.ndarray):

The observed data.

simulated (np.ndarray):

The simulated data.

class deeprootgen.statistics.distance_metrics.MeanSquaredError(**_)[source]

The mean squared error distance.

calculate(observed: ndarray, simulated: ndarray) float | ndarray[source]

Calculate the distance between observed and simulated data.

Args:
observed (np.ndarray):

The observed data.

simulated (np.ndarray):

The simulated data.

class deeprootgen.statistics.distance_metrics.MedianAbsoluteError(**_)[source]

The median absolute error distance.

calculate(observed: ndarray, simulated: ndarray) float | ndarray[source]

Calculate the distance between observed and simulated data.

Args:
observed (np.ndarray):

The observed data.

simulated (np.ndarray):

The simulated data.

class deeprootgen.statistics.distance_metrics.RootMeanSquaredError(**_)[source]

The root mean squared error distance.

calculate(observed: ndarray, simulated: ndarray) float | ndarray[source]

Calculate the distance between observed and simulated data.

Args:
observed (np.ndarray):

The observed data.

simulated (np.ndarray):

The simulated data.

deeprootgen.statistics.distance_metrics.get_distance_metric_func(distance_metric: str) Callable[source]

Get the distance metric function by name.

Args:
distance_metric (str):

The distance metric name.

Returns:
Callable:

The distance metric function.

deeprootgen.statistics.distance_metrics.get_distance_metrics() list[dict][source]

Get a list of available distance metrics and labels.

Returns:
list[dict]:

A list of available distance metrics and labels.

Summary Statistics

Contains utilities for producing summary statistics.

This module defines utility functions for producing summary statistics that can be used to compare simulated and observational data.

class deeprootgen.statistics.summary_statistics.AverageDiameter(**_)[source]

The AverageDiameter summary statistic.

calculate(df: DataFrame) float[source]

Caculate the average root diameter.

Args:
df (pd.DataFrame):

The dataframe of root data.

Returns:
float:

The average root diameter.

class deeprootgen.statistics.summary_statistics.AverageLength(**_)[source]

The AverageLength summary statistic.

calculate(df: DataFrame) float[source]

Caculate the average root length.

Args:
df (pd.DataFrame):

The dataframe of root data.

Returns:
float:

The average root length.

class deeprootgen.statistics.summary_statistics.AverageSpecificRootLength(root_tissue_density: float, **_)[source]

The AverageSpecificRootLength statistic.

calculate(df: DataFrame) float[source]

Caculate the average specific root length.

Args:
df (pd.DataFrame):

The dataframe of root data.

Returns:
float:

The average specific root length.

class deeprootgen.statistics.summary_statistics.AverageVolume(**_)[source]

The AverageVolume summary statistic.

calculate(df: DataFrame) float[source]

Caculate the average root volume.

Args:
df (pd.DataFrame):

The dataframe of root data.

Returns:
float:

The average root volume.

class deeprootgen.statistics.summary_statistics.AverageWeight(root_tissue_density: float, **_)[source]

The AverageWeight statistic.

calculate(df: DataFrame) float[source]

Caculate the average root weight.

Args:
df (pd.DataFrame):

The dataframe of root data.

Returns:
float:

The average root weight.

class deeprootgen.statistics.summary_statistics.ConvexHullArea(**_)[source]

The ConvexHullArea statistic.

calculate(df: DataFrame) float[source]

Caculate the area of the convex hull.

Args:
df (pd.DataFrame):

The dataframe of root data.

Returns:
float:

The area of the convex hull.

class deeprootgen.statistics.summary_statistics.ConvexHullVolume(**_)[source]

The ConvexHullVolume statistic.

calculate(df: DataFrame) float[source]

Caculate the volume of the convex hull.

Args:
df (pd.DataFrame):

The dataframe of root data.

Returns:
float:

The volume of the convex hull.

class deeprootgen.statistics.summary_statistics.DepthDistribution(**_)[source]

The DepthDistribution summary statistic.

calculate(df: DataFrame, bins: int = 10) tuple[source]

Get the cumulative root distribution by soil depth.

Args:
df (pd.DataFrame):

The dataframe of root data.

bins (int, optional):

The number of bins for a histogram. Defaults to 10.

Returns:
tuple:

The cumulative root distribution summary statistic.

get_xy_comparison_data(df: DataFrame, n_elements: int = 10) ndarray[source]

Get summary statistic data for comparing against another summary statistic.

Args:
df (pd.DataFrame):

The dataframe of root data.

n_elements (int, optional):

The number of elements for the comparison. Defaults to 10.

Returns:
np.ndarray:

The comparison data.

visualise(df: DataFrame, bins: int = 10) Figure[source]

Visualise the cumulative root distribution by soil depth.

Args:
df (pd.DataFrame):

The dataframe of root data.

bins (int, optional):

The number of bins for a histogram. Defaults to 10.

Returns:
go.Figure:

The visualisation of the cumulative root distribution summary statistic.

class deeprootgen.statistics.summary_statistics.RadialDistribution(**_)[source]

The RadialDistribution summary statistic.

calculate(df: DataFrame, bins: int = 10) tuple[source]

Get the cumulative root distribution by horizontal distance.

Args:
df (pd.DataFrame):

The dataframe of root data.

bins (int, optional):

The number of bins for a histogram. Defaults to 10.

Returns:
tuple:

The cumulative root distribution summary statistic.

get_xy_comparison_data(df: DataFrame, n_elements: int = 10) ndarray[source]

Get summary statistic data for comparing against another summary statistic.

Args:
df (pd.DataFrame):

The dataframe of root data.

n_elements (int, optional):

The number of elements for the comparison. Defaults to 10.

Returns:
np.ndarray:

The comparison data.

visualise(df: DataFrame, bins: int = 10) Figure[source]

Visualise the cumulative root distribution by horizontal distance.

Args:
df (pd.DataFrame):

The dataframe of root data.

bins (int, optional):

The number of bins for a histogram. Defaults to 10.

Returns:
go.Figure:

The visualisation of the cumulative root distribution summary statistic.

class deeprootgen.statistics.summary_statistics.SummaryStatisticBase(**_)[source]

The summary statistic abstract class.

abstract calculate(df: DataFrame) float | ndarray[source]

Calculate the summary statistic.

Args:
df (pd.DataFrame):

The root dataframe.

Raises:
NotImplementedError:

Error raised for the unimplemented abstract method.

calculate_statistic_per_layer(df: DataFrame, layer_decrement: int = 10) tuple[source]

Calculate a summary statistic per soil layer.

Args:
df (pd.DataFrame):

The root dataframe.

layer_decrement (int, optional):

The depth to decrement each soil layer. Defaults to 10.

Returns:
tuple:

The list of summary statistics and soil layers.

get_number_of_roots(df: DataFrame) int[source]

Get the number of roots in the root system.

Args:
df (pd.DataFrame):

The root dataframe.

Returns:
int:

The number of roots.

get_xy_comparison_data(df: DataFrame, n_elements: int = 10) ndarray[source]

Get summary statistic data for comparing against another summary statistic.

Args:
df (pd.DataFrame):

The dataframe of root data.

n_elements (int, optional):

The number of elements for the comparison. Defaults to 10.

Returns:
np.ndarray:

The comparison data.

visualise(df: DataFrame, layer_decrement: int = 10, **_) Figure[source]

Visualise the summary statistic by soil depth.

Args:
df (pd.DataFrame):

The root dataframe.

layer_decrement (int, optional):

The depth to decrement each soil layer. Defaults to 10.

Returns:
go.Figure:

The visualisation of the total root volume.

class deeprootgen.statistics.summary_statistics.TotalDiameter(**_)[source]

The TotalDiameter summary statistic.

calculate(df: DataFrame) float[source]

Caculate the total root diameter.

Args:
df (pd.DataFrame):

The dataframe of root data.

Returns:
float:

The total root diameter.

class deeprootgen.statistics.summary_statistics.TotalLength(**_)[source]

The TotalLength summary statistic.

calculate(df: DataFrame) float[source]

Caculate the total root length.

Args:
df (pd.DataFrame):

The dataframe of root data.

Returns:
float:

The total root length.

class deeprootgen.statistics.summary_statistics.TotalSpecificRootLength(root_tissue_density: float, **_)[source]
calculate(df: DataFrame) float[source]

Caculate the total specific root length.

Args:
df (pd.DataFrame):

The dataframe of root data.

Returns:
float:

The total specific root length.

class deeprootgen.statistics.summary_statistics.TotalVolume(**_)[source]

The TotalVolume summary statistic.

calculate(df: DataFrame) float[source]

Caculate the total root volume.

Args:
df (pd.DataFrame):

The dataframe of root data.

Returns:
float:

The total root volume.

class deeprootgen.statistics.summary_statistics.TotalWeight(root_tissue_density: float, **_)[source]

The TotalWeight statistic.

calculate(df: DataFrame) float[source]

Caculate the total root weight.

Args:
df (pd.DataFrame):

The dataframe of root data.

Returns:
float:

The total root weight.

deeprootgen.statistics.summary_statistics.get_summary_statistic_func(summary_statistic: str) Callable[source]

Get the summary statistic function by name.

Args:
summary_statistic (str):

The summary statistic name.

Returns:
Callable:

The summary statistic function.

deeprootgen.statistics.summary_statistics.get_summary_statistics() list[dict][source]

Get a list of available summary statistics and labels.

Returns:
list[dict]:

A list of available summary statistics and labels.