handwriting_features.data.utils package

Submodules

handwriting_features.data.utils.cleanup module

handwriting_features.data.utils.cleanup.remove_outliers(array, window_size, min_samples=3, center=True, threshold=3, make_copy=False)[source]

Removes outliers based on the rolling median.

Parameters
  • array (numpy.ndarray) – input array

  • window_size (int) – size of the moving window

  • min_samples (int, optional) – minimum number of samples in a window, defaults to 3

  • center (bool, optional) – labels at the center of the window flag, defaults to True

  • threshold (int, optional) – outlier removal threshold, defaults to 3

  • make_copy (bool, optional) – copy creation flag, defaults to False

Returns

slope of linear regression value

Return type

numpy.float

handwriting_features.data.utils.dsp module

class handwriting_features.data.utils.dsp.GaussianFilter(fs, n)[source]

Bases: object

Class implementing the Gaussian filter

filter(signal)[source]

Filters an input signal by a Gaussian filter

class handwriting_features.data.utils.dsp.LowPassFilter(fs, fc)[source]

Bases: object

Class implementing the low-pass filter

filter(signal)[source]

Filters an input signal by a low-pass filter

handwriting_features.data.utils.dsp.segment(signal, window_size, window_step)[source]

Segments an input signal

handwriting_features.data.utils.iteration module

handwriting_features.data.utils.iteration.sliding_window(iterable, size, step, padding=None)[source]

Apply sliding_window on an input iterable given the windowing arguments.

Parameters
  • iterable (iterable) – iterable to be iterated over

  • size (int) – window size

  • step (int) – window step

  • padding (Any, optional) – window padding, defaults to None

Returns

windowed iterable

Return type

iterator

handwriting_features.data.utils.math module

handwriting_features.data.utils.math.derivation(array, order=1)[source]

Returns a derivation of input <array>.

Parameters
  • array (numpy.ndarray) – input array

  • order (int, optional) – order of derivation, defaults to 1

Returns

derivation

Return type

numpy.ndarray

handwriting_features.data.utils.math.intersection(x1, y1, x2=None, y2=None)[source]

Computes the intersection of two curves. Inspired by: https://www.mathworks.com/matlabcentral/fileexchange/22441-curve-intersections

Parameters
  • x1 (numpy.ndarray) – x-values of the first curve

  • y1 (numpy.ndarray) – y-values of the first curve

  • x2 (numpy.ndarray) – x-values of the second curve

  • y2 (numpy.ndarray) – y-values of the second curve

Returns

intersections

Return type

numpy.ndarray

Module contents