Fix C-matrix definition and instrument attitude
Based on SPICE documentation, C-matrix (camera matrix) transforms the coordinates of a point in a reference frame (like J2000) into the instrument fixed coordinates:
[ x_inst] [ ] [ x_J2000 ]
| y_inst| = | C-matrix | | y_J2000 |
[ z_inst] [ ] [ z_J2000 ]
The transpose of a C-matrix rotates vectors from the instrument-fixed frame to the base frame:
[ x_J2000] [ ]T [ x_inst ]
| y_J2000| = | C-matrix | | y_inst |
[ z_J2000] [ ] [ z_inst ]
Currently, the planetary_coverage.spice.toolbox.attitude()
is computing the transpose of the C-matrix and not the C-matrix:
sp.pxform(str(observer.frame), ref, time)
whereas it should be:
sp.pxform(ref, str(observer.frame), time)
A better docstring should describe this matrix with the example above.
Currently, the trajectory objects provide a sc_attitude
property base on planetary_coverage.spice.toolbox.attitude()
.
It should be updated to take the transpose of the results.
Additionally, this sc_attitude
is computed for the observer (spacecraft or instrument) frame. This is not consistent with the sc_
prefix.
We recommend to depreciate this property (with a warning) and provide a generic attitude
property that takes into account the nature of the observer. This will also affect the radec
values that are also observer specific.
/cc @lpenasa