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:
flag_name: AV | str = {orientation_mode} orientation ({orientation_mode.abbr}o)#

The name of the flag

flag_severity: FlagSeverity | str = 1#
flag_type: FlagType | str = 2#

The type of the flag

get_flag_targets(reading, level=None, **kwargs)[source]#

Get flag targets.

Parameters:
Return type:

Iterable[Reading | Level | RawDataSet | MeasureValue | LevelEpoch]

get_merged_orientation_mode_av(percentages)[source]#

Get mode orientation abbreviated value.

Parameters:

percentages (List[float]) –

Return type:

AbbreviatedValue

reason: str = 'The phone has not been kept at a {orientation_mode} for more than {threshold}% of the test.'#

The detailed reason of the flag

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:
get_classification(data, orientation_mode)[source]#

Get the classification related to the provided orientation.

Parameters:
Return type:

Series

get_orientation_modes()[source]#

Get an iterable of orientation modes.

Return type:

List[PhoneOrientation]

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 and gravityZ.

  • 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:
get_definitions()[source]#

Get the definitions of the raw data set values.

Return type:

List[RawDataValueDefinition]

new_data_set_id: str = 'phone-orientation'#
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.

__init__(**kwargs)[source]#
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#