pc_to_cd#

niriss_tools.isophotal.pc_to_cd(hdr_in)[source]#

Convert a PC matrix to a CD matrix.

astropy.wcs.WCS recognises CD keywords as input but converts them and works internally with the PC matrix. to_header returns the PC matrix even if the input was a CD matrix. This can cause problems if used to update an existing header with a CD matrix, so we convert between the two.

Adapated from stwcs.wcsutil.altwcs.pc2cd.

Parameters:
hdr_inHeader

The input header, containing a PC matrix.

Returns:
Header

The output header, containing a CD matrix.