question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

how to properly deal with the warning about SIP and WCS

See original GitHub issue

Hi, I’m working on photometry extraction of HST data (drizzled), and I have this warning/info that is printed on screen each time WCS from astropy.wcs is called, as is mentioned on this page: Note about SIP and WCS

I can’t figure out if it does apply coefficients that mess up the coordinates or not. It doesn’t appear to be the case at the level of what I can visually control (ie. my coordinates do seem to appear where they’re meant to be when I plot the data).

I did check that the CTYPE’s in the header are of the form ‘RA—TAN’ and ‘DEC–TAN’, and do not contain the -SIP suffix.

My question is two-fold:

  • do I have to worry about this actually having a nefarious effect on the photometries I measure?
  • how can I stop the message from appearing? (I’d like to keep the script’s output as a log, and I’d rather not having this interrupting it each time WCS is called).

In the link I attached above it seems to be explained, but without giving like a complete example or making all steps/how-to explicit. It proposes to remove the SIP coefficients from the header (but I don’t find any in the header, are they called something else?) by calling wcsobj.sip = None but I don’t know how I must properly initiate this or what I must import, for it not to result in an error.

What do you suggest I do? Can I maybe change something directly on the header, without causing other issues? Thanks!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
larrybradleycommented, Apr 11, 2018

Note that wcs_world2pix applies only the core transformation (no distortions, including SIP). I don’t know if that is correct for your data. If you need the SIP transforms, then your (sky) -> (x, y) transformation will be wrong. In that case you need to use all_world2pix instead.

If your WCS header info is consistent, then wcs_world2pix and all_world2pix will give the same results for a drizzled (rectified, undistorted) image.

1reaction
larrybradleycommented, Apr 11, 2018

@panossk This is an astropy issue with WCS objects, not a photutils issue.

You appear to have a FITS file with an inconsistent header where you have SIP coefficients, but the CTYPES do not have the -SIP suffix. If you want to apply the SIP coefficients, simply update header CTYPES to include the -SIP suffix. If you don’t want to apply the SIP coefficients, then remove them from the header. HST SIP coefficients are A_* and B_*. That will get rid of the warnings. You have to decide which is correct for your data.

If you are really using a drizzled (rectified, undistorted) image, then you should not have SIP coefficients. If SIP coefficients are present then they are always applied by astropy.wcs. That means your WCS is wrong for a drizzled image. If you are using the Sky*-based apertures, then your photometry will also be wrong.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Source code for astropy.wcs.wcs
If you do not want to apply the SIP distortion coefficients, please remove the SIP coefficients from the FITS header or the WCS...
Read more >
1. Astronomical Imaging & Functional Programming
The wcs for a given image is constructed from the image header, where some information about the pixel scale and image pointing are...
Read more >
JWST Operational Pipeline Build 8.1.2 Release Notes
This article provides a list of all relevant changes to the operational pipeline that was released with patch build 8.1.2.
Read more >
The IDL Astronomy User's Library - NASA
READCOL- Correctly handle blanks without a conversion error ... 25-Nov-2011: EXTAST - Give warning if reverse SIP coefficients not supplied.
Read more >
WCS-03051 to WCS-47826 - 11g Release 1 (11.1.1.7.0)
Action: Verify that the connections.xml and adf-config.xml file contains a valid entry with the correct connection information. Level: 1. Type: WARNING.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found