Pad#
- class mobgap.data_transform.Pad(
- pad_len_s: float | tuple[float, float],
- *,
- mode: str = 'reflect',
- constant_values: float | Sequence[float] | None = None,
Pad the input data using various padding strategies.
Under the hood we use the
numpy.padfunction to pad the data.- Parameters:
- pad_len_s
Padding len in seconds. If a single value is given, the same padding is applied to 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.
- mode
Padding mode. See
numpy.padfor more information.- constant_values
The constant value to use for padding in case mode is
constant. Seenumpy.padfor more information.
- Other Parameters:
- data
The raw data passed to the
transformmethod. 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
transformmethod.
- Attributes:
- transformed_data_
The transformed data. The datatype matches the datatype of the passed data.
- pad_len_samples_
The calculated padding len in samples as calculated from the provided pad_len_s and the sampling rate.
Notes
We don’t yet support all padding modes. Please open an issue if you need support for a specific mode.
Methods
clone()Create a new instance of the class with all parameters copied over.
Get the inverse transformer for the padding.
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__(
- pad_len_s: float | tuple[float, float],
- *,
- mode: str = 'reflect',
- constant_values: float | Sequence[float] | None = None,
- 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_inverse_transformer() Crop[source]#
Get the inverse transformer for the padding.
This returns a
Croptransformer that can be used to crop the data back to its original size.
- 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.