AngularIdeal#

class AngularIdeal(name: str, observer: Body, sigma: ArrayWUnits = None, meas_bias=None, state_definition=None, sequence_definition=None)#

Bases: Measurement

Models the ideal angular measurement model.

Generates angular observables (right ascension and declination) between an observer and a target, expressed in radians.

Given the line-of-sight unit vector \(\hat{\boldsymbol{\ell}} = (\ell_x, \ell_y, \ell_z)\), the observables are

\[\alpha = \mathrm{atan2}(\ell_y,\,\ell_x), \qquad \delta = \arcsin(\ell_z)\]

No light-time or atmospheric refraction effects are modelled.

Parameters:
  • name (str) – Name of the measurement model.

  • observer (Body) – Body object from scarabaeus. This is the “observer” in the angular measurement.

  • sigma (ArrayWUnits, optional) – Measurement standard deviation. Defaults to None.

  • meas_bias (float, optional) – Angular bias. Defaults to None.

  • state_definition (list, optional) – StateVector definition list. Defaults to None.

  • sequence_definition (list, optional) – Sequence definition list. Defaults to None.

Raises:
  • RuntimeError – If the units extracted from the measurements are not consistent.

  • RuntimeError – If neither an EpochArray nor start/end Epochs are provided.

See also

scarabaeus.Measurement

Abstract base class for all measurement models.

Examples

import numpy as np

import scarabaeus as scb

...

# Initialize the body object for the orbiter
Orbiter_mass = scb.ArrayWUnits(1200.0, kg)
Orbiter_area = scb.ArrayWUnits(1.2e-05, km**2)
Orbiter_cr_srp = scb.ArrayWUnits(0, None)
Orbiter = scb.Spacecraft(
    "Orbiter",
    -64,
    Orbiter_mass,
    Orbiter_area,
    Orbiter_cr_srp,
)

frame = ECLIPJ2000

# (1) Initialize Beacon Bodies
earth_beacon = scb.Body("Earth", spice_id=399)

# (2) Initialize Measurement Model
celnav_beacon_ideal = scb.AngularIdeal(
    "CelNav Beacon Model",
    Orbiter,
)

# define measurement epochs
start_epoch = 1000000000.0
stop_epoch = start_epoch + 1 * 86400
measurement_epochs = scb.EpochArray(np.linspace(start_epoch, stop_epoch, 100))

# take measurements of Earth beacon from orbiter
meas = celnav_beacon_ideal.computed_measurements(
    earth_beacon, epoch_array=measurement_epochs, frame=frame
)
_partials = celnav_beacon_ideal.compute_partials(earth_beacon, measurement_epochs, frame)
celnav_beacon_ideal.write_observed_measurements(
    target=earth_beacon,
    epoch_array=measurement_epochs,
    frame=frame,
    noisy=False,
    file_name="earth_beacon",
)
Attributes:
instrument

The instrument.

name

The name of the model.

sigma

Measurement noise standard deviation.

Methods

compute_partials(target, epoch_array, frame)

Stacks together measurement _partials for an epoch array at different epochs.

computed_measurements(target, epoch_array, ...)

Compute the angular measurement between an observer and a target.

generate_measurement_dataset(dataset_name, ...)

Generates a MeasurementDataSet object that can be used by filters downstream.

observed_measurements(file_name, meas_name)

Load angular measurements from a .json file.

residuals(observed_meas, computed_meas)

Generates the measurement model's residuals given observed and computed ArrayWFrames.

set_image_epochs(image_epochs)

Enable per-image angular biases.

set_image_index(mapping)

Directly assign a pre-built {epoch_value: image_index} mapping (or None to disable).

update_reference_state(state_vector)

Call this once per iteration (before generate_measurement_dataset). The model will pull: - meas_bias_ideal_* (as ArrayWUnits) - gs_delta_location_ECEF_* (as ArrayWFrame) for this instrument (matching spice_id).

write_observed_measurements(target, ...)

Generates synthetic measurements and write them as a .json file.

compute_partials(target: Spacecraft, epoch_array: EpochArray, frame: Frame = J2000 (0 - SOLAR SYSTEM BARYCENTER)) list#

Stacks together measurement _partials for an epoch array at different epochs.

Parameters:
  • target (Spacecraft) – The target spacecraft.

  • epoch_array (EpochArray) – The epochs.

  • frame (Frame, optional) – The reference frame. Defaults to a J2000 Frame object.

Returns:

_partials – A list with all the _partials evaluated at different epochs in the epoch_array.

Return type:

list

computed_measurements(target: Body, epoch_array: EpochArray = None, epoch_start: EpochArray = None, epoch_end: EpochArray = None, tstep: float = 1, frame: Frame = J2000 (0 - SOLAR SYSTEM BARYCENTER), noisy: bool = False, image_epochs: list | None = None) ArrayWFrame#

Compute the angular measurement between an observer and a target.

This function calculates the angular measurement (right ascension/declination) from the observer to a specified target body, taking into account optional parameters like specific epochs, time steps, reference frame, and noise settings.

Parameters:
  • target (Body) – The target spacecraft for which the angular measurement is to be computed.

  • epoch_array (EpochArray) – An array of epochs (times) at which the angular measurements should be computed. If provided, it overrides epoch_start, epoch_end, and tstep.

  • epoch_start (Epoch) – The starting epoch for the angular measurement computations. Required if epoch_array is not provided.

  • epoch_end (Epoch) – The ending epoch for the angular measurement computations. Required if epoch_array is not provided.

  • tstep (float) – The time step, in seconds, between consecutive angular measurements. If epoch_array is not provided. Defaults to 1 second.

  • frame (Frame) – The reference frame in which the angular computation is performed.

  • noisy (bool) – Whether to add noise to the computed angular measurement. Defaults to False.

  • image_epochs (list[float], optional) – Ordered list of observation epoch values (one per image). Must be provided when the state vector contains a stacked angular_bias_<suffix> entry.

Returns:

The computed angular measurement as an array with frames.

Return type:

ArrayWFrame

generate_measurement_dataset(dataset_name: str, target: Body, observed_meas: tuple | list | None = None, epochs: EpochArray | None = None, frame: Frame = J2000 (0 - SOLAR SYSTEM BARYCENTER), noisy: bool = False) list[MeasurementDataSet]#

Generates a MeasurementDataSet object that can be used by filters downstream.

Parameters:
  • dataset_name (str) – The name of the MeasurementDataSet.

  • target (Spacecraft) – The target spacecraft.

  • epoch_list (EpochArray, optional) – The epochs. Defaults to None.

  • epoch_start (EpochArray, optional) – The starting epoch. Defaults to None.

  • epoch_end (EpochArray, optional) – The end epoch. Defaults to None.

  • tstep (int, optional) – The integration timestep. Defaults to 1.

  • observed_measurements (list, optional) – The observed measurements. Defaults to None.

  • frame (Frame, optional) – The reference frame. Defaults to a J2000 Frame object.

  • noisy (bool, optional) – Indicates if noise is added to the measurements or not. Defaults to False.

Returns:

mds_list – A list of MeasurementDataSet objects representing the measurements with their key properties to be used by a filter.

Return type:

list[MeasurementDataSet]

:raises If the observed_meas list is only made by 3 elements`, it throws an error because it needs the 4th element in the list for the indices of :py:class:`the outlier_flag:

Notes

The MeasurementDataSet output is generated in 6 steps:

  1. Computed measurements

  2. Partials

  3. Residuals

  4. Sigmas

  5. Outlier flag

  6. Pack everything in a list

  7. Pack the list in a MeasurementDataSet object

observed_measurements(file_name, meas_name: str = 'meas_ideal', units=None, frame: Frame = J2000 (0 - SOLAR SYSTEM BARYCENTER), image_epochs: list | None = None)#

Load angular measurements from a .json file.

image_epochslist[float], optional

Ordered list of observation epoch values, one per image. Must be provided when the state vector contains a stacked angular_bias_<suffix> entry (dim > 2).

residuals(observed_meas: ArrayWFrame, computed_meas: ArrayWFrame) ArrayWFrame#

Generates the measurement model’s residuals given observed and computed ArrayWFrames.

Parameters:
  • observed_meas (ArrayWFrame) – The observed measurements values (O).

  • computed_meas (ArrayWFrame) – The computed measurements values (C).

Returns:

residuals – AWF with the residual O-C.

Return type:

ArrayWFrame

set_image_epochs(image_epochs: list | None)#

Enable per-image angular biases.

Parameters:

image_epochs (list[float] | None) – Ordered list of observation epoch values, one per image. Image index equals the position in the list. Pass None to revert to global-bias mode.

set_image_index(mapping: dict | None)#

Directly assign a pre-built {epoch_value: image_index} mapping (or None to disable).

update_reference_state(state_vector: StateArray)#

Call this once per iteration (before generate_measurement_dataset). The model will pull:

  • meas_bias_ideal_* (as ArrayWUnits)

  • gs_delta_location_ECEF_* (as ArrayWFrame)

for this instrument (matching spice_id).

write_observed_measurements(target: Spacecraft, epoch_array: EpochArray = None, epoch_start: EpochArray = None, epoch_end: EpochArray = None, tstep: float = 1, frame: Frame = J2000 (0 - SOLAR SYSTEM BARYCENTER), noisy: bool = False, file_name: str = 'ideal_measurement', check_visibility: bool = False, elevation_mask: float = 10.0, folder_path_override: str = None) None#

Generates synthetic measurements and write them as a .json file. The input of this method encapsulate the ones needed for the “computed_meas” method in each measurement model class.

Parameters:
  • target (Spacecraft) – The target spacecraft for which the range measurement is to be computed.

  • epoch_array (EpochArray, optional) – An array of epochs (times) at which the range measurements should be computed. If provided, overrides epoch_start, epoch_end, and tstep.

  • epoch_start (EpochArray, optional) – The starting epoch for the range measurement computations. Required if epoch_array is not provided.

  • epoch_end (EpochArray, optional) – The ending epoch for the range measurement computations. Required if epoch_array is not provided.

  • tstep (float, optional) – The time step, in seconds, between consecutive range measurements. If epoch_array is not provided. Defaults to 1 second.

  • frame (Frame , optional) – The reference frame in which the range computation is performed. Defaults to None.

  • noisy (bool , optional) – Whether to add noise to the computed range measurement. Defaults to False.

  • file_name (str, optional) – The filename of the JSON in which the measurement is saved, Defaults to 'ideal_measurement'.

  • check_visibility (bool, optional) – When True, epochs where the instrument cannot observe the target are removed before generating measurements. The specific check is instrument-dependent: GroundStation uses an elevation-angle test; Camera uses a FOV projection test. Defaults to False.

  • elevation_mask (float, optional) – Minimum elevation angle in degrees used by the GroundStation visibility check. Ignored for Camera instruments. Only relevant when check_visibility=True. Defaults to 10.0.

  • folder_path_override (str, optional) – If provided, the JSON file is saved directly to this path instead of the default data/measurements/radiometric or data/measurements/optical folder. The directory is created automatically if it does not exist. Defaults to None.

Return type:

None

property instrument: Instrument#

The instrument.

property name: str#

The name of the model.

property sigma: ArrayWUnits#

Measurement noise standard deviation.