giant.calibration.estimators.CalibrationEstimator

class giant.calibration.estimators.CalibrationEstimator[source]

This abstract base class serves as the template for implementing a class for doing camera model estimation in GIANT.

Camera model estimation in GIANT is primarily handled by the Calibration class, which does the steps of extracting observed stars in an image, pairing the observed stars with a star catalogue, and then passing the observed star-catalogue star pairs to a subclass of this meta-class, which estimates an update to the camera model in place (the input camera model is modified, not a copy). In order for this to work, this ABC defines the minimum required interfaces that the Calibration class expects for an estimator.

The required interface that the Calibration class expects consists of a few readable/writeable properties, and a couple of standard methods, as defined below. Beyond that the implementation is left to the user.

If you are just doing a typical calibration, then you probably need not worry about this ABC and instead can use one of the 2 concrete classes defined in this module, which work well in nearly all cases. If you do have a need to implement your own estimator, then you should subclass this ABC, and study the concrete classes from this module for an example of what needs to be done.

Note

Because this is an ABC, you cannot create an instance of this class (it will raise a TypeError)

abstract property model: CameraModel

The camera model that is being estimated.

Typically this should be a subclass of CameraModel.

This should be a read/write property

abstract property successful: bool

A boolean flag indicating whether the fit was successful or not.

If the fit was successful this should return True, and False if otherwise.

This should be a read-only property.

abstract property weighted_estimation: bool

A boolean flag specifying whether to do weighted estimation.

If set to True, the estimator should use the provided measurement weights in measurement_covariance during the estimation process. If set to False, then no measurement weights should be considered.

This should be a read/write property

abstract property measurement_covariance: Sequence | ndarray | Real | None

A square numpy array containing the covariance matrix for the measurements.

If weighted_estimation is set to True then this property will contain the measurement covariance matrix as a square, full rank, numpy array. If weighted_estimation is set to False then this property may be None and should be ignored.

This should be a read/write property.

abstract property a_priori_state_covariance: Sequence | ndarray | None

A square numpy array containing the covariance matrix for the a priori estimate of the state vector.

This is only considered if weighted_estimation is set to True and if CameraModel.use_a_priori is set to True, otherwise it is ignored. If both are set to True then this should be set to a square, full rank, lxl numpy array where l=len(model.state_vector) containing the covariance matrix for the a priori state vector. The order of the parameters in the state vector can be determined from CameraModel.get_state_labels().

This should be a read/write property.

abstract property measurements: Sequence | ndarray | None

A nx2 numpy array of the observed pixel locations for stars across all images

Each column of this array will correspond to the same column of the camera_frame_directions concatenated down the last axis. (That is measurements[:, i] <-> np.concatenate(camera_frame_directions, axis=-1)[:, i])

This will always be set before a call to estimate().

This should be a read/write property.

abstract property camera_frame_directions: List[ndarray | List[List]] | None

A length m list of unit vectors in the camera frame as numpy arrays for m images corresponding to the measurements attribute.

Each element of this list corresponds to a unique image that is being considered for estimation and the subsequent element in the temperatures list. Each column of this concatenated array will correspond to the same column of the measurements array. (That is np.concatenate(camera_frame_directions, axis=-1)[:, i] <-> measurements[:, i]).

Any images for which no stars were identified (due to any number of reasons) will have a list of empty arrays in the corresponding element of this list (that is camera_frame_directions[i] == [[], [], []] where i is an image with no measurements identified). These will be automatically dropped by numpy’s concatenate, but are included to notify the user which temperatures to use.

This will always be set before a call to estimate().

This should be a read/write property.

abstract property temperatures: List[Real] | None

A length m list of temperatures of the camera for each image being considered in estimation.

Each element of this list corresponds to a unique image that is being considered for estimation and the subsequent element in the camera_frame_directions list.

This will always be set before a call to estimate() (although sometimes it may be a list of all zeros if temperature data is not available for the camera).

This should be a read/write property.

abstract property postfit_covariance: Sequence | ndarray | None

The post-fit state covariance matrix, taking into account the measurement covariance matrix (if applicable).

This returns the post-fit state covariance matrix after a call to estimate(). The covariance matrix will be in the order according to estimation_parameters and if weighted_estimation is True will return the state covariance matrix taking into account the measurement covariance matrix. If weighted_estimation is False, then this will return the post-fit state covariance matrix assuming no measurement weighting (that is a measurement covariance matrix of the identity matrix). If estimate() has not been called yet then this will return None

This is a read only property

abstract property postfit_residuals: Sequence | ndarray | None

The post-fit observed-computed measurement residuals as a 2xn numpy array.

This returns the post-fit observed minus computed measurement residuals after a call to estimate(). If estimate() has not been called yet then this will return None.

This is a read only property

Summary of Methods

estimate

Estimates an updated camera model that better transforms the camera frame directions into pixel locations to minimize the residuals between the observed and the predicted star locations.

reset

This method resets all of the data attributes to their default values to prepare for another estimation.