dispel.signal.geometric module#

signal.geometric module.

A module containing common operations on different geometries.

dispel.signal.geometric.downsample_dataset(data, ratio_freq=0.5)[source]#

Downsample the dataset to a fraction of original frequency.

Parameters:
  • data (DataFrame) – A pd.Dataframe with the original dataset

  • ratio_freq (float) – A float with the ratio of downsampling from original sampling frequency

Returns:

The resulting downsampled dataset

Return type:

pd.Dataframe

dispel.signal.geometric.draw_circle(length=100, radius=1)[source]#

Draw a circle from polar to cartesian coordinates.

Parameters:
  • length (int) –

  • radius (int) –

dispel.signal.geometric.draw_ellipse(length=100, a=1, b=2)[source]#

Draw a circle from polar to cartesian coordinates.

Parameters:
dispel.signal.geometric.extract_ellipse_axes(comps)[source]#

Extract length of the axes of an ellipse covering 95-percentile of data.

Parameters:

comps (DataFrame) – A pd.DataFrame with a 2-dimensional timeseries

Returns:

Tuple containing:
major_axisfloat

The length of the major axis of an ellipse

minor_axisfloat

The length of the minor axis of an ellipse

Return type:

Union[int, int]

dispel.signal.geometric.extract_ellipse_dir_vectors(comps)[source]#

Extract eigen-director vectors of ellipse representing the data.

Parameters:

comps (DataFrame) – A pd.DataFrame with a 2-dimensional timeseries

Returns:

Tuple containing:
v1_v_hatnp.array

An array with the first PCA eigenvector

v2_v_hatnp.array

An array with the second PCA eigenvector

Return type:

Union[array, array]

dispel.signal.geometric.rotate_points(x, y, angle)[source]#

Rotate a point cloud.

Parameters:
  • x (Series) – pd.Series of the first coordinate of the point cloud

  • y (Series) – pd.Series of the second coordinate of the point cloud

  • angle (float) – float of the angle to rotate in radians

Return type:

A tuple with two coordinates of the rotated point cloud

dispel.signal.geometric.synthetic_outliers(x, y, ratio_outlier)[source]#

Generate outliers for a point cloud.

Parameters:
  • x (Series) – pd.Series of the first coordinate of the point cloud

  • y (Series) – pd.Series of the second coordinate of the point cloud

  • ratio_outlier (float) – float indicating amount of points to be turned into outlier

Return type:

A tuple with two coordinates of the point cloud with outliers

dispel.signal.geometric.upsample_dataset(data, factor_freq=2)[source]#

Upsample the datasat to a factor of original frequency.

Parameters:
  • data (DataFrame) – A pd.Dataframe with the original dataset

  • factor_freq (float) – A float with the factor of upsampling from original sampling rate

Returns:

The resulting upsampled dataset

Return type:

pd.Dataframe