handwriting_sample package
Subpackages
- handwriting_sample.base package
- handwriting_sample.reader package
- handwriting_sample.transformer package
- Submodules
- handwriting_sample.transformer.exceptions module
- handwriting_sample.transformer.interface module
HandwritingSampleTransformerHandwritingSampleTransformer.CM_TO_MMHandwritingSampleTransformer.INCH_TO_MMHandwritingSampleTransformer.LPIHandwritingSampleTransformer.LPI_VALUEHandwritingSampleTransformer.LPMMHandwritingSampleTransformer.LPMM_VALUEHandwritingSampleTransformer.MAX_AZIMUTH_DEGREEHandwritingSampleTransformer.MAX_AZIMUTH_VALUEHandwritingSampleTransformer.MAX_OLD_RANGE_PRESSUREHandwritingSampleTransformer.MAX_PRESSURE_VALUEHandwritingSampleTransformer.MAX_TILT_DEGREEHandwritingSampleTransformer.MAX_TILT_VALUEHandwritingSampleTransformer.MMHandwritingSampleTransformer.MM_VALUEHandwritingSampleTransformer.PRESSURE_LEVELSHandwritingSampleTransformer.control_for_pressure()HandwritingSampleTransformer.correct_pen_status()HandwritingSampleTransformer.normalize_pressure()HandwritingSampleTransformer.normalize_time_series()HandwritingSampleTransformer.rescale_axis()HandwritingSampleTransformer.revert_axis()HandwritingSampleTransformer.transform_all_units()HandwritingSampleTransformer.transform_angle()HandwritingSampleTransformer.transform_axis()HandwritingSampleTransformer.transform_time_to_seconds()
- Module contents
- handwriting_sample.validator package
- handwriting_sample.visualizer package
- handwriting_sample.writer package
Submodules
handwriting_sample.exceptions module
handwriting_sample.interface module
- class handwriting_sample.interface.HandwritingSample(x, y, time, pen_status, azimuth, tilt, pressure, meta_data=None, validate=True, verbose=False)[source]
Bases:
HandwritingDataBaseClass implementing the management of sample handwriting samples
- property data_list
Returns list for the non-original data
- property data_numpy_array
Returns numpy array for the non-original data
- property data_pandas_dataframe
Returns pandas DataFrame for the non-original data
- classmethod from_json(path, columns=None, validate=True)[source]
Creates a HandwritingSample instance from a JSON file.
- Parameters
path (str) – path to a JSON file
columns (list, optional) – handwriting variables, defaults to cls.COLUMNS
validate – true if validate input data
:type validate:bool :return: instance of HandwritingSample :rtype: HandwritingSample
- classmethod from_list(data, columns=None, validate=True)[source]
Creates a HandwritingSample instance from a list.
- Parameters
data (list) – data representing handwriting sample
columns (list, optional) – handwriting variables, defaults to cls.COLUMNS
validate – true if validate input data
:type validate:bool :return: instance of HandwritingSample :rtype: HandwritingSample
- classmethod from_numpy_array(data, columns=None, validate=True)[source]
Creates a HandwritingSample instance from a numpy array.
- Parameters
data (np.ndarray) – data representing handwriting sample
columns (list, optional) – handwriting variables, defaults to cls.COLUMNS
validate – true if validate input data
:type validate:bool :return: instance of HandwritingSample :rtype: HandwritingSample
- classmethod from_pandas_dataframe(data, columns=None, validate=True)[source]
Creates a HandwritingSample instance from a pandas DataFrame.
- Parameters
data (pd.DataFrame) – data representing handwriting sample
columns (list, optional) – handwriting variables, defaults to cls.COLUMNS
validate – true if validate input data
:type validate:bool :return: instance of HandwritingSample :rtype: HandwritingSample
- classmethod from_svc(path, columns=None, validate=True)[source]
Creates a HandwritingSample instance from an SVC file.
- Parameters
path (str) – path to an SVC file
columns (list, optional) – handwriting variables, defaults to cls.COLUMNS
validate – true if validate input data
:type validate:bool :return: instance of HandwritingSample :rtype: HandwritingSample
- get_strokes(on_surface_only=False, in_air_only=False)[source]
Splits the movement into strokes.
- Parameters
on_surface_only (bool, optional) – on-surface strokes only, defaults to False
in_air_only (bool, optional) – in-air strokes only, defaults to True
- Returns
list of strokes in tuples with the status of strokes
- Return type
tuple(‘status’, HandwritingSample)
- normalize_pressure(max_pressure=32767, pressure_levels=8192)[source]
Normalizes pressure to pressure level of the device.
- Parameters
max_pressure (int) – OPTIONAL, DEFAULT = 32767 max theoretical raw pressure value
pressure_levels (int) – OPTIONAL, DEFAULT = 8192 level of pressure of the device
- property original_data_list
Returns list for the original data
- property original_data_pandas_dataframe
Returns pandas DataFrame for the original data
- property original_numpy_array
Returns numpy array for the original data
- plot_all_data(x_label=None, save_path=None)[source]
Plot individual plots for each data attribute (x,y,time,azimuth,tilt,pressure)
- Parameters
x_label (str) – OPTIONAL, label of X axis
save_path (str) – OPTIONAL, set save path if you wish to save the figure
- plot_in_air(x_label=None, y_label=None, save_path=None)[source]
Plot in air data
- Parameters
x_label (str) – OPTIONAL, label of X axis
y_label (str) – OPTIONAL, label of Y axis
save_path (str) – OPTIONAL, set save path if you wish to save the figure
- Returns
axis and plot objects
- plot_on_surface(x_label=None, y_label=None, save_path=None)[source]
Plot on surface data
- Parameters
x_label (str) – OPTIONAL, label of X axis
y_label (str) – OPTIONAL, label of Y axis
save_path (str) – OPTIONAL, set save path if you wish to save the figure
- Returns
axis and plot objects
- plot_separate_movements(x_label=None, y_label=None, save_path=None)[source]
Plot separate movement in one plot (on_surface + in_air)
- Parameters
x_label (str) – OPTIONAL, label of X axis
y_label (str) – OPTIONAL, label of Y axis
save_path (str) – OPTIONAL, set save path if you wish to save the figure
- Returns
axis and plot objects
- plot_strokes(x_label=None, y_label=None, save_path=None)[source]
Plot separate strokes in one plot
- Parameters
x_label (str) – OPTIONAL, label of X axis
y_label (str) – OPTIONAL, label of Y axis
save_path (str) – OPTIONAL, set save path if you wish to save the figure
- Returns
axis and plot objects
- reader = <handwriting_sample.reader.interface.HandwritingSampleReader object>
- to_json(path, file_name=None, store_original_data=False)[source]
Writes sample data to a JSON file.
- Parameters
path (str) – path where data should be stored
file_name (str, optional) – custom file name, defaults to None
store_original_data (bool, optional) – store original data, defaults to False
- Returns
None
- Return type
None type
- to_svc(path, file_name=None, store_original_data=False)[source]
Writes sample data to an SVC file.
- Parameters
path (str) – path where data should be stored
file_name (str, optional) – custom file name, defaults to None
store_original_data (bool, optional) – store original data, defaults to False
- Returns
None
- Return type
None type
- transform_all_units(conversion_type='lpi', lpi_value=5080, lpmm_value=200, max_raw_azimuth=3600, max_raw_tilt=900, max_degree_azimuth=360, max_degree_tilt=90, max_pressure=32767, pressure_levels=8192, angles_to_degrees=True, shift_to_zero=True)[source]
- Transforms all unites of sample object:
transforms X,Y to millimeters.
transform time to seconds
normalize or transform to degrees angles
normalize pressure
- Parameters
conversion_type (str) – OPTIONAL [“lpi”|”lpmm”], DEFAULT=”lpi”. Set the capturing method used for mapping; “lpi” for inch; “lpmm” for millimeters
lpi_value (int) – OPTIONAL , DEFAULT = 5080 Set lpi value of digitizing tablet.
lpmm_value (int) – OPTIONAL, DEFAULT = 200 Set lpmm value of digitizing tablet.
max_raw_azimuth (int) – OPTIONAL, DEFAULT = 3600 Maximum theoretical value of azimuth.
max_raw_tilt (int) – OPTIONAL, DEFAULT = 900 Maximum theoretical value of tilt.
max_degree_azimuth (int) – OPTIONAL, DEFAULT = 360 Maximum degree value of azimuth.
max_degree_tilt (int) – OPTIONAL, DEFAULT = 90 Maximum degree value of tilt.
max_pressure (int) – OPTIONAL, DEFAULT = 32767 Maximum theoretical value of pressure.
pressure_levels (int) – OPTIONAL, DEFAULT = 8192 Level of pressures of the device.
angles_to_degrees (bool) – OPTIONAL, DEFAULT = True Transform angles to degrees
shift_to_zero (bool) – OPTIONAL, DEFAULT = True Shift axis values to start from 0,0 coordinates
- transform_angle_to_degree(angle=None, max_raw_value=None, max_degree_value=None)[source]
Transforms raw angle to degrees.
- Parameters
angle (str) – Angle that should bne converted [tilt, azimuth]
max_raw_value (int) – OPTIONAL, Maximal theoretical value of raw angle
max_degree_value (int) – OPTIONAL, Maximal value of angle in degrees
- transform_axis_to_mm(conversion_type='lpi', lpi_value=5080, lpmm_value=200, shift_to_zero=True)[source]
Transforms X,Y axis to millimeters.
- Parameters
conversion_type (str) – OPTIONAL [“lpi”|”lpmm”|”mm”], DEFAULT=”lpi”. Set the capturing method used for mapping; “lpi” for inch; “lpmm” for millimeters; “mm” for direct to millimeters
lpi_value (int) – OPTIONAL, DEFAULT = 5080 Set lpi value of digitizing tablet
lpmm_value (int) – OPTIONAL, DEFAULT = 200 Set lpmm value of digitizing tablet
shift_to_zero (bool) – OPTIONAL, DEFAULT = True Shift axis values to start from 0,0 coordinates
- transformer = <handwriting_sample.transformer.interface.HandwritingSampleTransformer object>
- validator = <handwriting_sample.validator.interface.HandwritingSampleValidator object>
- visualizer = <handwriting_sample.visualizer.interface.HandwritingSampleVisualizer object>
- writer = <handwriting_sample.writer.interface.HandwritingSampleWriter object>
- property xy
Returns general movement of X and Y