ExcessStatistics
- class plasmapy.analysis.time_series.excess_statistics.ExcessStatistics(signal, thresholds, time_step)[source]
Bases:
object
Calculate total time, number of upwards crossings, average time and root-mean-square time above given thresholds of a sequence.
- Parameters:
signal (1D array_like) – Signal to be analyzed.
thresholds (1D array_like) – Threshold values.
time_step (int) – Time step of
signal
.
- Raises:
ValueError – If
time_step
≤ 0.
Examples
>>> from plasmapy.analysis.time_series.excess_statistics import ExcessStatistics >>> signal = [0, 0, 2, 2, 0, 4] >>> thresholds = [1, 3, 5] >>> time_step = 1 >>> excess_statistics = ExcessStatistics(signal, thresholds, time_step) >>> excess_statistics.total_time_above_threshold [3, 1, 0] >>> excess_statistics.number_of_crossings [2, 1, 0] >>> excess_statistics.average_times [np.float64(1.5), np.float64(1.0), 0] >>> excess_statistics.rms_times [np.float64(0.5), np.float64(0.0), 0]
Attributes Summary
Average time above threshold(s).
Total number of upwards crossings for threshold(s).
Root-mean-square values of time above threshold(s).
Total time above threshold(s).
Methods Summary
hist
([bins])Computes the probability density function of the time above each value in
thresholds
.Attributes Documentation
- average_times
Average time above threshold(s).
- Returns:
average_times – Average time above each value in
thresholds
.- Return type:
1D array_like
- number_of_crossings
Total number of upwards crossings for threshold(s).
- Returns:
number_of_crossings – Total number of upwards crossings for each value in
thresholds
.- Return type:
1D array_like
- rms_times
Root-mean-square values of time above threshold(s).
- Returns:
rms_times – Root-mean-square values of time above each value in
thresholds
.- Return type:
1D array_like
- total_time_above_threshold
Total time above threshold(s).
- Returns:
total_time_above_threshold – Total time above threshold for each value in
thresholds
.- Return type:
1D array_like
Methods Documentation
- hist(bins: int = 32)[source]
Computes the probability density function of the time above each value in
thresholds
.- Parameters:
bins (int, default: 32) – The number of bins in the estimation of the PDF above
thresholds
.- Returns:
- Raises:
TypeError – If
bins
is not a positive integer.
Examples
>>> from plasmapy.analysis.time_series.excess_statistics import ExcessStatistics >>> signal = [0, 0, 2, 0, 4] >>> thresholds = [1, 3, 5] >>> time_step = 1 >>> excess_statistics = ExcessStatistics(signal, thresholds, time_step) >>> excess_statistics.hist(2) (array([[0., 2.], [0., 2.], [0., 0.]]), array([[0.75, 1.25], [0.75, 1.25], [0. , 0. ]]))