[AstroPy] Check if header contains WCS

Martin Beroiz martinberoiz at gmail.com
Thu May 28 17:31:19 EDT 2015


Actually I just checked that trying to create a WCS from a header that contains none, doesn’t throw an exception.


> On May 28, 2015, at 2:48 PM, Martin Beroiz <martinberoiz at gmail.com> wrote:
> 
> Hello, 
> 
> Is there a way of checking if a header has WCS info?
> Right now I’m using
> 
> try:
>    the_wcs = wcs.WCS(header_in)
> except WcsError:
>    print("No WCS information found in header”)
>    DoesImageHaveWCS = False
> 
> But I wonder if WcsError will catch all exceptions regarding WCS headers.
> 
> Thanks,
> Martin.
> 




More information about the AstroPy mailing list