handwriting_features.features package
Subpackages
- handwriting_features.features.configuration package
- handwriting_features.features.exceptions package
- handwriting_features.features.implementation package
- Subpackages
- handwriting_features.features.implementation.conventional package
- Subpackages
- Submodules
- handwriting_features.features.implementation.conventional.composite module
- handwriting_features.features.implementation.conventional.dynamic module
- handwriting_features.features.implementation.conventional.kinematic module
- handwriting_features.features.implementation.conventional.spatial module
- handwriting_features.features.implementation.conventional.temporal module
- Module contents
- handwriting_features.features.implementation.conventional package
- Module contents
- Subpackages
- handwriting_features.features.validation package
Submodules
handwriting_features.features.base module
- class handwriting_features.features.base.HandwritingFeaturesBase(sample_wrapper, **config)[source]
Bases:
objectBase class for handwriting features
- classmethod after_computation(feature, statistics=None)[source]
Applies the after-computation hook.
- Parameters
feature (numpy.ndarray) – computed feature
statistics (Any[str, list, tuple], optional) – statistics to be computed, defaults to None
- Returns
features
- Return type
numpy.ndarray
- classmethod before_computation(method, kwargs=None)[source]
Applies the before-computation hook.
- Parameters
method (callable) – feature computation method to be applied
kwargs (dict) – feature computation-specific kwargs
- Returns
kwargs
- Return type
dict
- classmethod compute(sample_wrapper, method, statistics=None, **kwargs)[source]
Applies the computation (including before-after computational hooks).
- Parameters
sample_wrapper (HandwritingSampleWrapper) – sample wrapper object
method (callable) – feature computation method to be applied
statistics (iterable, optional) – statistics to be computed, defaults to None
kwargs (**kwargs) – feature computation-specific kwargs
- Returns
computed features
- Return type
numpy.ndarray
- classmethod from_json(path, labels=None, **config)[source]
Initializes HandwritingFeatures object from a JSON file.
- Parameters
path (str) – path to a JSON file
labels (list, optional) – labels for the data values
config (**kwargs) – common configuration
- Returns
HandwritingFeatures object
- Return type
- classmethod from_list(values, labels=None, **config)[source]
Initializes HandwritingFeatures object from a list.
- Parameters
values (list) – data values
labels (list, optional) – labels for the data values
config (**kwargs) – common configuration
- Returns
HandwritingFeatures object
- Return type
- classmethod from_numpy_array(values, labels=None, **config)[source]
Initializes HandwritingFeatures object from a numpy array.
- Parameters
values (numpy.ndarray) – data values
labels (list, optional) – labels for the data values
config (**kwargs) – common configuration
- Returns
HandwritingFeatures object
- Return type
- classmethod from_pandas_dataframe(values, labels=None, **config)[source]
Initializes HandwritingFeatures object from a pandas DataFrame.
- Parameters
values (pandas.DataFrame) – data values
labels (list, optional) – labels for the data values
config (**kwargs) – common configuration
- Returns
HandwritingFeatures object
- Return type
- classmethod from_sample(sample, **config)[source]
Initializes HandwritingFeatures object from a sample. :param sample: handwriting sample object :type sample: HandwritingSample :param config: common configuration :type config: **kwargs :return: HandwritingFeatures object :rtype: HandwritingFeatures
- classmethod from_svc(path, labels=None, **config)[source]
Initializes HandwritingFeatures object from an SVC file.
- Parameters
path (str) – path to an SVC file
labels (list, optional) – labels for the data values
config (**kwargs) – common configuration
- Returns
HandwritingFeatures object
- Return type
handwriting_features.features.interface module
- class handwriting_features.features.interface.HandwritingFeatures(sample_wrapper, **config)[source]
Bases:
HandwritingFeaturesBaseClass implementing interface for computation of handwriting features
- acceleration(axis='xy', in_air=False, statistics=())[source]
Extracts the acceleration.
- Parameters
axis (str, optional) – axis to compute the acceleration from, defaults to “xy”
in_air (bool, optional) – in-air flag, defaults to False
statistics (Any[list, tuple], optional) – statistics to compute, defaults to ()
- Returns
acceleration
- Return type
numpy.ndarray or numpy.NaN
- azimuth(in_air=False, statistics=())[source]
Extracts the azimuth.
- Parameters
in_air (bool, optional) – in-air flag, defaults to False
statistics (Any[list, tuple], optional) – statistics to compute, defaults to ()
- Returns
azimuth
- Return type
numpy.ndarray or numpy.NaN
- jerk(axis='xy', in_air=False, statistics=())[source]
Extracts the jerk.
- Parameters
axis (str, optional) – axis to compute the jerk from, defaults to “xy”
in_air (bool, optional) – in-air flag, defaults to False
statistics (Any[list, tuple], optional) – statistics to compute, defaults to ()
- Returns
jerk
- Return type
numpy.ndarray or numpy.NaN
- number_of_changes_in_azimuth(fs, fc=None, n=None)[source]
Extracts the number of changes in azimuth.
- Parameters
fs (float) – sampling frequency
fc (float, optional) – cutoff frequency for the low-pass filter, defaults to None
n (int, optional) – number of samples of a Gaussian filter, defaults to None
- Returns
number of changes in azimuth
- Return type
int
- number_of_changes_in_pressure(fs, fc=None, n=None)[source]
Extracts the number of changes in pressure.
- Parameters
fs (float) – sampling frequency
fc (float, optional) – cutoff frequency for the low-pass filter, defaults to None
n (int, optional) – number of samples of a Gaussian filter, defaults to None
- Returns
number of changes in pressure
- Return type
int
- number_of_changes_in_tilt(fs, fc=None, n=None)[source]
Extracts the number of changes in tilt.
- Parameters
fs (float) – sampling frequency
fc (float, optional) – cutoff frequency for the low-pass filter, defaults to None
n (int, optional) – number of samples of a Gaussian filter, defaults to None
- Returns
number of changes in tilt
- Return type
int
- number_of_changes_in_velocity_profile(fs, fc=None, n=None)[source]
Extracts the number of changes in velocity profile.
- Parameters
fs (float) – sampling frequency
fc (float, optional) – cutoff frequency for the low-pass filter, defaults to None
n (int, optional) – number of samples of a Gaussian filter, defaults to None
- Returns
number of changes in velocity profile
- Return type
int
- number_of_changes_in_x_profile(fs, fc=None, n=None)[source]
Extracts the number of changes in x profile.
- Parameters
fs (float) – sampling frequency
fc (float, optional) – cutoff frequency for the low-pass filter, defaults to None
n (int, optional) – number of samples of a Gaussian filter, defaults to None
- Returns
number of changes in x profile
- Return type
int
- number_of_changes_in_y_profile(fs, fc=None, n=None)[source]
Extracts the number of changes in y profile.
- Parameters
fs (float) – sampling frequency
fc (float, optional) – cutoff frequency for the low-pass filter, defaults to None
n (int, optional) – number of samples of a Gaussian filter, defaults to None
- Returns
number of changes in y profile
- Return type
int
- number_of_inter_stroke_intersections()[source]
Extracts the number of inter-stroke intersections.
- Returns
number of inter-stroke intersections
- Return type
int
- number_of_interruptions()[source]
Extracts the number of interruptions.
- Returns
number of interruptions
- Return type
float
- number_of_interruptions_relative()[source]
Extracts the number of interruptions relative to the duration.
- Returns
number of interruptions relative to the duration
- Return type
float
- number_of_intra_stroke_intersections(statistics=())[source]
Extracts the number of intra-stroke intersections.
- Parameters
statistics (Any[list, tuple], optional) – statistics to compute, defaults to ()
- Returns
number of intra-stroke intersections
- Return type
numpy.ndarray or np.NaN
- pressure(statistics=())[source]
Extracts the pressure.
- Parameters
statistics (Any[list, tuple], optional) – statistics to compute, defaults to ()
- Returns
pressure
- Return type
numpy.ndarray or numpy.NaN
- ratio_of_stroke_durations(statistics=())[source]
Extracts the ratio of stroke durations: on-surface / in-air.
- Parameters
statistics (Any[list, tuple], optional) – statistics to compute, defaults to ()
- Returns
ratio of stroke durations
- Return type
numpy.ndarray or numpy.NaN
- ratio_of_writing_durations()[source]
Extracts the ratio of writing durations: on-surface / in-air.
- Returns
ratio of writing durations
- Return type
float
- relative_number_of_changes_in_azimuth(fs, fc=None, n=None)[source]
Extracts the relative number of changes in azimuth.
- Parameters
fs (float) – sampling frequency
fc (float, optional) – cutoff frequency for the low-pass filter, defaults to None
n (int, optional) – number of samples of a Gaussian filter, defaults to None
- Returns
relative number of changes in azimuth
- Return type
int
- relative_number_of_changes_in_pressure(fs, fc=None, n=None)[source]
Extracts the relative number of changes in pressure.
- Parameters
fs (float) – sampling frequency
fc (float, optional) – cutoff frequency for the low-pass filter, defaults to None
n (int, optional) – number of samples of a Gaussian filter, defaults to None
- Returns
relative number of changes in pressure
- Return type
int
- relative_number_of_changes_in_tilt(fs, fc=None, n=None)[source]
Extracts the relative number of changes in tilt.
- Parameters
fs (float) – sampling frequency
fc (float, optional) – cutoff frequency for the low-pass filter, defaults to None
n (int, optional) – number of samples of a Gaussian filter, defaults to None
- Returns
relative number of changes in tilt
- Return type
int
- relative_number_of_changes_in_velocity_profile(fs, fc=None, n=None)[source]
Extracts the relative number of changes in velocity profile.
- Parameters
fs (float) – sampling frequency
fc (float, optional) – cutoff frequency for the low-pass filter, defaults to None
n (int, optional) – number of samples of a Gaussian filter, defaults to None
- Returns
relative number of changes in velocity profile
- Return type
int
- relative_number_of_changes_in_x_profile(fs, fc=None, n=None)[source]
Extracts the relative number of changes in x profile.
- Parameters
fs (float) – sampling frequency
fc (float, optional) – cutoff frequency for the low-pass filter, defaults to None
n (int, optional) – number of samples of a Gaussian filter, defaults to None
- Returns
relative number of changes in x profile
- Return type
int
- relative_number_of_changes_in_y_profile(fs, fc=None, n=None)[source]
Extracts the relative number of changes in y profile.
- Parameters
fs (float) – sampling frequency
fc (float, optional) – cutoff frequency for the low-pass filter, defaults to None
n (int, optional) – number of samples of a Gaussian filter, defaults to None
- Returns
relative number of changes in y profile
- Return type
int
- relative_number_of_inter_stroke_intersections()[source]
Extracts the relative number of inter-stroke intersections.
- Returns
relative number of inter-stroke intersections
- Return type
float
- relative_number_of_intra_stroke_intersections(statistics=())[source]
Extracts the relative number of intra-stroke intersections.
- Parameters
statistics (Any[list, tuple], optional) – statistics to compute, defaults to ()
- Returns
relative number of intra-stroke intersections
- Return type
numpy.ndarray or np.NaN
- relative_total_number_of_intra_stroke_intersections()[source]
Extracts the relative total number of intra-stroke intersections.
- Returns
relative total number of intra-stroke intersections
- Return type
float
- stroke_duration(in_air=False, statistics=())[source]
Extracts the stroke duration.
- Parameters
in_air (bool, optional) – in-air flag, defaults to False
statistics (Any[list, tuple], optional) – statistics to compute, defaults to ()
- Returns
stroke duration
- Return type
numpy.ndarray or numpy.NaN
- stroke_height(in_air=False, statistics=())[source]
Extracts the stroke height.
- Parameters
in_air (bool, optional) – in-air flag, defaults to False
statistics (Any[list, tuple], optional) – statistics to compute, defaults to ()
- Returns
stroke height
- Return type
numpy.ndarray or numpy.NaN
- stroke_length(in_air=False, statistics=())[source]
Extracts the stroke length.
- Parameters
in_air (bool, optional) – in-air flag, defaults to False
statistics (Any[list, tuple], optional) – statistics to compute, defaults to ()
- Returns
stroke length
- Return type
numpy.ndarray or numpy.NaN
- stroke_width(in_air=False, statistics=())[source]
Extracts the stroke width.
- Parameters
in_air (bool, optional) – in-air flag, defaults to False
statistics (Any[list, tuple], optional) – statistics to compute, defaults to ()
- Returns
stroke width
- Return type
numpy.ndarray or numpy.NaN
- tilt(in_air=False, statistics=())[source]
Extracts the tilt.
- Parameters
in_air (bool, optional) – in-air flag, defaults to False
statistics (Any[list, tuple], optional) – statistics to compute, defaults to ()
- Returns
tilt
- Return type
numpy.ndarray or numpy.NaN
- total_number_of_intra_stroke_intersections()[source]
Extracts the total number of intra-stroke intersections.
- Returns
total number of intra-stroke intersections
- Return type
int
- velocity(axis='xy', in_air=False, statistics=())[source]
Extracts the velocity.
- Parameters
axis (str, optional) – axis to compute the velocity from, defaults to “xy”
in_air (bool, optional) – in-air flag, defaults to False
statistics (Any[list, tuple], optional) – statistics to compute, defaults to ()
- Returns
velocity
- Return type
numpy.ndarray or numpy.NaN
- vertical_peaks_distance(fs, n=None, statistics=())[source]
Extracts the vertical peaks distance.
- Parameters
fs (float) – sampling frequency
n (int, optional) – number of samples of a Gaussian filter, defaults to None
statistics (Any[list, tuple], optional) – statistics to compute, defaults to ()
- Returns
vertical peaks distance
- Return type
numpy.ndarray or np.NaN
- vertical_peaks_duration(fs, n=None, statistics=())[source]
Extracts the vertical peaks duration.
- Parameters
fs (float) – sampling frequency
n (int, optional) – number of samples of a Gaussian filter, defaults to None
statistics (Any[list, tuple], optional) – statistics to compute, defaults to ()
- Returns
vertical peaks duration
- Return type
numpy.ndarray or np.NaN
- vertical_peaks_indices(fs, n=None, statistics=())[source]
Extracts the vertical peaks indices.
- Parameters
fs (float) – sampling frequency
n (int, optional) – number of samples of a Gaussian filter, defaults to None
statistics (Any[list, tuple], optional) – statistics to compute, defaults to ()
- Returns
vertical peaks indices
- Return type
numpy.ndarray or np.NaN
- vertical_peaks_values(fs, n=None, statistics=())[source]
Extracts the vertical peaks values.
- Parameters
fs (float) – sampling frequency
n (int, optional) – number of samples of a Gaussian filter, defaults to None
statistics (Any[list, tuple], optional) – statistics to compute, defaults to ()
- Returns
vertical peaks values
- Return type
numpy.ndarray or np.NaN
- vertical_peaks_velocity(fs, n=None, statistics=())[source]
Extracts the vertical peaks velocity.
- Parameters
fs (float) – sampling frequency
n (int, optional) – number of samples of a Gaussian filter, defaults to None
statistics (Any[list, tuple], optional) – statistics to compute, defaults to ()
- Returns
vertical peaks velocity
- Return type
numpy.ndarray or np.NaN
- vertical_valleys_distance(fs, n=None, statistics=())[source]
Extracts the vertical valleys distance.
- Parameters
fs (float) – sampling frequency
n (int, optional) – number of samples of a Gaussian filter, defaults to None
statistics (Any[list, tuple], optional) – statistics to compute, defaults to ()
- Returns
vertical valleys distance
- Return type
numpy.ndarray or np.NaN
- vertical_valleys_duration(fs, n=None, statistics=())[source]
Extracts the vertical valleys duration.
- Parameters
fs (float) – sampling frequency
n (int, optional) – number of samples of a Gaussian filter, defaults to None
statistics (Any[list, tuple], optional) – statistics to compute, defaults to ()
- Returns
vertical valleys duration
- Return type
numpy.ndarray or np.NaN
- vertical_valleys_indices(fs, n=None, statistics=())[source]
Extracts the vertical valleys indices.
- Parameters
fs (float) – sampling frequency
n (int, optional) – number of samples of a Gaussian filter, defaults to None
statistics (Any[list, tuple], optional) – statistics to compute, defaults to ()
- Returns
vertical valleys indices
- Return type
numpy.ndarray or np.NaN
- vertical_valleys_values(fs, n=None, statistics=())[source]
Extracts the vertical valleys values.
- Parameters
fs (float) – sampling frequency
n (int, optional) – number of samples of a Gaussian filter, defaults to None
statistics (Any[list, tuple], optional) – statistics to compute, defaults to ()
- Returns
vertical valleys values
- Return type
numpy.ndarray or np.NaN
- vertical_valleys_velocity(fs, n=None, statistics=())[source]
Extracts the vertical valleys velocity.
- Parameters
fs (float) – sampling frequency
n (int, optional) – number of samples of a Gaussian filter, defaults to None
statistics (Any[list, tuple], optional) – statistics to compute, defaults to ()
- Returns
vertical valleys velocity
- Return type
numpy.ndarray or np.NaN
- writing_duration(in_air=False)[source]
Extracts the writing duration.
- Parameters
in_air (bool, optional) – in-air flag, defaults to False
- Returns
writing duration
- Return type
float
- writing_duration_overall()[source]
Extracts the overall writing duration.
- Returns
overall writing duration
- Return type
float
- writing_height(in_air=False)[source]
Extracts the writing height.
- Parameters
in_air (bool, optional) – in-air flag, defaults to False
- Returns
writing height
- Return type
float
- writing_length(in_air=False)[source]
Extracts the writing length.
- Parameters
in_air (bool, optional) – in-air flag, defaults to False
- Returns
writing length
- Return type
float
- writing_stops(statistics=())[source]
Extracts the writing stops.
- Parameters
statistics (Any[list, tuple], optional) – statistics to compute, defaults to ()
- Returns
writing stops
- Return type
numpy.ndarray or np.NaN