Skip to content

poreflow.steps.changepoint

Change point detection

find_transitions(i_data, min_level_length, sensitivity=1)

Uses the variable voltage step finder with a flat basis function to find transitions.

Parameters:

Name Type Description Default
i_data ndarray
required
min_level_length int
required
sensitivity float
1

Returns:

format_steps_df(transitions, features, sfreq)

Formats a DataFrame containing information about steps and their properties.

This function creates a DataFrame where each row represents a step, with columns for the start and end indices of each step, the number of points in each step, the dwell time in seconds, and the mean and standard deviation values of the features for each step. The function assumes that the features array contains mean values in the first row and standard deviation values in the second row.

Parameters:

Name Type Description Default
transitions array - like

The indices of the transitions marking the start and end of each step.

required
features array - like

A 2D array where the first row contains mean feature values, and the second row contains standard deviation values for each step.

required
sfreq float

The sampling frequency (samples per second), used to calculate dwell time.

required

Returns:

Type Description
StepsDataFrame

pd.DataFrame: A DataFrame with columns for the start and end indices, the number of points, the dwell time in seconds, and the mean and standard deviation of each step.