Creating WCS headers with SIP distortions using fit_wcs_from_points

Hi there.

I have a question regarding creating WCS using the wcs.utils.fit_wcs_from_points function. The data we have has some obvious distortion. Therefore we would like to write the WCS of the data with a SIP projection, however even when I set the sip_degree to some number in the fit_wcs_from_points function, the resulting header doesn’t have the SIP projection keywords or any SIP coefficients in the header.

How might I go about creating a wcs object with a distortion?

Thanks in advance.

Just in case anyone comes across this with the same problem. The fit_wcs_from_fits function does allow you to choose a sip_degree (polynomial degree for fitting distortion). The issue is when you write this wcs to a header object. the .to_header() function requires the keyword relax=True

wcs.to_header(relax=True). This isn’t really very clear in the current documentation.