vista.sensor_platforms.sensor_platform.SensorPlatform¶
- class vista.sensor_platforms.sensor_platform.SensorPlatform(name=None, positions=None, times_positions=None, pointings=None, times_pointings=None)[source]¶
Class 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)
- __init__(name=None, positions=None, times_positions=None, pointings=None, times_pointings=None)¶
Methods
__init__([name, positions, times_positions, ...])append(positions, t_positions, pointings, ...)Append new times, positions, and pointings to the sensor platform.
get_pointings(times)Return sensor pointings in Cartesian ECEF coordinates for the given times via interpolation/extrapolation.
get_positions(times)Return sensor positions in Cartesian ECEF coordinates for the given times via interpolation/extrapolation.
to_hdf5(group)Save sensor platform position and pointing data to an HDF5 group.
Attributes
- 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)¶