dispel.providers.generic.activity.orientation module#
A module for phone orientation processing steps.
- class dispel.providers.generic.activity.orientation.LandscapeModeFlagger[source]#
Bases:
PhoneOrientationFlagger
A data set flagger for landscape mode.
- orientation_mode: PhoneOrientationType = (PhoneOrientation.LANDSCAPE_RIGHT, PhoneOrientation.LANDSCAPE_LEFT)#
- class dispel.providers.generic.activity.orientation.PhoneOrientationFlagger[source]#
Bases:
PhoneOrientationMixin
,FlagDataSetStep
A data set flagger for phone orientation.
- Parameters:
gravity_data_set_id – The identifier of the data set containing the gravity signal.
pitch_freedom – The degree of freedom of the pitch angle in degrees, if it is a float then the pitch has to be within [-pitch_freedom, pitch_freedom], else it should be a tuple defining the range of the pitch.
yaw_freedom – The degree of freedom of the yaw angle in degrees, if it is a float then the yaw has to be within [-yaw_freedom, yaw_freedom], else it should be a tuple defining the range of the yaw.
acceptance_threshold – The threshold below which the data set is to be flagged. If the fed signal does not match more than
acceptance_threshold
% of the phone orientation mode, then the associated level is flagged. Should be within[0, 1]
.orientation_mode – The phone orientation mode(s) that are to be flagged. See
PhoneOrientation
.
- __init__(gravity_data_set_id, pitch_freedom=70, yaw_freedom=15, acceptance_threshold=0.9, orientation_mode=None, **kwargs)[source]#
- Parameters:
gravity_data_set_id (str) –
pitch_freedom (float | OrientationRange) –
yaw_freedom (float | OrientationRange) –
acceptance_threshold (float) –
orientation_mode (PhoneOrientation | Iterable[PhoneOrientation] | None) –
- flag_name: AV | str = {orientation_mode} orientation ({orientation_mode.abbr}o)#
The name of the flag
- flag_severity: FlagSeverity | str = 1#
- get_flag_targets(reading, level=None, **kwargs)[source]#
Get flag targets.
- Parameters:
- Return type:
Iterable[Reading | Level | RawDataSet | MeasureValue | LevelEpoch]
- class dispel.providers.generic.activity.orientation.PhoneOrientationMixin[source]#
Bases:
object
Phone orientation processing step Mixin class.
- __init__(pitch_freedom=70, yaw_freedom=15, orientation_mode=None, **kwargs)[source]#
- Parameters:
pitch_freedom (float | OrientationRange) –
yaw_freedom (float | OrientationRange) –
orientation_mode (PhoneOrientation | Iterable[PhoneOrientation] | None) –
- get_classification(data, orientation_mode)[source]#
Get the classification related to the provided orientation.
- Parameters:
data (DataFrame) –
orientation_mode (PhoneOrientation) –
- Return type:
- orientation_mode: PhoneOrientation | Iterable[PhoneOrientation]#
- class dispel.providers.generic.activity.orientation.PhoneOrientationTransform[source]#
Bases:
PhoneOrientationMixin
,TransformStep
A transform step for phone orientation classification.
The transformation step produces a pandas data frame containing one boolean pandas series per given orientation mode. Tha resulted pandas series are point-wise classifications of the input gravity signal. The gravity data frame index is passed to the transformation data frame.
- Parameters:
gravity_data_set_id – The identifier of the data set containing the gravity signal. The data frame contained in the gravity data set must contain three main columns
gravityX
,gravityY
andgravityZ
.pitch_freedom – The degree of freedom of the pitch angle in degrees.
yaw_freedom – The degree of freedom of the yaw angle in degrees.
orientation_mode – The phone orientation mode(s) that are to be flagged. See
PhoneOrientation
.
- __init__(gravity_data_set_id, pitch_freedom=70, yaw_freedom=15, orientation_mode=None, **kwargs)[source]#
- Parameters:
gravity_data_set_id (str) –
pitch_freedom (float | OrientationRange) –
yaw_freedom (float | OrientationRange) –
orientation_mode (PhoneOrientation | Iterable[PhoneOrientation] | None) –
- class dispel.providers.generic.activity.orientation.UpperLimbOrientationFlagger[source]#
Bases:
ProcessingStepGroup
A group of pinch processing steps for measures by level id.
The pitch_freedom and yaw_freedom range were defined using Gravity values and limited range when positioning the phone in portrait mode. The threshold of 0.7 take into account the fact that the user can move the phone between levels and then flag the orientations at the beginning of the level.
- class dispel.providers.generic.activity.orientation.UprightPortraitModeFlagger[source]#
Bases:
PhoneOrientationFlagger
A data set flagger for upright portrait mode.
- orientation_mode: PhoneOrientationType = 3#
- class dispel.providers.generic.activity.orientation.UpsideDownPortraitModeFlagger[source]#
Bases:
PhoneOrientationFlagger
A data set flagger for upside down portrait mode.
- orientation_mode: PhoneOrientationType = 4#