gaitmap.data_transform.Resample#
- class gaitmap.data_transform.Resample(target_sampling_rate_hz: float | None = None)[source]#
Resample a time series using the scipy resample method.
Optionally this method can also convert a ROI list (with start end values) into the same new sampling rate so that it still matches the resampled data.
- Parameters:
- target_sampling_rate_hz
The target sampling rate the data should be resampled to. Note that we don’t apply any checks on that. If you upsample your data to far, you will likely get poor results.
- Other Parameters:
- data
The data passed to the transform method.
- roi_list
Optional roi list (with values in samples) passed to the transform method
- sampling_rate_hz
The sampling rate of the input data
- Attributes:
- transformed_data_
The transformed data.
- transformed_roi_list_
If a roi_list was provided, this will be the transformed roi list in the new sampling rate
Methods
clone()Create a new instance of the class with all parameters copied over.
from_json(json_str)Import an gaitmap object from its json representation.
get_params([deep])Get parameters for this algorithm.
set_params(**params)Set the parameters of this Algorithm.
to_json()Export the current object parameters as json.
transform([data, roi_list, sampling_rate_hz])Resample the data.
- 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
- classmethod from_json(json_str: str) Self[source]#
Import an gaitmap object from its json representation.
For details have a look at the this example.
You can use the
to_jsonmethod of a class to export it as a compatible json string.- Parameters:
- json_str
json formatted string
- 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=.
- to_json() str[source]#
Export the current object parameters as json.
For details have a look at the this example.
You can use the
from_jsonmethod of any gaitmap algorithm to load the object again.Warning
This will only export the Parameters of the instance, but not any results!
- transform(data: DataFrame | None = None, *, roi_list: DataFrame | None = None, sampling_rate_hz: float | None = None, **_) Self[source]#
Resample the data.
- Parameters:
- data
data to be filtered
- roi_list
Optional roi list (with values in samples), that will also be resampled to match the data at the new sampling rate. Note, that only the start and end columns will be modified. Other columns remain untouched.
- sampling_rate_hz
The sampling rate of the data in Hz