vista.tracks.track.Track¶
- class vista.tracks.track.Track(*, times=None, frames=None, name, rows, columns, sensor, color='g', marker='o', line_width=2, marker_size=12, visible=True, tail_length=0, complete=False, show_line=True, line_style='SolidLine', labels=<factory>, label_time=None, labeler=None, tracker=None, extraction_metadata=None, covariance_00=None, covariance_01=None, covariance_11=None, show_uncertainty=False)[source]¶
Represents a single object trajectory across multiple frames.
A Track contains temporal position data for a moving object, with support for multiple coordinate systems (pixel, geodetic, time-based) and rich visualization options. Tracks can be created manually, loaded from files, or generated by tracking algorithms.
- Parameters:
- marker¶
Marker style for current position (‘o’, ‘s’, ‘t’, ‘d’, ‘+’, ‘x’, ‘star’), by default ‘o’ (circle)
- Type:
str, optional
- complete¶
If True, show entire track regardless of current frame, by default False
- Type:
bool, optional
- line_style¶
Qt line style (‘SolidLine’, ‘DashLine’, ‘DotLine’, ‘DashDotLine’, ‘DashDotDotLine’), by default ‘SolidLine’
- Type:
str, optional
- labels¶
Set of text labels for categorizing/filtering tracks, by default empty set
- extraction_metadata¶
Extraction metadata containing image chips and signal detection results. Dictionary with keys: ‘chip_size’ (int), ‘chips’ (NDArray with shape (n_points, diameter, diameter)), ‘signal_masks’ (boolean NDArray with same shape), ‘noise_stds’ (NDArray with shape (n_points,)), by default None
- Type:
dict, optional
- from_dataframe(df, sensor, name)[source]¶
Create Track from pandas DataFrame with coordinate conversion
- length()¶
Property that returns cumulative Euclidean distance along track
Notes
Track coordinates can be provided as pixel (row/col) or geodetic (lat/lon/alt)
Times can be used instead of frames if included at creation
The from_dataframe() method handles coordinate system conversions automatically
Track length is computed lazily and cached for performance
- __init__(*, times=None, frames=None, name, rows, columns, sensor, color='g', marker='o', line_width=2, marker_size=12, visible=True, tail_length=0, complete=False, show_line=True, line_style='SolidLine', labels=<factory>, label_time=None, labeler=None, tracker=None, extraction_metadata=None, covariance_00=None, covariance_01=None, covariance_11=None, show_uncertainty=False)¶
Methods
__init__(*[, times, frames, color, marker, ...])copy()Create a deep copy of this track object.
fill_times_frames(times, frames)Fill in missing times from frames, or missing frames from times, using this object's own times and frames
from_dataframe(df, sensor[, imagery, name])Create Track from pandas DataFrame with automatic coordinate conversion.
Get cached PyQtGraph brush object for marker fill, creating only if parameters changed.
Get geodetic coordinates for all track points, computing and caching if needed.
get_index(val, is_time[, nearest, in_range])Get the index of a particular value
get_pen([width, style])Get cached PyQtGraph pen object, creating only if parameters changed.
Convert covariance matrix to ellipse parameters for visualization.
Compute the geometric mean radius of uncertainty ellipses.
get_value(index, is_time)Get the value of a particular index
get_visible_indices(val, is_time)Get indices of track points that should be visible at the current value.
Check if track has uncertainty data.
Invalidate cached data structures when track data changes.
to_csv(file)Convert track to DataFrame
Attributes
framesCumulative Euclidean distance along the track path.
times- rows: NDArray[float64]¶
- columns: NDArray[float64]¶
- get_visible_indices(val, is_time)[source]¶
Get indices of track points that should be visible at the current value.
- get_geodetic_coords()[source]¶
Get geodetic coordinates for all track points, computing and caching if needed.
Projects each track point using its own frame’s sensor geometry, so the result represents the true geographic location at each time step. The result is cached so subsequent calls return immediately.
- Returns:
(longitudes, latitudes) in degrees, or None if the sensor cannot geolocate.
- Return type:
tuple[NDArray[np.float64], NDArray[np.float64]] or None
- get_pen(width=None, style=None)[source]¶
Get cached PyQtGraph pen object, creating only if parameters changed.
- get_brush()[source]¶
Get cached PyQtGraph brush object for marker fill, creating only if parameters changed.
- Returns:
PyQtGraph brush object
- Return type:
pg.mkBrush
- has_uncertainty()[source]¶
Check if track has uncertainty data.
- Returns:
True if track has all three covariance matrix elements (C00, C01, C11), False otherwise
- Return type:
- get_uncertainty_ellipse_parameters()[source]¶
Convert covariance matrix to ellipse parameters for visualization.
Computes the semi-major axis length, semi-minor axis length, and rotation angle from the 2D covariance matrix at each track point.
- Returns:
Tuple of (semi_major_axis, semi_minor_axis, rotation_degrees) arrays, or None if no uncertainty data. Rotation is in degrees, counter-clockwise from horizontal (positive column axis).
- Return type:
Optional[tuple[NDArray[np.float64], NDArray[np.float64], NDArray[np.float64]]]
- get_uncertainty_radius()[source]¶
Compute the geometric mean radius of uncertainty ellipses.
The geometric mean radius is computed as the fourth root of the covariance matrix determinant: sqrt(sqrt(det(Cov))) = sqrt(sqrt(C00*C11 - C01^2)). This represents the radius of a circle with the same area as the uncertainty ellipse.
- Returns:
Array of geometric mean radii for each track point, or None if uncertainty data is not available
- Return type:
Optional[NDArray[np.float64]]
- classmethod from_dataframe(df, sensor, imagery=None, name=None)[source]¶
Create Track from pandas DataFrame with automatic coordinate conversion.
Supports multiple input coordinate systems with automatic conversion: - Times or Frames (conversion requires Imagery with times) - Rows/Columns or Lat/Lon/Alt → Rows/Columns (Geodetic requires sensor and times)
- Parameters:
df (pd.DataFrame) – DataFrame containing track data with required columns based on coordinate system (see Notes)
sensor (Sensor) – Sensor object for coordinate conversions
imagery (Imagery, optional) – Imagery used to convert times and frames.
name (str, optional) – Track name, by default taken from df[“Track”]
- Returns:
New Track object with converted coordinates
- Return type:
- Raises:
ValueError – If required columns are missing or coordinate conversion fails
Notes
Required columns (one set from each group):
- Temporal coordinates (choose one):
“Times” : Timestamps (preferred)
“Frames” : Frame numbers
- Spatial coordinates (choose one):
“Rows” and “Columns” : Pixel coordinates (preferred)
“Latitude (deg)”, “Longitude (deg)”, “Altitude (km)” : Geodetic coordinates (requires sensor with geolocation capability)
- Optional styling columns:
“Color”, “Marker”, “Line Width”, “Marker Size”, “Visible”, “Complete”, “Show Line”, “Line Style”, “Tail Length”, “Labels”, “Tracker”
- property length¶
Cumulative Euclidean distance along the track path.
Computes the sum of pixel distances between consecutive track points. Result is cached for performance.
- Returns:
Total track length in pixels, or 0.0 if track has fewer than 2 points
- Return type:
- copy()[source]¶
Create a deep copy of this track object.
- Returns:
New Track object with copied arrays and styling attributes
- Return type:
- to_dataframe()[source]¶
Convert track to DataFrame
- Raises:
ValueError: If geolocation/time requested but imagery is missing required data
- __init__(*, times=None, frames=None, name, rows, columns, sensor, color='g', marker='o', line_width=2, marker_size=12, visible=True, tail_length=0, complete=False, show_line=True, line_style='SolidLine', labels=<factory>, label_time=None, labeler=None, tracker=None, extraction_metadata=None, covariance_00=None, covariance_01=None, covariance_11=None, show_uncertainty=False)¶