dispel.providers.generic.tasks.draw.intersections module#

A module dedicated to drawing intersection detections.

class dispel.providers.generic.tasks.draw.intersections.Point[source]#

Bases: Point

Wrap Point object in a custom class.

property coordinates: Tuple[float, float]#

Return the coordinates of the Point object.

to_numpy()[source]#

Transform point to numpy array.

Return type:

ndarray

class dispel.providers.generic.tasks.draw.intersections.Segment[source]#

Bases: Segment

Wrap Segment object in a custom class.

__init__(start, end)[source]#
Parameters:
diff()[source]#

Compute the difference between segment points.

Return type:

Point

property distance: float#

Return the segment length.

property segment: Tuple[Tuple[float, float], Tuple[float, float]]#

Return the coordinates of the two points forming the segment.

dispel.providers.generic.tasks.draw.intersections.compute_intersection_analysis(user, reference)[source]#

Compute the tremor-related measures according to intersections.

First get only the valid user trajectory, then format the data needed, and then extract the measures.

Parameters:
Returns:

The proper pandas data frame to compute tremor measures.

Return type:

pandas.DataFrame

dispel.providers.generic.tasks.draw.intersections.get_intersection_data(user, ref)[source]#

Transform {level_id}_user_paths data to study intersections.

This transform the {level_id}_user_paths data in order to get the proper data to capture the number of intersections between the user path and the model path.

Parameters:
  • user (DataFrame) – The {level_id}_user_paths data frame.

  • ref (DataFrame) – The reference trajectory corresponding to the current shape.

Returns:

The proper user data frame to compute tremor-related measures and the proper reference data to compute tremor-related measures.

Return type:

Tuple[pandas.DataFrame, pandas.DataFrame]

dispel.providers.generic.tasks.draw.intersections.get_intersection_measures(user, ref)[source]#

Compute the number of intersections between user and model paths.

Parameters:
  • user (DataFrame) – The {level_id}_intersection_detection data frame.

  • ref (DataFrame) – The reference trajectory corresponding to the current shape.

Returns:

A pandas data frame containing tremor measures related to path intersection.

Return type:

pandas.DataFrame

dispel.providers.generic.tasks.draw.intersections.get_ratio(data)[source]#

Add the traveled distance ratio of a segment.

This get the traveled distance ratio of all user and model segments. This ratio corresponds to the ‘traveled’ distance from zero to the segment over the total distance of the drawn/ground truth shape.

Parameters:

data (DataFrame) – A pandas data frame containing at least dist and tot_length pandas Series.

Returns:

The pandas series corresponding to the ratio defined as the total length of a specific point from the origin of the draw over the total length of the draw.

Return type:

pandas.Series

dispel.providers.generic.tasks.draw.intersections.get_segment(data)[source]#

Get all Segment of all data points.

Parameters:

data (DataFrame) –

Return type:

DataFrame