aeon.analysis.utils#
- aeon.analysis.utils.activepatch(wheel, in_patch)[source]#
Computes a decision boundary for when a patch is active based on wheel movement.
- Parameters:
wheel (Series) – A pandas Series containing the cumulative distance travelled on the wheel.
in_patch (Series) – A Series of type bool containing whether the specified patch may be active.
- Returns:
A pandas Series specifying for each timepoint whether the patch is active.
- aeon.analysis.utils.distance(position, target)[source]#
Computes the euclidean distance to a specified target.
- aeon.analysis.utils.distancetravelled(angle, radius=4.0)[source]#
Calculates the total distance travelled on the wheel.
Takes into account the wheel radius and the total number of turns in both directions across time.
- Parameters:
angle (Series) – A series of magnetic encoder measurements.
radius (float) – The radius of the wheel, in metric units.
- Returns:
The total distance travelled on the wheel, in metric units.
- aeon.analysis.utils.get_events_rates(events, window_len_sec, frequency, unit_len_sec=60, start=None, end=None, smooth=None, center=False)[source]#
Computes the event rate from a sequence of events over a specified window.
- aeon.analysis.utils.rate(events, window, frequency, weight=1, start=None, end=None, smooth=None, center=False)[source]#
Computes the continuous event rate from a discrete event sequence.
The window size and sampling frequency can be specified.
- Parameters:
events (Series) – The discrete sequence of events.
window (offset) – The time period of each window used to compute the rate.
frequency (DateOffset, Timedelta or str) – The sampling frequency for the continuous rate.
weight (number, optional) – A weight used to scale the continuous rate of each window.
start (datetime, optional) – The left bound of the time range for the continuous rate.
end (datetime, optional) – The right bound of the time range for the continuous rate.
smooth (DateOffset, Timedelta or str, optional) – The size of the smoothing kernel applied to the rate output.
smooth
The size of the smoothing kernel applied to the continuous rate output. :param bool, optional center: Specifies whether to center the convolution kernels. :return: A Series containing the continuous event rate over time.
- aeon.analysis.utils.sessiontime(index, start=None)[source]#
Converts absolute to relative time, with optional reference starting time.
- aeon.analysis.utils.visits(data, onset='Enter', offset='Exit')[source]#
Computes duration, onset and offset times from paired events.
Allows for missing data by trying to match event onset times with subsequent offset times. If the match fails, event offset metadata is filled with NaN. Any additional metadata columns in the data frame will be paired and included in the output.
- Parameters:
data (DataFrame) – A pandas data frame containing visit onset and offset events.
onset (str, optional) – The label used to identify event onsets.
offset (str, optional) – The label used to identify event offsets.
- Returns:
A pandas data frame containing duration and metadata for each visit.