ExcessStatisticsο
- class plasmapy.analysis.time_series.excess_statistics.ExcessStatistics(signal, thresholds, time_step)[source]ο
Bases:
objectCalculate 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
binsis 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. ]]))