Crop#

class mobgap.data_transform.Crop(crop_len_s: float | tuple[float, float])[source]#

Crop the input data to by removing a specified amount of samples from the beginning and end of the data.

Parameters:
crop_len_s

The length of the data to crop in seconds. If a single value is given, the same amount is cropped from the beginning and end of the data. If a tuple is given, the first value is used for the beginning and the second for the end. The value is converted to samples using the sampling rate of the data.

Other Parameters:
data

The raw data passed to the transform method. This can either be a dataframe, a series, or a numpy array.

sampling_rate_hz

The sampling rate of the IMU data in Hz passed to the transform method.

Attributes:
transformed_data_

The transformed data. The datatype matches the datatype of the passed data.

crop_len_samples_

The calculated crop len in samples as calculated from the provided crop_len_s and the sampling rate.

Methods

clone()

Create a new instance of the class with all parameters copied over.

get_params([deep])

Get parameters for this algorithm.

set_params(**params)

Set the parameters of this Algorithm.

transform(data, *[, sampling_rate_hz])

%(transform_short)s.

__init__(crop_len_s: float | tuple[float, float]) None[source]#
clone() Self[source]#

Create a new instance of the class with all parameters copied over.

This will create a new instance of the class itself and all nested objects

get_params(deep: bool = True) dict[str, Any][source]#

Get parameters for this algorithm.

Parameters:
deep

Only relevant if object contains nested algorithm objects. If this is the case and deep is True, the params of these nested objects are included in the output using a prefix like nested_object_name__ (Note the two “_” at the end)

Returns:
params

Parameter names mapped to their values.

set_params(**params: Any) Self[source]#

Set the parameters of this Algorithm.

To set parameters of nested objects use nested_object_name__para_name=.

transform(
data: Series | DataFrame | ndarray,
*,
sampling_rate_hz: float | None = None,
**_: Unpack[dict[str, Any]],
) Self[source]#

%(transform_short)s.

Parameters:
%(transform_para)s
%(transform_return)s