msGeom

The DataPreprocessor class

class msGeom.data_preprocessor.DataPreprocessor(config_path)[source]

Bases: object

Class for loading configuration and Excel data, resampling, and preprocessing sensor data.

compute_positions(df, config)[source]

Convert GPS coordinates to local Cartesian positions using projection configuration.

Parameters:
  • df (pd.DataFrame) – DataFrame with ‘lat’ and ‘lng’ columns.

  • config (dict) – Configuration dictionary containing ‘Location’ section with projection params.

Returns:

Tuple of GPS position array, final GPS position and a DataFrame with valid GPS entries.

Return type:

tuple[pd.DataFrame, np.ndarray, np.ndarray]

Raises:

KeyError – If required projection parameters are missing in config[‘Location’].

load_config()[source]

Load YAML configuration file from the specified path.

Parameters:

config_path (str) – Path to the YAML configuration file.

Returns:

Dictionary containing configuration data.

Return type:

dict

load_data(file_path)[source]

Load Excel data from the specified path.

Parameters:

file_path (str) – Path to the Excel file.

Returns:

DataFrame containing raw data.

Return type:

pd.DataFrame

preprocess_data(df)[source]

Process the DataFrame to extract sensor arrays and timing information.

Parameters:

df (pd.DataFrame) – Preprocessed DataFrame containing IMU and time data.

Returns:

Tuple containing: - time (np.ndarray): Time vector in seconds. - sample_rate (float): Sampling frequency in Hz. - gyr (np.ndarray): Gyroscope data (Nx3) in rad/s. - acc (np.ndarray): Accelerometer data (Nx3) in m/s². - mag (np.ndarray): Magnetometer data (Nx3) in µT.

Return type:

tuple[np.ndarray, float, np.ndarray, np.ndarray, np.ndarray]

resample_to_40hz(df, time_col='_time', freq_hz=40, gap_threshold_ms=200)[source]

Resample data to the target frequency handling session gaps. This method detects session gaps larger than gap_threshold_ms and resamples each session individually.

Parameters:
  • df (pd.DataFrame) – Raw DataFrame.

  • time_col (str) – Name of the time column.

  • freq_hz (int) – Target frequency in Hz.

  • gap_threshold_ms (int) – Gap threshold to split sessions.

Returns:

Interpolated DataFrame.

Return type:

pd.DataFrame

The IMUProcessor class

class msGeom.imu_processor.IMUProcessor(sample_rate, sample_period)[source]

Bases: object

Class for processing IMU data from gyroscope, accelerometer, and magnetometer sensors.

Provides methods for: - Estimating the gravity vector - Detecting motion and stationary periods - Estimating position using sensor fusion algorithms (Madgwick or Mahony) - Applying ZUPT/ZUPH corrections to reduce drift

detect_no_rotation(gyr, threshold=0.05, duration_samples=5)[source]

Detect periods where there is negligible angular velocity on Z-axis (i.e., no yaw rotation).

Parameters:
  • gyr (np.ndarray) – Gyroscope data array of shape (N, 3), in rad/s.

  • threshold (float) – Threshold for Z-axis angular velocity (in rad/s) to define no rotation.

  • duration_samples (int) – Minimum number of consecutive samples below the threshold to validate no rotation.

Returns:

Boolean array of shape (N,), where True indicates no rotation around the Z-axis.

Return type:

np.ndarray

detect_stationary(acc, sample_rate)[source]

Detect stationary periods from accelerometer data using filtering and thresholding.

Parameters:
  • acc (np.ndarray) – Acceleration data array with shape (N, 3).

  • sample_rate (float) – Sampling rate of the accelerometer signal in Hz.

Returns:

A tuple containing stationary: Boolean array indicating stationary (True) or moving (False) states.

Return type:

tuple[np.ndarray]

Raises:

ValueError – If input shape is invalid or sample_rate is non-positive.

estimate_gravity_vector(acc, alpha=0.9)[source]

Estimate normalized gravity vector from accelerometer data using exponential moving average.

Parameters:
  • acc (np.ndarray) – Acceleration data array with shape (N, 3).

  • alpha (float) – Smoothing coefficient (0 < alpha < 1).

Returns:

Normalized gravity vectors.

Return type:

np.ndarray

Raises:

ValueError – If input shape is invalid or alpha is out of bounds.

estimate_position_generic(method, use_mag, gyr, acc, mag, time, sample_rate, stationary)[source]

Estimate the 2D position from IMU sensor data using either the Madgwick or Mahony filter.

This method computes orientation quaternions using an AHRS filter, rotates the acceleration to the earth frame, removes gravity, integrates to velocity and position, and compensates for drift during stationary periods.

Parameters:
  • method (str) – Algorithm to use (‘madgwick’ or ‘mahony’).

  • use_mag (bool) – Whether to use magnetometer data (True for MARG, False for IMU-only).

  • gyr (np.ndarray) – Gyroscope data array of shape (N, 3), in rad/s.

  • acc (np.ndarray) – Accelerometer data array of shape (N, 3), in m/s^2.

  • mag (np.ndarray) – Magnetometer data array of shape (N, 3), in arbitrary units.

  • time (np.ndarray) – Time vector of shape (N,), in seconds.

  • sample_rate (float) – Sampling frequency in Hz.

  • stationary (np.ndarray) – Boolean array of shape (N,) indicating stationary periods.

Returns:

Estimated position array of shape (N, 3).

Return type:

np.ndarray

Raises:

ValueError – If the method is not recognized.

estimate_position_madwick(time, gyr, acc, mag, stationary)[source]

Estimate orientation, linear acceleration, velocity, and position from sensor data using a Madgwick filter and zero-velocity updates.

Applies orientation estimation with adaptive gain based on motion state (ZUPH), and velocity correction during stationary periods (ZUPT).

Parameters:
  • time (np.ndarray) – Array of time stamps.

  • gyr (np.ndarray) – Gyroscope data array with shape (N, 3), in rad/s.

  • acc (np.ndarray) – Accelerometer data array with shape (N, 3), in m/s².

  • mag (np.ndarray) – Magnetometer data array with shape (N, 3), in µT.

  • stationary (np.ndarray) – Boolean array indicating stationary states (True for stationary).

Returns:

Tuple (quats, acc_earth, vel, pos) where: - quats: Quaternion orientation estimates. - acc_earth: Linear acceleration in earth frame (gravity removed). - vel: Estimated velocity with ZUPT correction. - pos: Estimated position.

Return type:

tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray]

Raises:

ValueError – If input shapes are inconsistent.

The KalmanProcessor class

class msGeom.kalman_processor.KalmanProcessor(dt, q, r)[source]

Bases: object

Implements a 2D Kalman Filter for fusing GPS and IMU (accelerometer) data to estimate position and velocity.

This class models the system state as [x, y, vx, vy] and supports both prediction using IMU acceleration and correction using GPS measurements. It’s useful for sensor fusion in pedestrian navigation or robotics.

initialize(initial_gps_pos)[source]

Initialize the filter state using the first GPS position (assumes zero initial velocity).

Parameters:

initial_gps_pos (array-like) – Initial position from GPS [x, y].

initialize_kalman(gps_pos, sample_rate)[source]

Convenience method to create and initialize a Kalman filter instance.

Parameters:
  • gps_pos (np.ndarray) – GPS position array, where the first entry is used for initialization.

  • sample_rate (float) – Sampling rate of the data (Hz).

Returns:

Initialized KalmanProcessor instance.

Return type:

KalmanProcessor

predict(acc_imu=None)[source]

Predict the next state using the motion model and optional control input (IMU acceleration).

Parameters:

acc_imu (array-like or None) – Acceleration input in earth frame [ax, ay]. If None, uses only velocity model.

run_filter_with_acc_and_gps(acc_earth, gps_pos)[source]

Run the Kalman filter using IMU acceleration and GPS measurements over time.

Parameters:
  • acc_earth (np.ndarray) – Array of 2D acceleration values (in earth frame), shape (N, 2).

  • gps_pos (np.ndarray) – Array of GPS positions, shape (N, 2).

Returns:

Array of fused position estimates, shape (N, 2).

Return type:

np.ndarray

update(measurement_gps)[source]

Update the filter state using a new GPS measurement.

Parameters:

measurement_gps (array-like) – GPS position measurement [x, y].

Returns:

Updated position estimate [x, y].

Return type:

np.ndarray

The DetectPeaks class

class msGeom.peak_detector.DetectPeaks[source]

Bases: object

Class for detecting step-related peaks in IMU signals and computing stride statistics.

analyze_step_robustness(triplets, signal_name, total_time, window_size=10.0)[source]

Evaluate the consistency of detected steps over time using a sliding window approach.

The function divides the total duration into time windows and counts the number of main peaks (representing steps) in each window, printing the result.

Parameters:
  • triplets (pd.DataFrame) – DataFrame containing detected peak triplets with a ‘peak_type’ and ‘timestamp’ column.

  • signal_name (str) – Name of the signal used (for display in output messages).

  • total_time (float) – Total duration of the signal in seconds.

  • window_size (float) – Duration of each window in seconds to count steps. Default is 10 seconds.

Returns:

None

Return type:

None

compute_stride_stats_per_minute(df_steps, pos_kalman, step_peaks, output_dir=None)[source]

Compute per-minute stride statistics based on detected step peaks and position data.

Calculates stride lengths between consecutive step peaks and aggregates step counts, mean stride length, standard deviation, and total distance covered per minute.

Parameters:
  • df_steps (pd.DataFrame) – DataFrame with time and datetime columns for each detected step.

  • pos_kalman (np.ndarray) – Array of Kalman-filtered positions with shape (N, 2) or (N, 3).

  • step_peaks (list[int]) – List of indices in df_steps indicating the main step peaks.

  • output_dir (str or None) – Optional output directory for saving results (currently unused).

Returns:

  • df_stats: Aggregated stride statistics per minute.

  • df_stride: Raw stride information per individual step.

Return type:

tuple[pd.DataFrame, pd.DataFrame]

detect_triplet_peaks(df, column, distance=10, prominence=0.5)[source]

Detects triplets of peaks (entry-secondary, main, exit-secondary) in gyroscope data.

Parameters:
  • df (pd.DataFrame) – Input DataFrame with a ‘time’ column and a gyroscope signal column.

  • column (str) – Name of the column containing gyroscope values.

  • distance (int) – Minimum horizontal distance (in samples) between peaks.

  • prominence (float) – Minimum prominence of a peak to be considered significant.

Returns:

DataFrame containing time, values, and labels (‘entry’, ‘main’, ‘exit’) of detected peaks.

Return type:

pd.DataFrame

generate_stride_and_gps_jump_table1(df_stride_raw_clean, gps_pos, gps_time, gps_jump_threshold=10.0, start_datetime=None, gps_lat=None, gps_lon=None)[source]

Generate a combined event table including GPS samples, valid strides, and detected GPS jumps.

This function merges stride events, raw GPS samples, and large GPS deviations (“jumps”) into a single DataFrame sorted by time. Optionally, latitude/longitude and datetime interpolation can be added.

Parameters:
  • df_stride_raw_clean (pandas.DataFrame) – DataFrame of detected strides with timestamps.

  • gps_pos (numpy.ndarray) – GPS positions as an array of shape (N, 2) with x, y coordinates.

  • gps_time (numpy.ndarray) – Array of GPS timestamps (in seconds).

  • gps_jump_threshold (float, optional) – Distance threshold (in meters) to detect GPS jumps. Default is 10.0.

  • start_datetime (str or pandas.Timestamp, optional) – Starting datetime reference for converting gps_time to absolute timestamps.

  • gps_lat (numpy.ndarray, optional) – GPS latitude samples, aligned with gps_time.

  • gps_lon (numpy.ndarray, optional) – GPS longitude samples, aligned with gps_time.

Returns:

Combined DataFrame containing GPS samples, strides, and GPS jumps. Columns include [“type”, “time”, “x”, “y”, “delta_dist”, “source”, “lat”, “lon”, “datetime”].

Return type:

pandas.DataFrame

plot_peaks(df, signal_column, peak_df, signal_name=None)[source]

Plot a time series signal with overlaid labeled peak triplets (entry, main, exit).

This function visualizes a gyroscope or accelerometer signal along with the detected peaks classified as entry, main, or exit, using different colors for each label.

Parameters:
  • df (pd.DataFrame) – Original DataFrame containing the time series signal.

  • signal_column (str) – Name of the column containing the signal values to be plotted.

  • peak_df (pd.DataFrame) – DataFrame containing labeled peaks with columns ‘timestamp’, ‘value’, and ‘peak_type’.

  • signal_name (str or None) – Optional custom name for the signal to display in the plot title. If None, uses signal_column.

Returns:

None

Return type:

None

plot_trajectory_with_strides(pos, gps_pos, time_pos, df_stride_raw_clean, title='Trajectory with Valid Strides', traj_label='Kalman')[source]

Plot the estimated trajectory versus GPS and mark valid strides as green points.

This function displays the macroscopic comparison between an estimated trajectory (e.g., from a Kalman filter) and the GPS reference path. Additionally, it highlights the positions of valid strides by interpolating their timestamps onto the trajectory.

Parameters:
  • pos (np.ndarray) – Estimated trajectory with shape (N, 3) or (N, 2). If 3D, only X and Y are used.

  • gps_pos (np.ndarray) – GPS reference trajectory with shape (N, 2).

  • time_pos (np.ndarray) – Timestamps associated with the estimated trajectory.

  • df_stride_raw_clean (pd.DataFrame) – DataFrame containing valid strides. Must include a “time” column.

  • title (str) – Title of the plot. Default is “Trajectory with Valid Strides”.

  • traj_label (str) – Label for the estimated trajectory line. Default is “Kalman”.

Returns:

None. The function produces a matplotlib plot of the trajectory and valid stride points.

Return type:

None

The StrideProcessor class

class msGeom.stride_processor.StrideProcessor(min_stride=0.2, max_stride=2.5, window_sec=1.5)[source]

Bases: object

Processor class for filtering, validating, and analyzing stride-based gait data. It includes tools for quality checks, spatial alignment, and segment-level diagnostics.

analyze_strides(df_imu, df_gps, df_strides, stride_type='invalid')[source]

Analyze and extract data windows around multiple strides.

Parameters:
  • df_imu (pd.DataFrame) – IMU signal DataFrame.

  • df_gps (pd.DataFrame) – GPS data DataFrame.

  • df_strides (pd.DataFrame) – DataFrame with a ‘time’ column marking each stride.

  • stride_type (str) – Label assigned to the analyzed strides (e.g., ‘valid’, ‘invalid’).

Returns:

List of dictionaries, each containing stride-level analysis data.

Return type:

list[dict]

check_distance_similarity(df_stats, gps_distance, tolerance=0.15)[source]

Check whether estimated distance is consistent with GPS total distance.

Parameters:
  • df_stats (pd.DataFrame) – DataFrame with stride statistics including ‘distance_m’.

  • gps_distance (float) – Total GPS-measured distance (in meters).

  • tolerance (float) – Acceptable deviation ratio (e.g., 0.15 = ±15%).

Returns:

Updated DataFrame with a new column ‘gps_consistent’.

Return type:

pd.DataFrame

check_spatial_alignment(pos_est, pos_gps, threshold=10.0)[source]

Evaluate spatial error between estimated and GPS positions.

Parameters:
  • pos_est (np.ndarray) – Estimated positions (N, 2).

  • pos_gps (np.ndarray) – GPS positions (N, 2), matching timestamps.

  • threshold (float) – Maximum acceptable spatial error (in meters).

Returns:

Tuple of (alignment mask, percentage of aligned samples).

Return type:

tuple[np.ndarray, float]

Raises:

ValueError – If input shapes do not match.

check_stride_length_range(df_stats, min_valid=0.2, max_valid=1.5)[source]

Check whether average stride lengths fall within an expected range.

Parameters:
  • df_stats (pd.DataFrame) – DataFrame with ‘mean_stride_length’ column.

  • min_valid (float) – Minimum acceptable mean stride length (meters).

  • max_valid (float) – Maximum acceptable mean stride length (meters).

Returns:

Updated DataFrame with ‘stride_length_valid’ column.

Return type:

pd.DataFrame

check_trajectory_smoothness(df_steps, velocity_threshold=3.0)[source]

Detect abrupt velocity spikes in trajectory as potential noise indicators.

Parameters:
  • df_steps (pd.DataFrame) – DataFrame with ‘velocity_m_s’ column.

  • velocity_threshold (float) – Maximum allowed velocity change (in m/s).

Returns:

DataFrame with a ‘velocity_spike’ column indicating anomalies.

Return type:

pd.DataFrame

clean_stride_data(df_stride_raw)[source]

Filter out strides whose length falls outside the valid range.

Parameters:

df_stride_raw (pd.DataFrame) – DataFrame containing raw stride data.

Returns:

Filtered DataFrame with valid strides.

Return type:

pd.DataFrame

compute_kalman_gps_error_and_jumps(time, pos_kalman, gps_pos, threshold=7.0, min_separation=0.5)[source]

Compute Kalman-GPS error and detect GPS jumps.

Parameters:
  • time (np.ndarray) – Time vector.

  • pos_kalman (np.ndarray) – Kalman-filtered positions (Nx2 or Nx3).

  • gps_pos (np.ndarray) – GPS positions (Nx2).

  • threshold (float) – Threshold for jump detection.

  • min_separation (float) – Minimum time separation between jumps.

Returns:

Tuple (error array, list of jump indices).

Return type:

Tuple[np.ndarray, List[int]]

evaluate_quality_segments(df_stride_stats, df_steps, gps_pos, imu_pos, velocity_threshold=3.0, gps_distance=None, error_tolerance_m=10.0, min_alignment_ratio=0.95)[source]

Assess per-minute gait quality by combining multiple criteria: distance consistency, stride length, velocity smoothness, and GPS alignment.

Parameters:
  • df_stride_stats (pd.DataFrame) – Per-minute stride statistics (filtered).

  • df_steps (pd.DataFrame) – Step-level DataFrame with ‘velocity_m_s’ and ‘minute’ columns.

  • gps_pos (np.ndarray) – GPS positions (N, 2).

  • imu_pos (np.ndarray) – Estimated IMU positions (N, 2).

  • velocity_threshold (float) – Maximum velocity allowed before being marked as a spike.

  • gps_distance (float) – Total GPS distance (used to validate distance estimates).

  • error_tolerance_m (float) – Maximum allowed spatial error (in meters).

  • min_alignment_ratio (float) – Minimum proportion of aligned points per segment (0-1).

Returns:

DataFrame with an ‘all_criteria_ok’ column summarizing segment validity.

Return type:

pd.DataFrame

extract_region(df_imu, df_gps, stride_time)[source]

Extracts a time window around a given stride from IMU and GPS signals.

Parameters:
  • df_imu (pd.DataFrame) – DataFrame with IMU columns [‘time’, ‘Ax’, ‘Ay’, ‘Az’, ‘Gx’, ‘Gy’, ‘Gz’].

  • df_gps (pd.DataFrame) – DataFrame with GPS columns [‘time’, ‘lat’, ‘lng’].

  • stride_time (float) – Center time of the stride (in seconds).

Returns:

Tuple of IMU/GPS windows, geodesic distance, start and end times.

Return type:

tuple[pd.DataFrame, pd.DataFrame, float, float, float]

plot_gps_jumps(time, kalman_gps_error, jump_indices, threshold=7.0)[source]

Plot GPS jumps based on Kalman-GPS error.

Parameters:
  • time (np.ndarray) – Time vector.

  • kalman_gps_error (np.ndarray) – Error vector.

  • jump_indices (List[int]) – Indices of GPS jumps.

  • threshold (float) – Threshold line to plot.

plot_jumps_and_strides(time, kalman_gps_error, jump_times, stride_times, valid_strides, threshold=7.0)[source]

Plot Kalman-GPS error with marked GPS jumps and stride events.

Parameters:
  • time (np.ndarray) – Time vector.

  • kalman_gps_error (np.ndarray) – Kalman-GPS error values.

  • jump_times (list[float]) – List of GPS jump timestamps.

  • stride_times (dict[int, float]) – Dict mapping stride numbers to their times. e.g., {30: 39.10, 31: 40.08, …}

  • valid_strides (list[int]) – List of stride numbers considered valid.

  • threshold (float) – Threshold value for GPS error.

plot_stride_filtering(df_stride_raw, df_stride_raw_clean, min_stride=0.2, max_stride=2.5, y_max=3.0, title='Strides before and after filtering')[source]

Visualize stride lengths before and after length-based filtering.

Parameters:
  • df_stride_raw (pd.DataFrame) – Original DataFrame containing all stride lengths.

  • df_stride_raw_clean (pd.DataFrame) – Filtered DataFrame with valid strides.

  • min_stride (float) – Minimum valid stride length (meters).

  • max_stride (float) – Maximum valid stride length (meters).

  • y_max (float) – Maximum y-axis limit (not used explicitly).

  • title (str) – Plot title.

recompute_stats_per_minute(df_stride_clean)[source]

Recompute per-minute stride statistics after filtering.

Parameters:

df_stride_clean (pd.DataFrame) – DataFrame of valid strides.

Returns:

Summary DataFrame grouped by minute.

Return type:

pd.DataFrame

The ResultsProcessor class

class msGeom.result_processor.ResultsProcessor[source]

Bases: object

Class for preparing and exporting step-wise movement metrics, including position, velocity, and GPS data. Supports exporting results to Excel and computing key metrics.

export_to_excel(df, file_path)[source]

Export a DataFrame to an Excel file.

Parameters:
  • df (pd.DataFrame) – DataFrame to export.

  • file_path (str) – Path where the Excel file should be saved.

Returns:

None

Return type:

None

Raises:

Exception – If the Excel file cannot be saved.

get_output_path(filename, args)[source]

Construct full output path using provided filename and CLI arguments.

Parameters:
  • filename (str) – Name of the file to be saved.

  • args (argparse.Namespace) – Argument object containing output_dir.

Returns:

Full file path.

Return type:

str

prepare_step_dataframe(time, gps_lat, gps_lng, pos_kalman, vel, df_inter)[source]

Generate a DataFrame with step-wise position, velocity, and GPS data.

Parameters:
  • time (np.ndarray) – Time vector in seconds.

  • gps_lat (np.ndarray) – GPS latitude array.

  • gps_lng (np.ndarray) – GPS longitude array.

  • pos_kalman (np.ndarray) – Kalman-filtered position array (N, 2+).

  • vel (np.ndarray) – Velocity array (N, 3).

Returns:

DataFrame with time, position, velocity, and step distance.

Return type:

pd.DataFrame

print_metrics(name, traj, gps_final)[source]

Print final error and total distance of a given trajectory compared to GPS final point.

Parameters:
  • name (str) – Name/label of the trajectory method.

  • traj (np.ndarray) – Estimated position trajectory (N, 2 or 3).

  • gps_final (np.ndarray) – Final reference GPS coordinate [x, y].

Returns:

None

Return type:

None

The PlotProcessor class

class msGeom.plot_processor.PlotProcessor[source]

Bases: object

Class for visualizing trajectories using Matplotlib, Plotly, and Folium.

This class provides a variety of plotting methods to compare estimated trajectories with ground truth GPS data, display diagnostic plots, and export results to interactive maps or static images.

generate_map_with_estimates(df_gps, results, output_html_path, config)[source]

Generates an interactive map with GPS and estimated IMU/Kalman trajectories using Folium.

Parameters:
  • df_gps (pd.DataFrame) – DataFrame with ‘lat’ and ‘lng’ columns.

  • results (dict[str, np.ndarray]) – Dictionary of trajectory name to estimated XY positions.

  • output_html_path (str) – Path to save HTML map.

  • config (dict) – YAML configuration with ‘Location’ projection info.

plot_macroscopic_comparison(pos, gps_pos=None, output_dir=None, title='Trajectory Comparison', base_name='trajectory', traj_label=None)[source]

Plot diagnostic and trajectory figures for IMU data, and optionally save them.

This function generates several plots based on filtered acceleration, position, velocity, 2D and 3D trajectory. If GPS data is provided, it includes a comparative plot. Depending on the verbosity level and output directory, plots can also be saved.

Parameters:
  • pos (np.ndarray) – Estimated position array of shape (N, 3).

  • gps_pos (np.ndarray or None) – Optional GPS position array of shape (N, 2). Defaults to None.

  • title (str) – Title used in trajectory comparison plots.

plot_resume(time, pos, vel, output_dir=None, base_name='summary')[source]

Plot position, velocity, and 3D trajectory of the estimated movement.

This function summarizes motion-related variables: 1D time series of position and velocity (in x, y, z), and a 3D trajectory plot in space.

Parameters:
  • time (np.ndarray) – Time vector in seconds.

  • pos (np.ndarray) – Estimated position array of shape (N, 3).

  • vel (np.ndarray) – Estimated velocity array of shape (N, 3).

  • output_dir (str or None) – (Not used anymore; figures are not saved).

  • base_name (str) – (Unused). Name that would be used for saving if enabled.

plot_trajectories(results, errors, gps_pos, gps_final, title='Trajectory Comparison', save_path=None)[source]

Plot estimated and GPS trajectories.

Parameters:
  • results (dict[str, np.ndarray]) – Dictionary of estimated positions.

  • errors (dict[str, float]) – Dictionary of position errors.

  • gps_pos (np.ndarray) – GPS positions array.

  • gps_final (np.ndarray) – Final GPS position.

  • title (str) – Title for the plot.

  • save_path (str or None) – If given, path to save the plot image.

plot_trajectories_all(all_results, gps_pos, gps_final, title='Trajectory Comparison')[source]

Plot all estimated trajectories together using Matplotlib.

Parameters:
  • all_results (dict[str, tuple[np.ndarray, float]]) – Dictionary with keys as method names and values as (positions, error).

  • gps_pos (np.ndarray) – GPS positions array.

  • gps_final (np.ndarray) – Final GPS position.

  • title (str) – Plot title.

plot_trajectories_interactive(results, errors, gps_pos, gps_final, title='Trajectory Comparison', save_path=None)[source]

Create an interactive Plotly plot comparing estimated and GPS trajectories.

Parameters:
  • results (dict[str, np.ndarray]) – Dictionary of estimated positions.

  • errors (dict[str, float]) – Dictionary of position errors.

  • gps_pos (np.ndarray) – GPS positions array.

  • gps_final (np.ndarray) – Final GPS position.

  • title (str) – Plot title.

  • save_path (str or None) – Optional path to save the HTML plot.

plot_trajectories_split(results, errors, gps_pos, gps_final, title, save_path=None)[source]

Plot each estimated trajectory separately using Matplotlib.

Parameters:
  • results (dict[str, np.ndarray]) – Dictionary of estimated positions.

  • errors (dict[str, float]) – Dictionary of errors per method.

  • gps_pos (np.ndarray) – GPS positions array.

  • gps_final (np.ndarray) – Final GPS point.

  • title (str) – Plot title.

  • save_path (str or None) – Optional path to save plot.