macro_eeg_model.simulation.delay_calculator#
Classes#
A class to calculate delay distributions based on distance and various statistical parameters. |
Module Contents#
- class macro_eeg_model.simulation.delay_calculator.DelayCalculator(shape_param, scale_param, location_param, truncation_percentile)[source]#
A class to calculate delay distributions based on distance and various statistical parameters. The delay is modeled using inverse generalized extreme value (GEV) distributions.
- _shape_param#
The shape parameter (xi) for the GEV distribution.
- Type:
float
- _scale_param#
The scale parameter (sigma) for the GEV distribution.
- Type:
float
- _location_param#
The location parameter (mu) for the GEV distribution.
- Type:
float
- _truncation_percentile#
The percentile at which to truncate the resulting delay distribution.
- Type:
float
- _velocity_factor#
A constant velocity factor (= 6) used to calculate the scale coefficient from the distance. Expressed in meters per second per micron diameter.
- Type:
float
- __init__(shape_param, scale_param, location_param, truncation_percentile)[source]#
Initializes the DelayCalculator with specified parameters for the GEV distribution and the truncation percentile.
- Parameters:
shape_param (float) – The shape parameter (xi) for the GEV distribution.
scale_param (float) – The scale parameter (sigma) for the GEV distribution.
location_param (float) – The location parameter (mu) for the GEV distribution.
truncation_percentile (float) – The percentile at which to truncate the resulting delay distribution. Must be in the range [0, 1).
- get_delays_distribution(tempx, distance)[source]#
Generates a probability density function (PDF) for delays using inverse GEV distributions. The distributions are also scaled with parameter computed by
_calculate_scale_coefficient().Depending on whether the distance is a single value or a tuple (in case of a relay station), it either sums inverse GEV distributions or uses a single inverse GEV distribution (see
src.simulation.distributions.LagDistributionsandsrc.simulation.distributions.DistributionFactory). It then truncates the resulting PDF using_truncate_result().- Parameters:
tempx (numpy.ndarray) – The array of time points (x-axis) over which to calculate the delay distribution.
distance (float or tuple) – The distance(s) over which to calculate the delay. If a tuple, the method will use the sum of two inverse GEV distributions.
- Returns:
The truncated probability density function (PDF) representing the delay distribution.
- Return type:
numpy.ndarray
- Raises:
AssertionError – If the distribution cannot be created.
- _calculate_scale_coefficient(distance)[source]#
Calculates the scale coefficient for the GEV distribution based on the given distance.
- Parameters:
distance (float) – The distance for which to calculate the scale coefficient.
- Returns:
The scale coefficient used in the GEV distribution.
- Return type:
float
- _truncate_result(tempx, result)[source]#
Truncates the PDF by setting values beyond a certain index to zero, based on the cumulative distribution function (CDF) and the truncation percentile.
- Parameters:
tempx (numpy.ndarray) – The array of time points (x-axis) corresponding to the PDF.
result (numpy.ndarray) – The PDF to be truncated.
- Returns:
The truncated PDF.
- Return type:
numpy.ndarray
- Raises:
AssertionError – If the truncation percentile is outside the valid range [0, 1).