OwenModel.compute_jacobian¶
giant.camera_models.owen_model
:
- OwenModel.compute_jacobian(unit_vectors_camera, temperature=0)¶
Calculates the Jacobian matrix for each observation in unit_vectors_camera for each parameter to be estimated as defined in the
estimation_parameters
attribute.This method works by first computing the partial derivatives for all camera parameters for each provided unit vector. It then concatenates the rows into the Jacobian matrix and removes any columns of parameters that are not specified in the
estimation_parameters
attribute and sorts the columns according to the order of theestimation_parameters
attribute. The resulting Jacobian will be the appropriate size and in the order specified byestimation_parameters
. There is one constraint that the misalignment (if included) must be last inestimation_parameters
.The unit_vectors_camera inputs should be formatted as a Sequence of 2d sequences. Each inner 2D sequence should be of shape
, where each row corresponds to a component of a unit vector in the camera frame. Each inner sequence should contain all observations from a single image, so that if there are images being considered, then the outer sequence should be length . The value of can change for each image. If you are estimating multiple misalignments (one for each image) then each misalignment will correspond to the order of the image observations in the outer sequence.You can also set the
use_a_priori
to True to have this method append an identity matrix to the bottom of this Jacobian if you are solving for an update to your camera model, and not a new one entirely.The optional temperature input specifies the temperature of the camera for use in estimating temperature dependence. The temperature input should either be a scalar value (float or int), or a list that is the same length as unit_vectors_camera, where each element of the list is the temperature of the camera at the time of each image represented by unit_vectors_camera. If the temperature input is a scalar, then it is assumed to be the temperature value for all of the images represented in unit_vectors_camera.
- Parameters:
unit_vectors_camera (Sequence[Sequence[Sequence] | ndarray]) – The points/directions in the camera frame that the jacobian matrix is to be computed for. For multiple images, this should be a list of 2D unit vectors where each element of the list corresponds to a new image.
temperature (Sequence | ndarray | Real) – A single temperature for all images or a list of temperatures the same length of unit_vectors_camera containing the temperature of the camera at the time each image was captured
- Returns:
The Jacobian matrix evaluated for each observation
- Return type:
ndarray
Example:
>>> from giant.camera_models import OwenModel
>>> model = OwenModel(kx=3000, ky=4000, px=500, py=500, a1=1e-5, a2=1e-6,
>>> misalignment = [[1e-12, -2e-14, 3e-10], [2e-15, 1e-13, 3e-10]],
>>> estimation_parameters = ['multiple misalignments'])
>>> model.compute_jacobian([[[0.5], [0], [1]], [[0.1, 0.2, 0.3], [-0.3, -0.4, -0.5], [4, 5, 6]]],
>>> temperature=[10, -20])
array([[ 0.00000000e+00, -3.75075000e+03, 0.00000000e+00,
0.00000000e+00, 0.00000000e+00, 0.00000000e+00],
[ 4.00080000e+03, 2.98059600e-07, -2.00040000e+03,
0.00000000e+00, 0.00000000e+00, 0.00000000e+00],
[ 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
-5.62612499e+00, -3.00247537e+03, -2.25045000e+02],
[ 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
4.02330450e+03, 7.50150000e+00, -1.00020000e+02],
[ 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
-9.60191999e+00, -3.00540096e+03, -2.40048000e+02],
[ 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
4.02640512e+03, 1.28025600e+01, -1.60032000e+02],
[ 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
-1.25025000e+01, -3.00810150e+03, -2.50050000e+02],
[ 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
4.02858333e+03, 1.66700000e+01, -2.00040000e+02]])
Mathematically the Jacobian matrix is defined to be
where, using the chain rule,
and
where