landmarks

SUM/LMK tracking-data loading for SPC optical landmark observations.

This submodule contains functionality to load optical landmark observations from SUM and LMK files, as written by the stereophotoclinometry (SPC) software (see Gaskell et al., 2008). Each SUM file describes one image, with its epoch, camera calibration and pointing, and the pixel coordinates of the landmarks seen in it. Each LMK file describes one landmark and its position on the target body. These files can be converted to pixel-coordinate tracking data, and to supplementary data that adds the landmarks as ground stations on the target body, and the cameras, with the calibration and pointing of each image, on the receiver body. The read_sum_lmk_data() function is the main interface for loading the data and converting it to objects that Tudat can process further; see also tracking_data. All other functionality in this module is reserved for better understanding what data is being loaded, and in some cases manipulating it, before it is processed into Tudat-compatible objects.

read_sum_lmk_data(sum_files_per_camera: dict[str, list[str]], lmk_files: list[str], target_body_name: str, receiver_body_name: str, skip_observations_with_missing_landmarks: bool = False, validate_spacecraft_object_geometry: bool = True) → tuple[list[tudatpy.kernel.data_input.tracking_data.TrackingData], list[tudatpy.kernel.data_input.tracking_data.TrackingSupplementaryData]]

Read SUM and LMK files and convert them to tracking-data containers.

SUM and LMK files are written by the stereophotoclinometry (SPC) software. Each SUM file describes one image: its epoch, camera calibration and pointing, and the pixel coordinates of the landmarks seen in it. Each LMK file describes one landmark: its position on the target body.

Every (image, landmark) pair becomes one pixel-coordinate observation, sent by the landmark and received by the camera that took the image. Each image and each landmark may be provided only once; a repeated image or landmark ID raises an error. The images of one camera must have distinct epochs. The supplementary data adds each landmark as a ground station on the target body, and each camera on the receiver body, with the ID, calibration and pointing of each of its images. The pointing of each image can be estimated with camera_pointing_correction(). The SUM SIGMA_PTG values are stored as the camera’s pointing_uncertainty_history.

The SUM pixel coordinates are used as they are. Correct them for lens distortion before estimation, since the pixel-coordinate observable does not model it.

Apply the supplementary data with set_tracking_supplementary_data_in_bodies() before creating observations with create_observation_collection_from_tracking_data().

Parameters:
  • sum_files_per_camera (dict[str, list[str]]) – Paths to the SUM files, by the name of the camera that took the images.

  • lmk_files (list[str]) – Paths to the LMK files.

  • target_body_name (str) – Name of the body the landmarks are on.

  • receiver_body_name (str) – Name of the body that carries the cameras.

  • skip_observations_with_missing_landmarks (bool, default=False) – If True, measurements of landmarks without an LMK file are skipped. If False, they raise an error.

  • validate_spacecraft_object_geometry (bool, default=True) – If True, check that every measured landmark lies in front of the camera, using the spacecraft position stored in the SUM file.

Returns:

Tracking data objects and supplementary data objects.

Return type:

tuple[list[TrackingData], list[TrackingSupplementaryData]]

Supporting API

The functions and classes below expose the contents of SUM and LMK files in dedicated containers. They are used internally by read_sum_lmk_data() and can be used to inspect the files, or to convert the same files several times with convert_raw_sum_lmk_data().

read_raw_sum_files(sum_files: list[str]) → list[tudatpy.kernel.data_input.tracking_data.landmarks.SumImageData]

Read SUM files without converting them to tracking data.

This is a supporting reader for inspecting raw SUM contents, or for converting the same files several times with convert_raw_sum_lmk_data(). In the typical Tudat workflow, call read_sum_lmk_data() instead.

Parameters:

sum_files (list[str]) – Paths to the SUM files.

Returns:

Raw contents of each image.

Return type:

list[SumImageData]

read_raw_lmk_files(lmk_files: list[str]) → dict[str, tudatpy.kernel.data_input.tracking_data.landmarks.LmkLandmarkData]

Read LMK files without converting them to tracking data.

This is a supporting reader for inspecting raw LMK contents, or for converting the same files several times with convert_raw_sum_lmk_data(). In the typical Tudat workflow, call read_sum_lmk_data() instead.

Parameters:

lmk_files (list[str]) – Paths to the LMK files.

Returns:

Raw contents of each landmark, by landmark ID.

Return type:

dict[str, LmkLandmarkData]

convert_raw_sum_lmk_data(sum_images_per_camera: dict[str, list[tudatpy.kernel.data_input.tracking_data.landmarks.SumImageData]], landmarks: dict[str, tudatpy.kernel.data_input.tracking_data.landmarks.LmkLandmarkData], target_body_name: str, receiver_body_name: str, skip_observations_with_missing_landmarks: bool = False, validate_spacecraft_object_geometry: bool = True) → tuple[list[tudatpy.kernel.data_input.tracking_data.TrackingData], list[tudatpy.kernel.data_input.tracking_data.TrackingSupplementaryData]]

Convert raw SUM/LMK contents to tracking-data containers.

Same as read_sum_lmk_data(), but starts from contents read with read_raw_sum_files() and read_raw_lmk_files().

Parameters:
  • sum_images_per_camera (dict[str, list[SumImageData]]) – Raw image contents, by the name of the camera that took them.

  • landmarks (dict[str, LmkLandmarkData]) – Raw landmark contents, by landmark ID.

  • target_body_name (str) – Name of the body the landmarks are on.

  • receiver_body_name (str) – Name of the body that carries the cameras.

  • skip_observations_with_missing_landmarks (bool, default=False) – If True, measurements of landmarks without an LMK file are skipped. If False, they raise an error.

  • validate_spacecraft_object_geometry (bool, default=True) – If True, check that every measured landmark lies in front of the camera, using the spacecraft position stored in the SUM file.

Returns:

Tracking data objects and supplementary data objects.

Return type:

tuple[list[TrackingData], list[TrackingSupplementaryData]]

class SumImageData

Bases: pybind11_object

Raw contents of one SUM file, which describes one image.

property camera_axes

read-only

Camera axes CX, CY, CZ (rows), in the target body-fixed frame; this is the rotation matrix from the target body-fixed frame to the camera frame.

property focal_length_mm

read-only

Focal length (MMFL), in mm.

property image_id

read-only

Identifier of the image.

property image_size

read-only

Number of pixels and lines of the image (NPX, NLN).

property k_matrix

read-only

K matrix (K-MATRIX), converting focal-plane coordinates in mm to (pixel, line).

property landmark_observations

read-only

Landmark measurements in the image.

property optical_center

read-only

Optical centre (CTR), in (pixel, line).

property pointing_sigma

read-only

Pointing uncertainty (SIGMA_PTG) about the camera axes, in rad; NaN if absent.

property source_file

read-only

Path of the SUM file.

property spacecraft_object_vector

read-only

Vector from the spacecraft to the target centre (SCOBJ), in the target body-fixed frame, in m.

property utc_epoch_string

read-only

Epoch of the image (UTC), as given in the file.

class SumLandmarkObservation

Bases: pybind11_object

One landmark measurement in a SUM file.

property landmark_id

read-only

Identifier of the landmark.

property pixel_coordinates

read-only

Measured (pixel, line) coordinates of the landmark in the image.

class LmkLandmarkData

Bases: pybind11_object

Raw contents of one LMK file, which describes one landmark.

property body_fixed_position

read-only

Position of the landmark in the target body-fixed frame, in m.

property landmark_id

read-only

Identifier of the landmark.

property landmark_position_sigma

read-only

Position uncertainty of the landmark (SIGMA_LMK), in m.

property source_file

read-only

Path of the LMK file.