Validation Module

validation.validate_trajectory(trajectory: list[tuple[float, float]])

Validate that the input is a non-empty list of coordinate tuples with valid latitude and longitude values.

Parameters:

trajectory (list[tuple[float, float]]) – A list of tuples representing coordinates (latitude, longitude).

Raises:

ValueError

  • if trajectory is not a non-empty list of coordinate tuples

  • if any tuple does not contain exactly two elements

  • if latitude or longitude are not numeric types

  • if latitude is not between -90 and 90, or longitude is not between -180 and 180

validation.validate_numeric_list(sequence: list[float])

Validate that the input is a non-empty list of numeric values.

Parameters:

sequence (list[float]) – A list of numeric values.

Raises:

ValueError

  • If sequence is not a non-empty list.

  • If any element in sequence is not a numeric type.

validation.validate_scalar(value, name='value')

Validate that the input value is a scalar (integer or float).

Parameters:
  • value (int or float) – The value to validate.

  • name (str, optional) – Name of the variable, used for error messages, defaults to “value”.

Raises:

ValueError – If value is not a numeric type.

validation.validate_positive_scalar(value: int | float, name='value')

Validate that the input value is a positive scalar (integer or float).

Parameters:
  • value (int or float) – The value to validate.

  • name (str, optional) – Name of the variable, used for error messages, defaults to “value”.

Raises:

ValueError – If value is not a non-negative numeric type.

validation.validate_distance_parameters(p: list[float], q: list[float])

Validate that two numeric lists are provided and that they have the same length.

Parameters:
Raises:

ValueError

  • If either p or q is not a numeric list.

  • If p and q do not have the same length.

validation.validate_dtw(seq1: list[tuple[float, float]], seq2: list[tuple[float, float]])

Validate parameters for the Dynamic Time Warping (DTW) algorithm.

Parameters:
validation.validate_ers(r: list[float], s: list[float], sigma: float = 1.0, cost_deletion: float = 1.0, cost_insertion: float = 1.0, subcost_within_sigma: float = 0.0, subcost_outside_sigma: float = 1.0)

Validate parameters for the Edit Distance on Real Sequences (ERS) algorithm.

Parameters:
  • r (list[float]) – First numeric list.

  • s (list[float]) – Second numeric list.

  • sigma (float) – Threshold for matching.

  • cost_deletion (float) – Cost for deletion operations.

  • cost_insertion (float) – Cost for insertion operations.

  • subcost_within_sigma (float) – Substitution cost within sigma range.

  • subcost_outside_sigma (float) – Substitution cost outside sigma range.

Raises:

ValueError

  • if any list parameter is not a numeric list

  • if any cost parameter is not a positive scalar

validation.validate_erp(r: list[float], s: list[float], g: float)

Validate parameters for the Edit Distance with Real Penalty (ERP) algorithm.

Parameters:
Raises:

ValueError

  • if r or s is not a numeric list

  • if g is not a scalar

validation.validate_euclidean(p: list[float], q: list[float])

Validate parameters for Euclidean distance calculation between two numeric lists.

Parameters:
Raises:

ValueError

  • if p or q is not a numeric list

  • if p and q do not have the same length

validation.validate_frechet(p: list[float], q: list[float])

Validate parameters for Fréchet distance calculation between two numeric lists.

Parameters:
Raises:

ValueError

  • if p or q is not a numeric list

validation.validate_hausdorff(p: list[float], q: list[float])

Validate parameters for Hausdorff distance calculation between two numeric lists.

Parameters:
Raises:

ValueError

  • if p or q is not a numeric list

validation.validate_lcss(r: list[float], s: list[float], sigma: float)

Validate parameters for Longest Common Subsequence Similarity (LCSS) calculation.

Parameters:
  • r (list[float]) – First numeric list.

  • s (list[float]) – Second numeric list.

  • sigma (float) – Matching threshold.

Raises:

ValueError

  • if r or s is not a numeric list

  • if sigma is not a positive scalar

validation.validate_rdp(sequence: list[tuple[float, float]], tolerance: float)

Validate parameters for the Ramer-Douglas-Peucker (RDP) simplification algorithm.

Parameters:
  • sequence (list[tuple[float, float]]) – List of coordinate tuples (latitude, longitude).

  • tolerance (float) – Tolerance value for simplification.

Raises:

ValueError

  • if sequence is not a valid trajectory list

  • if tolerance is not a positive scalar