dispel.providers.generic.tasks.pinch.attempts module#
A module dedicated to format user pinch into attempts.
- class dispel.providers.generic.tasks.pinch.attempts.PinchAttempt[source]#
Bases:
Gesture
A pinching gesture.
- TOUCH_CLS#
alias of
PinchTouch
- __init__(touches, is_valid, is_successful, top_finger, bottom_finger, pinch_begin, pinch_end)#
- Parameters:
is_valid (bool) –
is_successful (bool) –
top_finger (PinchTouch) –
bottom_finger (PinchTouch) –
pinch_begin (datetime) –
pinch_end (datetime) –
- Return type:
None
- static add_is_valid_pinch(first, second, target_radius, target_coords)[source]#
Add is valid pinch variable to the given touches.
- Parameters:
first (PinchTouch) – The first pinch touch.
second (PinchTouch) – The second pinch touch.
target_radius (float) – The radius of the pinch target.
target_coords (Tuple[float, float]) – The coordinates of the pinch target.
- Returns:
The modified given pinch touches.
- Return type:
Tuple[PinchTouch, PinchTouch]
- bottom_finger: PinchTouch#
The bottom finger touch interaction
- property double_touch_asynchrony: timedelta#
Get the double touch asynchrony of the pinch attempt.
- Returns:
The time difference between the first and second finger touching the screen for a pinch attempt.
- Return type:
- property first_push_bottom_fingers: float#
Get the first pressure measurement of the bottom finger.
- Returns:
The first pressure reading from the bottom finger that was non-zero.
- Return type:
- property first_push_top_fingers: float#
Get the first pressure measurement of the top finger.
- Returns:
The first pressure reading from the top finger that was non-zero.
- Return type:
- classmethod from_data_frame(data, **kwargs)[source]#
Create PinchAttempt from a data frame.
- Parameters:
data (DataFrame) – A data frame containing touch events.
kwargs – Additional key word arguments passed to
gesture_factory()
.
- Returns:
A sequence of PinchAttempt based on the provided
data
. The data frame is split according to thetouchPathId
into separate touch interactions. Consecutively overlapping touches are combined as PinchAttempt.- Return type:
List[PinchAttempt]
- property pinching_duration: timedelta#
Get the duration of the pinching.
- Returns:
Returns the duration of the pinching if the gesture is considered a valid pinch based on
pinch_begin
andpinch_end
. If the pinch is not valid according to the app (isValidPinch
in thescreen
data set isfalse
) it returnsNone
.- Return type:
- top_finger: PinchTouch#
The top finger touch interaction
- class dispel.providers.generic.tasks.pinch.attempts.PinchTarget[source]#
Bases:
object
A pinch target class.
This encapsulates pinch targets for each level e.g. ‘right-small’, ‘right-small-01’ etc.
- hand#
The hand used for the pinch.
- Type:
- size#
The target bubble size.
- Type:
- appearance#
The timestamp at which the target initially appeared.
- Type:
- attempts#
A list of the pinch attempts for the current target.
- Type:
List[PinchAttempt]
- contact_coordinates_bottom_fingers(outcome=AttemptOutcomeModality.ALL)[source]#
Get the attempts contact coordinates for bottom fingers.
- Parameters:
outcome (AttemptOutcomeModality) –
- Return type:
- contact_coordinates_top_fingers(outcome=AttemptOutcomeModality.ALL)[source]#
Get the attempts contact coordinates for top fingers.
- Parameters:
outcome (AttemptOutcomeModality) –
- Return type:
- contact_distances(finger, outcome=AttemptOutcomeModality.ALL)[source]#
Get contact distances for fingers.
- Parameters:
finger (FingerModality) –
outcome (AttemptOutcomeModality) –
- Return type:
- property first_attempt: PinchAttempt#
Get the first pinch attempt.
- first_pushes(finger, outcome=AttemptOutcomeModality.ALL)[source]#
Get the first pushes of a pinch target’s fingers attempts.
- Parameters:
finger (FingerModality) –
outcome (AttemptOutcomeModality) –
- Return type:
- classmethod from_level(level)[source]#
Initialize pinch target from level.
- Parameters:
level (Level) – The level from which the pinch target is to be initialized.
- Returns:
The pinch target.
- Return type:
- Raises:
ValueError – If the PinchTarget id doesn’t start with a hand-size format
- get_attempts_from(modality)[source]#
Get the list of attempts from success pinche modality.
- Parameters:
modality (AttemptOutcomeModality) –
- Return type:
- get_contact_distance(finger_coordinates)[source]#
Get contact distance given contact coordinates.
The contact distance is the euclidean distance between the finger coordinates and the surface of the pinch target i.e. the distance between the finger coordinates and the target center coordinates minus the radius of the target.
- class dispel.providers.generic.tasks.pinch.attempts.PinchTouch[source]#
Bases:
Touch
A pinch touch interaction.
- __init__(data, pointer=UnknownPointer(index=0))#
- Parameters:
data (dataclasses.InitVar[DataFrame]) –
pointer (Pointer) –
- Return type:
None
- property is_valid_pinch_exists: bool#
Check whether is valid pinch variable exists in touch data frame.
- property pinch_begin: datetime#
Get the start of the pinching.
- Returns:
The time stamp when the pinching started.
- Return type:
- property pinch_end: datetime#
Get the start of the pinching.
- Returns:
The time stamp when the pinching started.
- Return type:
- set_is_valid_pinch(is_valid_pinch)[source]#
Set is valid pinch variable inside touch data frame.
- Parameters:
is_valid_pinch (Series) – A pandas series containing isValidPinch boolean values and time stamps as indexes.
- dispel.providers.generic.tasks.pinch.attempts.double_touch_asynchrony(target, attempt)[source]#
Compute the pinching attempts’ double touch asynchrony.
The double touch asynchrony i.e. time difference between the first and second finger touching the screen for all pinch attempts.
- Parameters:
target (PinchTarget) – A pinch target object.
attempt (AttemptSelectionModality) – Pinching attempt selection modality.
- Returns:
A list regrouping the computed double touch asynchrony in ms.
- Return type:
List[float]
- dispel.providers.generic.tasks.pinch.attempts.dwell_time(target, attempt)[source]#
Compute the pinching attempts’ dwell times.
The dwell time i.e. time spent between the first screen touching and the initiation of the movement.
- Parameters:
target (PinchTarget) – A pinch target object.
attempt (AttemptSelectionModality) – Pinching attempt selection modality.
- Returns:
A list regrouping the computed dwell times in ms.
- Return type:
List[float]
- dispel.providers.generic.tasks.pinch.attempts.number_successful_pinches(target)[source]#
Return number of successful pinches.
A pinch is defined as a potential pinch with at least one touch event marked with ledToSuccess.
- Parameters:
target (PinchTarget) – A pinch target object.
- Returns:
Number of successful pinches
- Return type:
- dispel.providers.generic.tasks.pinch.attempts.pinching_duration(target, modality=AttemptOutcomeModality.ALL)[source]#
Compute the pinching duration.
The pinching duration i.e. the duration spent actually deforming the bubble.
- Parameters:
target (PinchTarget) – A pinch target object.
modality (AttemptOutcomeModality) – Pinching attempt success modality.
- Returns:
A list regrouping the computed pinching durations in s.
- Return type:
List[float]
- dispel.providers.generic.tasks.pinch.attempts.reaction_time(target)[source]#
Compute the reaction time.
The reaction time of the user between the bubble appearance and the first touch event.
- Parameters:
target (PinchTarget) – A pinch target object.
- Returns:
The user reaction time in ms.
- Return type:
- dispel.providers.generic.tasks.pinch.attempts.success_duration(target, modality=AttemptOutcomeModality.ALL)[source]#
Compute the success duration.
The success duration i.e. the duration spent before succeeding at pinching a bubble.
- Parameters:
target (PinchTarget) – A pinch target object.
modality (AttemptOutcomeModality) – Pinching attempt success modality.
- Returns:
A list regrouping the computed success durations in s.
- Return type:
List[float]
- dispel.providers.generic.tasks.pinch.attempts.total_duration(target)[source]#
Compute the total duration of the pinch attempts.
- Parameters:
target (PinchTarget) – A pinch target object.
- Returns:
The computed total duration in s.
- Return type:
- dispel.providers.generic.tasks.pinch.attempts.total_number_pinches(target)[source]#
Return total number of pinches.
A pinch is defined as a potential pinch with at least one touch event marked with isValidPinch.
- Parameters:
target (PinchTarget) – A pinch target object.
- Returns:
The total number of pinches.
- Return type: