Skip to content

Settings

settings

Settings dataclass

Settings()

Bases: ABC

Base class for all settings dataclasses.

Provides serialization/deserialization functionality to and from dictionaries, JSON strings, and files.

to_dict

to_dict() -> dict

Converts settings to a dictionary.

Returns:

  • dict ( dict ) –

    Dictionary representation of the settings

Source code in trajectopy\core\settings.py
def to_dict(self) -> dict:
    """Converts settings to a dictionary.

    Returns:
        dict: Dictionary representation of the settings
    """
    return {
        key: (value.to_dict() if issubclass(type(value), Settings) else self.encoder(key, value))
        for key, value in self.__dict__.items()
    }

encoder staticmethod

encoder(name: str, value: Any) -> Any

Encodes values for JSON serialization.

Parameters:

  • name (str) –

    Name of the attribute being encoded

  • value (Any) –

    Value to encode

Returns:

  • Any ( Any ) –

    Encoded value suitable for JSON serialization

Source code in trajectopy\core\settings.py
@staticmethod
def encoder(name: str, value: Any) -> Any:
    """Encodes values for JSON serialization.

    Args:
        name: Name of the attribute being encoded
        value: Value to encode

    Returns:
        Any: Encoded value suitable for JSON serialization
    """
    return value

decoder staticmethod

decoder(name: str, value: Any) -> Any

Decodes values from JSON deserialization.

Parameters:

  • name (str) –

    Name of the attribute being decoded

  • value (Any) –

    Value to decode

Returns:

  • Any ( Any ) –

    Decoded value

Source code in trajectopy\core\settings.py
@staticmethod
def decoder(name: str, value: Any) -> Any:
    """Decodes values from JSON deserialization.

    Args:
        name: Name of the attribute being decoded
        value: Value to decode

    Returns:
        Any: Decoded value
    """
    return value

to_json

to_json() -> str

Converts settings to a JSON string.

Returns:

  • str ( str ) –

    JSON string representation of the settings

Source code in trajectopy\core\settings.py
def to_json(self) -> str:
    """Converts settings to a JSON string.

    Returns:
        str: JSON string representation of the settings
    """
    return json.dumps(self.to_dict(), indent=4)

to_file

to_file(path: str) -> None

Writes settings to a JSON file.

Parameters:

  • path (str) –

    Path to the output file

Source code in trajectopy\core\settings.py
def to_file(self, path: str) -> None:
    """Writes settings to a JSON file.

    Args:
        path: Path to the output file
    """
    with open(path, "w", encoding="utf-8") as f:
        f.write(self.to_json())

from_dict classmethod

from_dict(dct: dict) -> _SettingsT

Creates settings instance from a dictionary.

Missing attributes keep their default value so that settings files written by older versions can still be read. Unknown attributes are ignored with a warning.

Parameters:

  • dct (dict) –

    Dictionary containing settings data

Returns:

  • Settings ( _SettingsT ) –

    New settings instance

Raises:

  • TypeError –

    If a value does not match the declared attribute type

Source code in trajectopy\core\settings.py
@classmethod
def from_dict(cls: type[_SettingsT], dct: dict) -> _SettingsT:
    """Creates settings instance from a dictionary.

    Missing attributes keep their default value so that settings files written by
    older versions can still be read. Unknown attributes are ignored with a warning.

    Args:
        dct: Dictionary containing settings data

    Returns:
        Settings: New settings instance

    Raises:
        TypeError: If a value does not match the declared attribute type
    """
    settings = cls()
    settings.update_from_dict(dct)
    return settings

from_file classmethod

from_file(path: str) -> _SettingsT

Loads settings from a JSON file.

Parameters:

  • path (str) –

    Path to the JSON file

Returns:

  • Settings ( _SettingsT ) –

    Settings instance loaded from file

Source code in trajectopy\core\settings.py
@classmethod
def from_file(cls: type[_SettingsT], path: str) -> _SettingsT:
    """Loads settings from a JSON file.

    Args:
        path: Path to the JSON file

    Returns:
        Settings: Settings instance loaded from file
    """
    with open(path, encoding="utf-8") as f:
        data = json.load(f)

    return cls.from_dict(data)

update_from_dict

update_from_dict(dct: dict) -> None

Updates settings from a dictionary.

Attributes missing from the dictionary keep their current value. Unknown attributes are ignored with a warning. The update is atomic: if any value is invalid, the settings remain unchanged.

Parameters:

  • dct (dict) –

    Dictionary containing updated settings data

Raises:

  • TypeError –

    If a value does not match the declared attribute type

Source code in trajectopy\core\settings.py
def update_from_dict(self, dct: dict) -> None:
    """Updates settings from a dictionary.

    Attributes missing from the dictionary keep their current value. Unknown attributes
    are ignored with a warning. The update is atomic: if any value is invalid, the
    settings remain unchanged.

    Args:
        dct: Dictionary containing updated settings data

    Raises:
        TypeError: If a value does not match the declared attribute type
    """
    updates = self._decoded_updates(dct)  # validates everything before anything is changed
    for attribute_name, value in updates.items():
        if isinstance(value, Settings):
            # update nested settings in place, so that references held elsewhere stay up to date
            getattr(self, attribute_name)._assign_from(value)
        else:
            setattr(self, attribute_name, value)

AlignmentPreprocessing dataclass

AlignmentPreprocessing(
    min_speed: float = 0.0,
    time_start: float = 0.0,
    time_end: float = 0.0,
    max_samples: int = 5000,
)

Bases: Settings

Configuration for alignment preprocessing filters.

Attributes:

  • min_speed (float) –

    Only poses with speed above this threshold are considered for alignment (meters/second). Defaults to 0.0.

  • time_start (float) –

    Only poses with timestamp above this threshold are considered. Timestamp is in seconds relative to first common timestamp. Defaults to 0.0.

  • time_end (float) –

    Only poses with timestamp below this threshold are considered. Timestamp is in seconds relative to first common timestamp. Defaults to 0.0.

  • max_samples (int) –

    Maximum number of matched poses used for the alignment. If more poses are available, a new random subset of this size is drawn on each run. Set to 0 to use all poses. Defaults to 5000.

AlignmentEstimationSettings dataclass

AlignmentEstimationSettings(
    translation_x: bool = True,
    translation_y: bool = True,
    translation_z: bool = True,
    rotation_x: bool = True,
    rotation_y: bool = True,
    rotation_z: bool = True,
    scale: bool = False,
    time_shift: bool = False,
    leverarm_x: bool = False,
    leverarm_y: bool = False,
    leverarm_z: bool = False,
    sensor_rotation: bool = False,
)

Bases: Settings

Configuration for parameters to estimate during trajectory alignment.

Attributes:

  • translation_x (bool) –

    Enable x-translation of similarity transformation

  • translation_y (bool) –

    Enable y-translation of similarity transformation

  • translation_z (bool) –

    Enable z-translation of similarity transformation

  • rotation_x (bool) –

    Enable rotation around X-axis of similarity transformation

  • rotation_y (bool) –

    Enable rotation around Y-axis of similarity transformation

  • rotation_z (bool) –

    Enable rotation around Z-axis of similarity transformation

  • scale (bool) –

    Enable scaling of similarity transformation

  • time_shift (bool) –

    Enable estimation of time shift between trajectories

  • leverarm_x (bool) –

    Enable estimation of lever arm in X-direction

  • leverarm_y (bool) –

    Enable estimation of lever arm in Y-direction

  • leverarm_z (bool) –

    Enable estimation of lever arm in Z-direction

  • sensor_rotation (bool) –

    Enable computation of sensor rotation offsets (independent of least squares, computes constant offsets between roll, pitch, yaw)

all_disabled property

all_disabled: bool

Checks if all alignment parameters are disabled.

Returns:

  • bool ( bool ) –

    True if all parameters (Helmert, time shift, leverarm, sensor rotation) are disabled

all_lq_disabled property

all_lq_disabled: bool

Checks if all least-squares parameters are disabled.

Returns:

  • bool ( bool ) –

    True if all parameters estimated with least-squares are disabled

helmert_enabled property

helmert_enabled: bool

Checks if any Helmert transformation parameter is enabled.

Returns:

  • bool ( bool ) –

    True if any translation, rotation, or scale parameter is enabled

leverarm_enabled property

leverarm_enabled: bool

Checks if any leverarm parameter is enabled.

Returns:

  • bool ( bool ) –

    True if any leverarm component (x, y, z) is enabled

time_shift_enabled property

time_shift_enabled: bool

Checks if time shift estimation is enabled.

Returns:

  • bool ( bool ) –

    True if time shift is enabled

short_mode_str property

short_mode_str: str

Gets a short string describing enabled parameter groups.

Returns:

  • str ( str ) –

    Space-separated string of enabled parameter groups (e.g., "Helmert Time-Shift Leverarm")

time_shift_filter property

time_shift_filter: list[bool]

Gets time shift parameter filter.

Returns:

  • list[bool] –

    List[bool]: List of 3 bools, all True if time shift enabled, else all False

helmert_filter property

helmert_filter: list[bool]

Gets Helmert parameter filter.

Returns:

  • list[bool] –

    List[bool]: List of 7 bools indicating which Helmert parameters are enabled

leverarm_filter property

leverarm_filter: list[bool]

Gets leverarm parameter filter.

Returns:

  • list[bool] –

    List[bool]: List of 3 bools indicating which leverarm components are enabled

enabled_lq_parameter_filter property

enabled_lq_parameter_filter: list[bool]

Gets filter for enabled least-squares parameters only.

Returns:

  • list[bool] –

    List[bool]: List of bools for only the enabled parameter groups

lq_parameter_filter property

lq_parameter_filter: list[bool]

Gets complete least-squares parameter filter.

Returns:

  • list[bool] –

    List[bool]: List of 11 bools for all LQ parameters (7 Helmert + 1 time shift + 3 leverarm)

__bool__

__bool__() -> bool

Returns True if any least-squares parameter is enabled.

Returns:

  • bool ( bool ) –

    True if at least one least-squares parameter is enabled

Source code in trajectopy\core\settings.py
def __bool__(self) -> bool:
    """Returns True if any least-squares parameter is enabled.

    Returns:
        bool: True if at least one least-squares parameter is enabled
    """
    return not self.all_lq_disabled

from_components classmethod

from_components(
    similarity: bool = False,
    time_shift: bool = False,
    leverarm: bool = False,
    sensor_rotation: bool = False,
) -> AlignmentEstimationSettings

Creates settings from high-level component flags.

Parameters:

  • similarity (bool, default: False ) –

    Enable all similarity transformation parameters. Defaults to False.

  • time_shift (bool, default: False ) –

    Enable time shift estimation. Defaults to False.

  • leverarm (bool, default: False ) –

    Enable all leverarm parameters. Defaults to False.

  • sensor_rotation (bool, default: False ) –

    Enable sensor rotation estimation. Defaults to False.

Returns:

Source code in trajectopy\core\settings.py
@classmethod
def from_components(
    cls,
    similarity: bool = False,
    time_shift: bool = False,
    leverarm: bool = False,
    sensor_rotation: bool = False,
) -> "AlignmentEstimationSettings":
    """Creates settings from high-level component flags.

    Args:
        similarity: Enable all similarity transformation parameters. Defaults to False.
        time_shift: Enable time shift estimation. Defaults to False.
        leverarm: Enable all leverarm parameters. Defaults to False.
        sensor_rotation: Enable sensor rotation estimation. Defaults to False.

    Returns:
        AlignmentEstimationSettings: New settings instance
    """
    return cls(
        translation_x=similarity,
        translation_y=similarity,
        translation_z=similarity,
        rotation_x=similarity,
        rotation_y=similarity,
        rotation_z=similarity,
        scale=similarity,
        time_shift=time_shift,
        leverarm_x=leverarm,
        leverarm_y=leverarm,
        leverarm_z=leverarm,
        sensor_rotation=sensor_rotation,
    )

all classmethod

all(
    sensor_rotation: bool = True,
) -> AlignmentEstimationSettings

Creates settings with all parameters enabled.

Parameters:

  • sensor_rotation (bool, default: True ) –

    Enable sensor rotation. Defaults to True.

Returns:

Source code in trajectopy\core\settings.py
@classmethod
def all(cls, sensor_rotation: bool = True) -> "AlignmentEstimationSettings":
    """Creates settings with all parameters enabled.

    Args:
        sensor_rotation: Enable sensor rotation. Defaults to True.

    Returns:
        AlignmentEstimationSettings: Settings with all parameters enabled
    """
    return cls(
        translation_x=True,
        translation_y=True,
        translation_z=True,
        rotation_x=True,
        rotation_y=True,
        rotation_z=True,
        scale=True,
        time_shift=True,
        leverarm_x=True,
        leverarm_y=True,
        leverarm_z=True,
        sensor_rotation=sensor_rotation,
    )

from_bool_list classmethod

from_bool_list(
    bool_list: list[bool],
) -> AlignmentEstimationSettings

Creates settings from a list of boolean values.

Parameters:

  • bool_list (list[bool]) –

    List of 14 booleans corresponding to parameter enable flags

Returns:

Raises:

  • ValueError –

    If bool_list length is not 14

Source code in trajectopy\core\settings.py
@classmethod
def from_bool_list(cls, bool_list: list[bool]) -> "AlignmentEstimationSettings":
    """Creates settings from a list of boolean values.

    Args:
        bool_list: List of 14 booleans corresponding to parameter enable flags

    Returns:
        AlignmentEstimationSettings: New settings instance

    Raises:
        ValueError: If bool_list length is not 14
    """
    if len(bool_list) != 14:
        raise ValueError(
            f"Size mismatch: bool_list must have length 14 (Number of configurable parameters) (got {len(bool_list)})"
        )

    return AlignmentEstimationSettings(
        translation_x=bool_list[0],
        translation_y=bool_list[1],
        translation_z=bool_list[2],
        rotation_x=bool_list[3],
        rotation_y=bool_list[4],
        rotation_z=bool_list[5],
        scale=bool_list[6],
        time_shift=bool_list[7],
        leverarm_x=bool_list[8],
        leverarm_y=bool_list[9],
        leverarm_z=bool_list[10],
        sensor_rotation=any(bool_list[11:]),
    )

AlignmentStochastics dataclass

AlignmentStochastics(
    std_xy_from: float = 1.0,
    std_z_from: float = 1.0,
    std_xy_to: float = 1.0,
    std_z_to: float = 1.0,
    std_roll_pitch: float = float(deg2rad(1.0)),
    std_yaw: float = float(deg2rad(1.0)),
    std_speed: float = 1.0,
    error_probability: float = 0.05,
    variance_estimation: bool = False,
    robust_estimation: bool = True,
)

Bases: Settings

Configuration for alignment stochastic model (observation uncertainties).

Attributes:

  • std_xy_from (float) –

    Standard deviation of XY source position components in meters. Defaults to 1.0.

  • std_z_from (float) –

    Standard deviation of Z source position component in meters. Defaults to 1.0.

  • std_xy_to (float) –

    Standard deviation of XY target position components in meters. Defaults to 1.0.

  • std_z_to (float) –

    Standard deviation of Z target position component in meters. Defaults to 1.0.

  • std_roll_pitch (float) –

    Standard deviation of roll and pitch angles in radians. Defaults to ~0.017 rad (1°).

  • std_yaw (float) –

    Standard deviation of yaw angle in radians. Defaults to ~0.017 rad (1°).

  • std_speed (float) –

    Standard deviation of platform speed in meters per second. Defaults to 1.0.

  • error_probability (float) –

    Probability of error for stochastic testing. Defaults to 0.05.

  • variance_estimation (bool) –

    Enable a-posteriori variance factor estimation. Defaults to False.

  • robust_estimation (bool) –

    Down-weight epochs with large residuals (iteratively reweighted least squares with Huber weights), so that outliers, e.g. from wrong matches or GNSS multipath, hardly affect the estimated parameters. Defaults to True.

var_xy_from property

var_xy_from: float

Gets variance of XY source position components.

Returns:

  • float ( float ) –

    Variance (squared standard deviation)

var_z_from property

var_z_from: float

Gets variance of Z source position component.

Returns:

  • float ( float ) –

    Variance (squared standard deviation)

var_xy_to property

var_xy_to: float

Gets variance of XY target position components.

Returns:

  • float ( float ) –

    Variance (squared standard deviation)

var_z_to property

var_z_to: float

Gets variance of Z target position component.

Returns:

  • float ( float ) –

    Variance (squared standard deviation)

var_roll_pitch property

var_roll_pitch: float

Gets variance of roll and pitch angles.

Returns:

  • float ( float ) –

    Variance (squared standard deviation)

var_yaw property

var_yaw: float

Gets variance of yaw angle.

Returns:

  • float ( float ) –

    Variance (squared standard deviation)

var_speed_to property

var_speed_to: float

Gets variance of platform speed.

Returns:

  • float ( float ) –

    Variance (squared standard deviation)

AlignmentSettings dataclass

AlignmentSettings(
    preprocessing: AlignmentPreprocessing = AlignmentPreprocessing(),
    estimation_settings: AlignmentEstimationSettings = AlignmentEstimationSettings(),
    stochastics: AlignmentStochastics = AlignmentStochastics(),
    metric_threshold: float = METRIC_THRESHOLD,
    time_threshold: float = TIME_THRESHOLD,
)

Bases: Settings

Complete configuration for trajectory alignment.

Combines preprocessing, estimation, and stochastic settings for trajectory alignment.

Attributes:

  • preprocessing (AlignmentPreprocessing) –

    Preprocessing filter settings

  • estimation_settings (AlignmentEstimationSettings) –

    Parameter estimation settings

  • stochastics (AlignmentStochastics) –

    Stochastic model (observation uncertainty) settings

  • metric_threshold (float) –

    Iteration threshold for metric parameters in least squares. Defaults to 1e-4.

  • time_threshold (float) –

    Iteration threshold for time shift parameter in least squares (seconds). Defaults to 1e-4.

__str__

__str__() -> str

Returns string representation of all settings.

Returns:

  • str ( str ) –

    Concatenated string of preprocessing, estimation, and stochastics settings

Source code in trajectopy\core\settings.py
def __str__(self) -> str:
    """Returns string representation of all settings.

    Returns:
        str: Concatenated string of preprocessing, estimation, and stochastics settings
    """
    return str(self.preprocessing) + str(self.estimation_settings) + str(self.stochastics)

RotationApproximationMethod

Bases: Enum

Method for rotation approximation.

PositionApproximationMethod

Bases: Enum

Method for position approximation.

ApproximationSettings dataclass

ApproximationSettings(
    position_interval_size: float = 0.15,
    position_min_observations: int = 25,
    rotation_window_size: float = 0.15,
    max_path_length_gap: float = 0.15,
    position_approximation_method: PositionApproximationMethod = CUBIC,
    rotation_approximation_method: RotationApproximationMethod = AVERAGE_IN_WINDOW,
)

Bases: Settings

Configuration for trajectory approximation and smoothing.

Attributes:

  • position_interval_size (float) –

    Size of position intervals in meters for cubic approximation. Defaults to 0.15.

  • position_min_observations (int) –

    Minimum number of observations required in each interval for cubic approximation. Defaults to 25.

  • rotation_window_size (float) –

    Size of rotation smoothing window in meters (not cubic). Defaults to 0.15.

  • max_path_length_gap (float) –

    Maximum gap size in path length for interpolation. Defaults to 0.15.

encoder staticmethod

encoder(name: str, value: Any) -> Any

Encodes position_approximation_method and rotation_approximation_method enums to string values.

Parameters:

  • name (str) –

    Attribute name

  • value (Any) –

    Value to encode

Returns:

  • Any ( Any ) –

    Encoded value

Source code in trajectopy\core\settings.py
@staticmethod
def encoder(name: str, value: Any) -> Any:
    """Encodes position_approximation_method and rotation_approximation_method enums to string values.

    Args:
        name: Attribute name
        value: Value to encode

    Returns:
        Any: Encoded value
    """
    if name in ["position_approximation_method", "rotation_approximation_method"]:
        return value.value
    return value

decoder staticmethod

decoder(name: str, value: Any) -> Any

Decodes position_approximation_method and rotation_approximation_method strings to enums. Args: name: Attribute name value: Value to decode

Returns:

  • Any ( Any ) –

    Decoded value

Source code in trajectopy\core\settings.py
@staticmethod
def decoder(name: str, value: Any) -> Any:
    """Decodes position_approximation_method and rotation_approximation_method strings to enums.
    Args:
        name: Attribute name
        value: Value to decode

    Returns:
        Any: Decoded value
    """
    if name == "position_approximation_method":
        return PositionApproximationMethod(value)
    if name == "rotation_approximation_method":
        return RotationApproximationMethod(value)
    return value

PairDistanceUnit

Bases: Enum

Unit of measurement for pose pair distances in relative comparison.

from_str classmethod

from_str(unit_str: str) -> PairDistanceUnit

Converts a string to a PairDistanceUnit.

Parameters:

  • unit_str (str) –

    String to convert ("m", "meter", "s", "sec", "second")

Returns:

Raises:

  • ValueError –

    If unit string is not recognized

Source code in trajectopy\core\settings.py
@classmethod
def from_str(cls, unit_str: str) -> "PairDistanceUnit":
    """Converts a string to a PairDistanceUnit.

    Args:
        unit_str: String to convert ("m", "meter", "s", "sec", "second")

    Returns:
        PairDistanceUnit: Converted unit

    Raises:
        ValueError: If unit string is not recognized
    """
    if unit_str.lower() in {"m", "meter"}:
        return cls.METER
    if unit_str.lower() in {"s", "sec", "second"}:
        return cls.SECOND

    raise ValueError(f"Unknown unit string {unit_str}")

ComparisonMethod

Bases: Enum

Method for trajectory comparison.

from_string classmethod

from_string(string: str) -> ComparisonMethod

Converts string to ComparisonMethod.

Parameters:

  • string (str) –

    String containing "absolute" or "relative"

Returns:

Source code in trajectopy\core\settings.py
@classmethod
def from_string(cls, string: str) -> "ComparisonMethod":
    """Converts string to ComparisonMethod.

    Args:
        string: String containing "absolute" or "relative"

    Returns:
        ComparisonMethod: Parsed comparison method
    """
    return _comparison_method_from_string(string)

RelativeComparisonSettings dataclass

RelativeComparisonSettings(
    pair_min_distance: float = 100.0,
    pair_max_distance: float = 800.0,
    pair_distance_step: float = 100.0,
    pair_distance_unit: PairDistanceUnit = METER,
    use_all_pose_pairs: bool = True,
)

Bases: Settings

Configuration for relative trajectory comparison (RPE - Relative Pose Error).

Relative comparison involves finding pose pairs separated by specific distances or time intervals and computing relative translation/rotation differences.

Attributes:

  • pair_min_distance (float) –

    Minimum pose pair distance to consider during RPE computation. Defaults to 100.0.

  • pair_max_distance (float) –

    Maximum pose pair distance to consider during RPE computation. Defaults to 800.0.

  • pair_distance_step (float) –

    Step size for increasing pose pair distance. Defaults to 100.0.

  • pair_distance_unit (PairDistanceUnit) –

    Unit of pose pair distance (METER or SECOND). Defaults to METER.

  • use_all_pose_pairs (bool) –

    If True, use overlapping pose pairs; if False, use only consecutive (non-overlapping) pairs. Defaults to True.

encoder staticmethod

encoder(name: str, value: Any) -> Any

Encodes pair_distance_unit enum to string value.

Parameters:

  • name (str) –

    Attribute name

  • value (Any) –

    Value to encode

Returns:

  • Any ( Any ) –

    Encoded value

Source code in trajectopy\core\settings.py
@staticmethod
def encoder(name: str, value: Any) -> Any:
    """Encodes pair_distance_unit enum to string value.

    Args:
        name: Attribute name
        value: Value to encode

    Returns:
        Any: Encoded value
    """
    return value.value if name == "pair_distance_unit" else value

decoder staticmethod

decoder(name: str, value: Any) -> Any

Decodes pair_distance_unit string to enum.

Parameters:

  • name (str) –

    Attribute name

  • value (Any) –

    Value to decode

Returns:

  • Any ( Any ) –

    Decoded value

Source code in trajectopy\core\settings.py
@staticmethod
def decoder(name: str, value: Any) -> Any:
    """Decodes pair_distance_unit string to enum.

    Args:
        name: Attribute name
        value: Value to decode

    Returns:
        Any: Decoded value
    """
    return PairDistanceUnit(value) if name == "pair_distance_unit" else value

MatchingMethod

Bases: Enum

Method for matching poses between two trajectories.

Attributes:

  • NEAREST_SPATIAL –

    Match by nearest Euclidean distance

  • NEAREST_TEMPORAL –

    Match by nearest timestamp

  • INTERPOLATION –

    Match using linear interpolation (SLERP for rotations)

  • NEAREST_SPATIAL_INTERPOLATED –

    Match spatially using k-nearest and 3D line fit

  • UNKNOWN –

    Unknown matching method

InterpolationMethod

Bases: Enum

Method for interpolation.

MatchingSettings dataclass

MatchingSettings(
    method: MatchingMethod = INTERPOLATION,
    max_time_diff: float = 0.01,
    max_distance: float = 0.0,
    max_gap_size: float = 10.0,
    k_nearest: int = 2,
)

Bases: Settings

Configuration for trajectory matching.

Attributes:

  • method (MatchingMethod) –

    Matching method to use. Defaults to INTERPOLATION.

  • max_time_diff (float) –

    Maximum allowed time difference in seconds for temporal matching. Defaults to 0.01.

  • max_distance (float) –

    Maximum allowed distance in meters for spatial matching. Defaults to 0.0.

  • max_gap_size (float) –

    Maximum allowed gap size in seconds within trajectories. Defaults to 10.0.

  • k_nearest (int) –

    Number of nearest neighbors for spatial interpolation matching. Defaults to 2.

encoder staticmethod

encoder(name: str, value: Any) -> Any

Encodes method enum to string value.

Parameters:

  • name (str) –

    Attribute name

  • value (Any) –

    Value to encode

Returns:

  • Any ( Any ) –

    Encoded value

Source code in trajectopy\core\settings.py
@staticmethod
def encoder(name: str, value: Any) -> Any:
    """Encodes method enum to string value.

    Args:
        name: Attribute name
        value: Value to encode

    Returns:
        Any: Encoded value
    """
    return value.value if name == "method" else value

decoder staticmethod

decoder(name: str, value: Any) -> Any

Decodes method string to enum.

Parameters:

  • name (str) –

    Attribute name

  • value (Any) –

    Value to decode

Returns:

  • Any ( Any ) –

    Decoded value

Source code in trajectopy\core\settings.py
@staticmethod
def decoder(name: str, value: Any) -> Any:
    """Decodes method string to enum.

    Args:
        name: Attribute name
        value: Value to decode

    Returns:
        Any: Decoded value
    """
    return MatchingMethod(value) if name == "method" else value

PlotSettings dataclass

PlotSettings(
    ate_unit_is_mm: bool = False,
    directed_ate: bool = False,
    ate_remove_above: float = 0.0,
    hist_percentile: float = 1.0,
    colorbar_max_std: float = 3.0,
    smoothing_window: int = 1,
    use_relative_timestamps: bool = False,
    line_width: float = 5,
    marker_size: float = 5.0,
    font_size: int = 10,
    export_format: str = "png",
    export_width: int = 1600,
    use_opengl: bool = True,
)

Bases: Settings

Configuration of all plots (GUI and :mod:trajectopy.visualization).

The along-track direction is positive in travel direction, horizontal cross-track is positive to the right, and vertical cross-track is positive upwards.

Attributes:

  • ate_unit_is_mm (bool) –

    Show position deviations in millimeters instead of meters. Defaults to False.

  • directed_ate (bool) –

    Show position deviations split into along-track, horizontal cross-track and vertical cross-track instead of x, y and z. Defaults to False.

  • ate_remove_above (float) –

    Exclude position deviations above this value in meters (0.0 = keep all). Defaults to 0.0.

  • hist_percentile (float) –

    Show histogram data up to this percentile of the absolute values. Defaults to 1.0.

  • colorbar_max_std (float) –

    Clip color-coded values to mean ± this many standard deviations, so that outliers don't dominate the color scale (0.0 = no clipping). Defaults to 3.0.

  • smoothing_window (int) –

    Moving-average window applied to color-coded values (1 = no smoothing). Defaults to 1.

  • use_relative_timestamps (bool) –

    Show time axes in seconds relative to the first timestamp instead of absolute (UTC) time. Defaults to False.

  • line_width (float) –

    Line width in pixels. Defaults to 1.5.

  • marker_size (float) –

    Marker size in pixels of color-coded trajectory maps. Defaults to 4.

  • font_size (int) –

    Font size in points of axis labels and titles. Defaults to 10.

  • export_format (str) –

    File format for exported plots ("png", "jpg" or "svg"). Defaults to "png".

  • export_width (int) –

    Width in pixels of exported raster images. Defaults to 1600.

  • use_opengl (bool) –

    Draw plot windows with OpenGL, which keeps panning and zooming fluid for large data sets. Falls back to software rendering if OpenGL is not available. Exports are not affected. Defaults to True.

unit_multiplier property

unit_multiplier: float

Factor converting meters to the display unit.

unit property

unit: str

Display unit of position deviations.

SortingSettings dataclass

SortingSettings(
    voxel_size: float = 0.05,
    movement_threshold: float = 0.005,
    k_nearest: int = 4,
)

Bases: Settings

Configuration for trajectory sorting and downsampling using Moving Least Squares.

Attributes:

  • voxel_size (float) –

    Size of voxel grid for downsampling (meters). Voxel centroids are used for nearest neighbor searches instead of raw points. Defaults to 0.05.

  • movement_threshold (float) –

    Maximum allowed point movement between MLS iterations (meters). Algorithm terminates when all points move less than this. Defaults to 0.005.

  • k_nearest (int) –

    Number of nearest voxels to consider during MLS smoothing. Defaults to 4.

ProcessingSettings dataclass

Bases: Settings

Complete configuration for trajectory processing.

Combines all processing-related settings including alignment, matching, relative comparison, approximation, and sorting.

Attributes: