biopsykit.signals.imu.wear_detection module

Module for detection non-wear times from raw acceleration signals.

class biopsykit.signals.imu.wear_detection.WearDetection(sampling_rate)[source]

Bases: object

Initialize a new WearDetection instance.

Parameters

sampling_rate (float) – sampling rate of recorded data in Hz

sampling_rate: float
predict(data)[source]

Predict non-wear times from acceleration data.

Parameters

data (array_like) – input acceleration data. Must be 3-d.

Returns

dataframe with wear (1) and non-wear (0) times per 15 minute interval

Return type

DataFrame

static get_major_wear_block(data)[source]

Return major wear block.

The major wear block is the longest continuous wear block in the data.

Parameters

data (DataFrame) – data with wear detection applied. The dataframe is expected to have a “wear” column.

Returns

  • start (datetime or int) – start of major wear block as datetime or int index

  • end (datetime or int) – end of major wear block as datetime or int index

Return type

Tuple[Union[datetime.datetime, int], Union[datetime.datetime, int]]

See also

predict()

apply wear detection on accelerometer data

static cut_to_wear_block(data, wear_block)[source]

Cut data to wear block.

Parameters
  • data (DataFrame) – input data that contains wear block

  • wear_block (tuple) – tuple with start and end times of wear block. The type of wear_block depends on the index of data. (datetime or int)

Returns

data cut to wear block

Return type

DataFrame