gaitmap.stride_segmentation.BarthOriginalTemplate#
- class gaitmap.stride_segmentation.BarthOriginalTemplate(*, scaling=cf(FixedScaler(offset=0, scale=500.0)), use_cols: Sequence[str | int] | None = None)[source]#
Template used for stride segmentation by Barth et al.
Note
This algorithm is only available via the
gaitmap_madpackage and distributed under a AGPL3 licence. To use it, you need to explicitly install thegaitmap_madpackage. Learn more about that here.- Parameters:
- scaling
A multiplicative factor used to downscale the signal before the template is applied. The downscaled signal should then have have the same value range as the template signal. A large scale difference between data and template will result in mismatches. At the moment only homogeneous scaling of all axis is supported. Note that the actual use of the scaling depends on the DTW implementation and not all DTW class might use the scaling factor in the same way. For this template the default value is 500, which is adapted for data that has a max-gyro peak of approx. 500 deg/s in
gyr_mlduring the swing phase. This is appropriate for most walking styles.- use_cols
The columns of the template that should actually be used. The default (all gyro axis) should work well, but will not match turning stride. Note, that this template only consists of gyro data (i.e. you can only select one of
BF_GYR)
See also
gaitmap.stride_segmentation.DtwTemplateBase class for templates
gaitmap.stride_segmentation.BarthDtwHow to apply templates for stride segmentation
Notes
As this template was generated by interpolating multiple strides, it does not really have a single sampling rate. The original were all recorded at 102.4 Hz, but as the template is interpolated to 200 samples, its is closer to an effective sampling rate of 200 Hz (a normal stride is around 0.8-1.5s). This template reports a sampling rate of 204.8 Hz, to prevent resampling for this very common 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_data()Return the template data.
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(data, sampling_rate_hz)Transform external data according to the template scaling.
- __init__(*, scaling=cf(FixedScaler(offset=0, scale=500.0)), use_cols: Sequence[str | int] | None = None) 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
- 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_data() ndarray | DataFrame[source]#
Return the template data.
This will only return the columns of data that are listed in
use_colsand will apply the scaling.
- 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(data: DataFrame, sampling_rate_hz: float) DataFrame[source]#
Transform external data according to the template scaling.
This method should be applied to the data before the template is matched. There is usually no need to do this manually, as all the implemented Dtw methods do this automatically internally.
- Parameters:
- dataSingleSensorData
The data to transform.
- sampling_rate_hzfloat
The sampling rate of the data. This will be forwarded to the scaler, incase it is used.
- Returns:
- SingleSensorData
The transformed data.