Sensor Platforms Module¶
Sensor platforms hold time-sampled ECEF position and pointing data shared by one or more sensors.
Core Classes¶
Class containing sensor platform position and pointing information. |
Position and pointing samples use independent timestamp arrays. Positions are stored in ECEF kilometers with shape
(3, N). Pointings are ECEF unit vectors with shape (3, M). Queries between samples are linearly interpolated;
queries outside the sampled range are linearly extrapolated.
Basic Usage¶
import numpy as np
from vista.sensor_platforms import SensorPlatform
from vista.sensors import Sensor
platform = SensorPlatform(
name="My Platform",
positions=np.array([[6378.0], [0.0], [10.0]]),
times_positions=np.array(["2026-01-01T00:00:00"], dtype="datetime64[ns]"),
pointings=np.array([[-1.0], [0.0], [0.0]]),
times_pointings=np.array(["2026-01-01T00:00:00"], dtype="datetime64[ns]"),
)
fav_sensor = Sensor(name="My Favorite Sensor", platform=platform)
sensor = Sensor(name="My Sensor", platform=platform)
Module Reference¶
Sensor platform containing position and pointing information.
This module defines the SensorPlatform class which provides a framework for representing sensor platforms and their characteristics. Sensor platforms support position and pointing retrieval via interpolation/extrapolation from discrete samples.
- class vista.sensor_platforms.sensor_platform.SensorPlatform(name=None, positions=None, times_positions=None, pointings=None, times_pointings=None)[source]¶
Bases:
objectClass containing sensor platform position and pointing information.
SensorPlatform stores discrete position and pointing samples at known times and provides estimates at arbitrary times through interpolation (within the time range) or extrapolation (outside the time range).
- positions¶
Sensor positions as (3, N) array where N is the number of samples. Each column contains [x, y, z] ECEF coordinates in kilometers.
- Type:
NDArray[np.float64]
- times_positions¶
Times corresponding to each position sample. Must have length N.
- Type:
NDArray[np.datetime64]
- pointings¶
Sensor pointing unit vectors in ECEF coordinates. Shape: (3, M). Each column is the direction the sensor is pointing for that time.
- Type:
NDArray[np.float64], optional
- times_pointings¶
Times corresponding to each pointing sample. Must have length M.
- Type:
NDArray[np.datetime64]
- Internal Attributes
- -------------------
Notes
All positions and pointings are in Earth-Centered Earth-Fixed (ECEF) Cartesian coordinates with units of kilometers
Positions and pointings are represented as (3, N) arrays with x, y, z in each column
Duplicate times and corresponding positions/pointings are automatically removed
For 1 sample: returns the same value for all query times
For 2+ unique samples: uses linear interpolation within range, linear extrapolation outside
Examples
>>> import numpy as np >>> # Create sensor platform with multiple position samples >>> positions = np.array([[1000, 1100, 1200], ... [2000, 2100, 2200], ... [3000, 3100, 3200]]) # (3, 3) array >>> times = np.array(['2024-01-01T00:00:00', ... '2024-01-01T00:01:00', ... '2024-01-01T00:02:00'], dtype='datetime64') >>> platform = SensorPlatform(positions=positions, times_positions=times)
>>> # Get interpolated position >>> query_times = np.array(['2024-01-01T00:00:30'], dtype='datetime64') >>> pos = platform.get_positions(query_times) >>> pos.shape (3, 1)
>>> # Create stationary platform with single position >>> positions_static = np.array([[1000], [2000], [3000]]) # (3, 1) array >>> times_static = np.array(['2024-01-01T00:00:00'], dtype='datetime64') >>> platform_static = SensorPlatform(positions=positions_static, times_positions=times_static) >>> # Returns same position for any query time >>> pos = platform_static.get_positions(query_times)
- times_positions: NDArray[datetime64] | None = None¶
- times_pointings: NDArray[datetime64] | None = None¶
- __post_init__()[source]¶
Validate inputs and remove duplicate times.
Ensures times, positions, and pointings have compatible shapes and removes any duplicate time entries along with their corresponding positions and pointings.
- Raises:
ValueError – If positions or pointings have incompatible shapes with their times.
- append(positions, t_positions, pointings, t_pointings)[source]¶
Append new times, positions, and pointings to the sensor platform. Must be compatible with existing data. After appending, duplicate times are removed and arrays are sorted in order of increasing time.
- Parameters:
positions (NDArray[np.float64]) – New position samples corresponding to the new times. Must be (3, N) array.
t_positions (NDArray[np.datetime64]) – New time sample(s) to append. Must have length N.
pointings (NDArray[np.float64]) – New pointing samples corresponding to the new times. Must be (3, M) array.
t_pointings (NDArray[np.datetime64]) – New time sample(s) to append. Must have length M.
- get_positions(times)[source]¶
Return sensor positions in Cartesian ECEF coordinates for the given times via interpolation/extrapolation.
- Parameters:
times (NDArray[np.datetime64]) – Array of times for which to retrieve sensor positions
- Returns:
Sensor positions as (3, N) array where N is the number of query times. Each column contains [x, y, z] coordinates in ECEF frame (km). None if no positions available.
- Return type:
NDArray[np.float64], None
Notes
For sensors with 1 sample: returns the single position for all times
For sensors with 2+ samples: uses linear interpolation within the time range and linear extrapolation outside the range
- get_pointings(times)[source]¶
Return sensor pointings in Cartesian ECEF coordinates for the given times via interpolation/extrapolation.
- Parameters:
times (NDArray[np.datetime64]) – Array of times for which to retrieve sensor pointings
- Returns:
Sensor pointings as (3, N) array where N is the number of query times. Each column contains [x, y, z] pointings in ECEF frame (km). None if no pointings available.
- Return type:
NDArray[np.float64], None
Notes
For sensors with 1 sample: returns the single pointing for all times
For sensors with 2+ samples: uses linear interpolation within the time range and linear extrapolation outside the range
- to_hdf5(group)[source]¶
Save sensor platform position and pointing data to an HDF5 group.
- Parameters:
group (h5py.Group) – HDF5 group to write sensor platform data to (typically sensor_platforms/<sensor_platform_uuid>/)
Notes
This method writes position and pointing data to the HDF5 group: - positions and times_positions - pointings and times_pointings
Subclasses should call super().to_hdf5(group) and then add their own data.
- __init__(name=None, positions=None, times_positions=None, pointings=None, times_pointings=None)¶