ConditionalEventsο
- class plasmapy.analysis.time_series.conditional_averaging.ConditionalEvents(
- signal,
- time,
- lower_threshold,
- *,
- upper_threshold=None,
- reference_signal=None,
- length_of_return=None,
- distance: float = 0,
- remove_non_max_peaks: bool = False,
Bases:
objectCalculate conditional average, conditional variance, peaks, arrival times and waiting times of events of a time series.
- Parameters:
signal (1D array_like) β Signal to be analyzed.
time (1D array_like) β Corresponding time values for
signal.lower_threshold (
floatorQuantity) β Lower threshold for event detection.upper_threshold (
floatorQuantity, default:None) β Upper threshold for event detection.reference_signal (1D array_like, default:
None) β Reference signal. IfNone,signalis the reference signal.length_of_return (
float, default:None) β Desired length of returned data. IfNone, estimated aslen(signal) / len(number_of_events) * time_step.distance (
float, default:0) β Minimum distance between peaks, in units of time.remove_non_max_peaks (
bool, default:False) β Remove events where peak is not the largest value inside window.
- Raises:
ValueError β If length of
signalandtimeare not equal. If length ofreference_signalandtimeare not equal (whenreference_signalis provided). Iflength_of_returnis greater than the length of the time span. Iflength_of_returnis negative. Ifupper_thresholdis less than or equal tolower_threshold.UnitsError β If astropy units of
signal/reference_signaland eitherlower_thresholdorupper_thresholddo not match. If the units oftime,length_of_returnanddistancedo not match.
Notes
The method, in its simplest form, works by finding peaks in a signal that fulfill a certain size threshold. Equally sized excerpts of the signal around every peak are then cut out and averaged. This yields the average shape of the events that fulfill the condition.
A detailed analysis of the conditional averaging method is presented in the Master thesis by Nilsen [2023].
Examples
>>> from plasmapy.analysis.time_series.conditional_averaging import ( ... ConditionalEvents, ... ) >>> cond_events = ConditionalEvents( ... signal=[1, 2, 1, 1, 2, 1], ... time=[1, 2, 3, 4, 5, 6], ... lower_threshold=1.5, ... ) >>> cond_events.time array([-1.0, 0.0, 1.0]) >>> cond_events.average array([1., 2., 1.]) >>> cond_events.variance array([1., 1., 1.]) >>> cond_events.peaks array([2, 2]) >>> cond_events.waiting_times array([3]) >>> cond_events.arrival_times array([2, 5]) >>> cond_events.number_of_events 2
Attributes Summary
Arrival times corresponding to the conditional events.
Conditional average over events.
Total number of conditional events.
Peak values of conditional events.
Time values corresponding to the analysis window.
Conditional variance over events.
Waiting times between consecutive peaks.
Attributes Documentation
- arrival_timesο
Arrival times corresponding to the conditional events.
- Returns:
arrival_times β Arrival times the conditional events.
- Return type:
1D array_like
- averageο
Conditional average over events.
- Returns:
average β Array representing the conditional average over events.
- Return type:
1D array_like
- number_of_eventsο
Total number of conditional events.
- Returns:
number_of_events β Total number of conditional events.
- Return type:
- peaksο
Peak values of conditional events.
- Returns:
peaks β Peak values of conditional events.
- Return type:
1D array_like
- timeο
Time values corresponding to the analysis window.
- Returns:
time β Time values representing the analysis window.
- Return type:
1D array_like
- varianceο
Conditional variance over events.
- Returns:
variance β Array representing the conditional variance over events.
- Return type:
1D array_like
- waiting_timesο
Waiting times between consecutive peaks.
- Returns:
waiting_times β Waiting times between consecutive peaks of conditional events.
- Return type:
1D array_like