Permalink
Browse files

Upgrade to wcslib 4.20

  • Loading branch information...
1 parent 81ddb64 commit 711fe9ae3cc39602fa3074ce10b91aeb62e78186 @mdboom mdboom committed Jan 8, 2014
Showing with 415 additions and 252 deletions.
  1. +14 −5 CHANGES.rst
  2. +21 −0 astropy/wcs/docstrings.py
  3. +33 −0 astropy/wcs/src/wcslib_wrap.c
  4. +5 −0 astropy/wcs/tests/test_wcsprm.py
  5. +0 −11 cextern/patches/cunit-fix-message.diff
  6. +0 −20 cextern/patches/unit-translate-information.diff
  7. +0 −3 cextern/trim_wcslib.sh
  8. +2 −2 cextern/wcslib/C/GNUmakefile
  9. +2 −2 cextern/wcslib/C/cel.c
  10. +3 −3 cextern/wcslib/C/cel.h
  11. +6 −6 cextern/wcslib/C/fitshdr.h
  12. +2 −2 cextern/wcslib/C/fitshdr.l
  13. +2 −2 cextern/wcslib/C/flexed/fitshdr.c
  14. +2 −2 cextern/wcslib/C/flexed/wcsbth.c
  15. +2 −2 cextern/wcslib/C/flexed/wcspih.c
  16. +2 −2 cextern/wcslib/C/flexed/wcsulex.c
  17. +2 −2 cextern/wcslib/C/flexed/wcsutrn.c
  18. +2 −2 cextern/wcslib/C/getwcstab.c
  19. +2 −2 cextern/wcslib/C/getwcstab.h
  20. +2 −2 cextern/wcslib/C/lin.c
  21. +3 −3 cextern/wcslib/C/lin.h
  22. +2 −2 cextern/wcslib/C/log.c
  23. +3 −3 cextern/wcslib/C/log.h
  24. +80 −47 cextern/wcslib/C/prj.c
  25. +12 −7 cextern/wcslib/C/prj.h
  26. +2 −2 cextern/wcslib/C/spc.c
  27. +3 −3 cextern/wcslib/C/spc.h
  28. +2 −2 cextern/wcslib/C/sph.c
  29. +3 −3 cextern/wcslib/C/sph.h
  30. +2 −2 cextern/wcslib/C/spx.c
  31. +3 −3 cextern/wcslib/C/spx.h
  32. +2 −2 cextern/wcslib/C/tab.c
  33. +3 −3 cextern/wcslib/C/tab.h
  34. +20 −2 cextern/wcslib/C/wcs.c
  35. +37 −3 cextern/wcslib/C/wcs.h
  36. +2 −2 cextern/wcslib/C/wcsbth.l
  37. +2 −2 cextern/wcslib/C/wcserr.c
  38. +2 −2 cextern/wcslib/C/wcserr.h
  39. +3 −4 cextern/wcslib/C/wcsfix.c
  40. +3 −3 cextern/wcslib/C/wcsfix.h
  41. +2 −2 cextern/wcslib/C/wcshdr.c
  42. +3 −3 cextern/wcslib/C/wcshdr.h
  43. +3 −3 cextern/wcslib/C/wcslib.h
  44. +2 −2 cextern/wcslib/C/wcsmath.h
  45. +2 −2 cextern/wcslib/C/wcspih.l
  46. +2 −2 cextern/wcslib/C/wcsprintf.c
  47. +3 −3 cextern/wcslib/C/wcsprintf.h
  48. +2 −2 cextern/wcslib/C/wcstrig.c
  49. +2 −2 cextern/wcslib/C/wcstrig.h
  50. +2 −2 cextern/wcslib/C/wcsulex.l
  51. +2 −2 cextern/wcslib/C/wcsunits.c
  52. +8 −8 cextern/wcslib/C/wcsunits.h
  53. +2 −2 cextern/wcslib/C/wcsutil.c
  54. +2 −2 cextern/wcslib/C/wcsutil.h
  55. +2 −2 cextern/wcslib/C/wcsutrn.l
  56. +35 −4 cextern/wcslib/CHANGES
  57. +2 −2 cextern/wcslib/GNUmakefile
  58. +4 −4 cextern/wcslib/INSTALL
  59. +3 −3 cextern/wcslib/README
  60. +1 −1 cextern/wcslib/THANKS
  61. +10 −1 cextern/wcslib/VALIDATION
  62. +12 −12 cextern/wcslib/configure
  63. +3 −3 cextern/wcslib/configure.ac
  64. +1 −1 cextern/wcslib/flavours
  65. +4 −4 cextern/wcslib/makedefs.in
  66. +2 −2 cextern/wcslib/wcsconfig.h.in
  67. +2 −2 cextern/wcslib/wcsconfig_f77.h.in
  68. +2 −2 cextern/wcslib/wcsconfig_tests.h.in
  69. +2 −2 cextern/wcslib/wcsconfig_utils.h.in
View
@@ -158,6 +158,17 @@ Bug Fixes
- ``astropy.wcs``
+ - astropy now requires wcslib version 4.20 or later. The version of
+ wcslib included with astropy has likewise been updated to version
+ 4.20.
+
+ - This version of wcslib brings some bugfixes from the astropy
+ project (described below) and tighter bounds checking.
+
+ - A new method, `astropy.wcs.Wcsprm.bounds_check` (corresponding to
+ wcslib's ``wcsbchk``) has been added to control what bounds
+ checking is performed by wcslib.
+
- `astropy.wcs.WCS`, `astropy.wcs.WCS.fix` and
`astropy.wcs.find_all_wcs` now have a `translate_units` keyword
argument that is passed down to `astropy.wcs.Wcsprm.fix`. This
@@ -170,14 +181,12 @@ Bug Fixes
rarely that may be used. The same applies to ``"H"`` for
hours (Henry), and ``"D"`` for days (Debye).
- When these sorts of changes are performed, a warning is emitted
- (but this reporting requires a patched version of wcslib,
- distributed with astropy). [#1854]
+ When these sorts of changes are performed, a warning is emitted.
+ [#1854]
- When a unit is "fixed" by `astropy.wcs.WCS.fix` or
`astropy.wcs.Wcsprm.unitfix`, it now correctly reports the
- ``CUNIT`` field that was changed. (This requires that astropy
- was built with the locally distributed version of wcslib). [#1854]
+ ``CUNIT`` field that was changed. [#1854]
- `astropy.wcs.WCS.to_header` will now raise a more meaningful
exception when the WCS information is inavlid or inconsistent in
View
@@ -161,6 +161,27 @@
``int`` (read-only) Order of the polynomial (``B_ORDER``).
"""
+bounds_check = """
+bounds_check(pix2world, world2pix)
+
+Parameters
+----------
+pix2world : bool, optional
+ When `True`, enable bounds checking for the pixel-to-world (p2x)
+ transformation for the ``HPX`` and ``XPH`` projections. Default
+ is `False`.
+
+world2pix : bool, optional
+ When `True`, enable bounds checking for the world-to-pixel (s2x)
+ transformation for the ``AZP``, ``SZP``, ``TAN``, ``SIN``, ``ZPN``
+ and ``COP`` projections. Default is `False`.
+
+Notes
+-----
+Note that by default (without calling `bounds_check`) strict bounds
+checking is enabled.
+"""
+
bp = """
``double array[bp_order+1][bp_order+1]`` Focal plane to pixel
transformation matrix.
@@ -451,6 +451,38 @@ PyWcsprm_init(
}
/*@null@*/ static PyObject*
+PyWcsprm_bounds_check(
+ PyWcsprm* self,
+ PyObject* args,
+ PyObject* kwds) {
+
+ unsigned char pix2sky = 0;
+ unsigned char sky2pix = 0;
+ int bounds = 0;
+ int status = 0;
+ const char* keywords[] = {"pix2world", "world2pix", NULL};
+
+ if (!PyArg_ParseTupleAndKeywords(
+ args, kwds, "|bb:bounds_check", (char **)keywords,
+ &pix2sky, &sky2pix)) {
+ return NULL;
+ }
+
+ if (pix2sky) {
+ bounds |= 2;
+ }
+
+ if (sky2pix) {
+ bounds |= 1;
+ }
+
+ wcsbchk(&self->x, bounds);
+
+ Py_RETURN_NONE;
+}
+
+
+/*@null@*/ static PyObject*
PyWcsprm_copy(
PyWcsprm* self) {
@@ -3242,6 +3274,7 @@ static PyGetSetDef PyWcsprm_getset[] = {
};
static PyMethodDef PyWcsprm_methods[] = {
+ {"bounds_check", (PyCFunction)PyWcsprm_bounds_check, METH_VARARGS|METH_KEYWORDS, doc_bounds_check},
{"cdfix", (PyCFunction)PyWcsprm_cdfix, METH_NOARGS, doc_cdfix},
{"celfix", (PyCFunction)PyWcsprm_celfix, METH_NOARGS, doc_celfix},
{"__copy__", (PyCFunction)PyWcsprm_copy, METH_NOARGS, doc_copy},
@@ -730,3 +730,8 @@ def test_sub_segfault():
w = wcs.WCS(header)
sub = w.sub([wcs.WCSSUB_CELESTIAL])
gc.collect()
+
+
+def test_bounds_check():
+ w = _wcs.Wcsprm()
+ w.bounds_check(False)
@@ -1,11 +0,0 @@
---- a/wcslib/C/wcs.c
-+++ b/wcslib/C/wcs.c
-@@ -2037,7 +2037,7 @@ int wcs_units(struct wcsprm *wcs)
- if (wcsunitse(wcs->cunit[i], units, &scale, &offset, &power,
- &uniterr)) {
- wcserr_set(WCSERR_SET(WCSERR_BAD_COORD_TRANS),
-- "In CUNIT%d%.1s: %s", i, (*wcs->alt)?wcs->alt:"", uniterr->msg);
-+ "In CUNIT%d%.1s: %s", i+1, (*wcs->alt)?wcs->alt:"", uniterr->msg);
- free(uniterr);
- return WCSERR_BAD_COORD_TRANS;
- }
@@ -1,20 +0,0 @@
---- a/wcslib/C/wcsfix.c
-+++ b/wcslib/C/wcsfix.c
-@@ -417,6 +417,7 @@ int unitfix(int ctrl, struct wcsprm *wcs)
- char orig_unit[80], msg[WCSERR_MSG_LENGTH];
- const char *function = "unitfix";
- struct wcserr **err;
-+ int result;
-
- if (wcs == 0x0) return FIXERR_NULL_POINTER;
- err = &(wcs->err);
-@@ -424,7 +425,8 @@ int unitfix(int ctrl, struct wcsprm *wcs)
- strcpy(msg, "Changed units: ");
- for (i = 0; i < wcs->naxis; i++) {
- strncpy(orig_unit, wcs->cunit[i], 80);
-- if (wcsutrne(ctrl, wcs->cunit[i], &(wcs->err)) == 0) {
-+ result = wcsutrne(ctrl, wcs->cunit[i], &(wcs->err));
-+ if (result == 0 || result == 12) {
- k = strlen(msg);
- sprintf(msg+k, "'%s' -> '%s', ", orig_unit, wcs->cunit[i]);
- status = FIXERR_UNITS_ALIAS;
View
@@ -11,6 +11,3 @@ rm -rf wcslib/html
rm -rf wcslib/pgsbox
rm -rf wcslib/utils
rm wcslib/*.pdf
-
-patch -p1 < patches/cunit-fix-message.diff
-patch -p1 < patches/unit-translate-information.diff
@@ -1,5 +1,5 @@
#-----------------------------------------------------------------------------
-# GNU makefile for building WCSLIB 4.19 and its test suite.
+# GNU makefile for building WCSLIB 4.20 and its test suite.
#
# Summary of the main targets
# ---------------------------
@@ -31,7 +31,7 @@
#
# Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.
# http://www.atnf.csiro.au/people/Mark.Calabretta
-# $Id: GNUmakefile,v 4.19 2013/09/29 14:17:51 mcalabre Exp $
+# $Id: GNUmakefile,v 4.20 2013/12/18 05:42:49 mcalabre Exp $
#-----------------------------------------------------------------------------
# Get configure settings.
include ../makedefs
View
@@ -1,6 +1,6 @@
/*============================================================================
- WCSLIB 4.19 - an implementation of the FITS WCS standard.
+ WCSLIB 4.20 - an implementation of the FITS WCS standard.
Copyright (C) 1995-2013, Mark Calabretta
This file is part of WCSLIB.
@@ -22,7 +22,7 @@
Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.
http://www.atnf.csiro.au/people/Mark.Calabretta
- $Id: cel.c,v 4.19 2013/09/29 14:17:51 mcalabre Exp $
+ $Id: cel.c,v 4.20 2013/12/18 05:42:49 mcalabre Exp $
*===========================================================================*/
#include <math.h>
View
@@ -1,6 +1,6 @@
/*============================================================================
- WCSLIB 4.19 - an implementation of the FITS WCS standard.
+ WCSLIB 4.20 - an implementation of the FITS WCS standard.
Copyright (C) 1995-2013, Mark Calabretta
This file is part of WCSLIB.
@@ -22,10 +22,10 @@
Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.
http://www.atnf.csiro.au/people/Mark.Calabretta
- $Id: cel.h,v 4.19 2013/09/29 14:17:51 mcalabre Exp $
+ $Id: cel.h,v 4.20 2013/12/18 05:42:49 mcalabre Exp $
*=============================================================================
*
-* WCSLIB 4.19 - C routines that implement the FITS World Coordinate System
+* WCSLIB 4.20 - C routines that implement the FITS World Coordinate System
* (WCS) standard. Refer to
*
* "Representations of world coordinates in FITS",
View
@@ -1,6 +1,6 @@
/*============================================================================
- WCSLIB 4.19 - an implementation of the FITS WCS standard.
+ WCSLIB 4.20 - an implementation of the FITS WCS standard.
Copyright (C) 1995-2013, Mark Calabretta
This file is part of WCSLIB.
@@ -22,17 +22,17 @@
Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.
http://www.atnf.csiro.au/people/Mark.Calabretta
- $Id: fitshdr.h,v 4.19 2013/09/29 14:17:51 mcalabre Exp $
+ $Id: fitshdr.h,v 4.20 2013/12/18 05:42:49 mcalabre Exp $
*=============================================================================
*
* The Flexible Image Transport System (FITS), a data format widely used in
* astronomy for data interchange and archive, is described in
*
-* "Definition of The Flexible Image Transport System (FITS)",
-* Hanisch, R.J., Farris, A., Greisen, E.W., et al. 2001, A&A, 376, 359
+* "Definition of the Flexible Image Transport System (FITS), version 3.0",
+* Pence, W.D., Chiappetti, L., Page, C.G., Shaw, R.A., & Stobie, E. 2010,
+* A&A, 524, A42 - http://dx.doi.org/10.1051/0004-6361/201015362
*
-* which formalizes NOST 100-2.0, a document produced by the NASA/Science
-* Office of Standards and Technology, see http://fits.gsfc.nasa.gov.
+* See also http://fits.gsfc.nasa.gov
*
* Refer to the README file provided with WCSLIB for an overview of the
* library.
@@ -1,6 +1,6 @@
/*============================================================================
- WCSLIB 4.19 - an implementation of the FITS WCS standard.
+ WCSLIB 4.20 - an implementation of the FITS WCS standard.
Copyright (C) 1995-2013, Mark Calabretta
This file is part of WCSLIB.
@@ -22,7 +22,7 @@
Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.
http://www.atnf.csiro.au/people/Mark.Calabretta
- $Id: fitshdr.l,v 4.19 2013/09/29 14:17:51 mcalabre Exp $
+ $Id: fitshdr.l,v 4.20 2013/12/18 05:42:49 mcalabre Exp $
*=============================================================================
*
* fitshdr.l is a Flex description file containing a lexical scanner
@@ -10083,7 +10083,7 @@ char *fitshdrtext;
#line 1 "fitshdr.l"
/*============================================================================
- WCSLIB 4.19 - an implementation of the FITS WCS standard.
+ WCSLIB 4.20 - an implementation of the FITS WCS standard.
Copyright (C) 1995-2013, Mark Calabretta
This file is part of WCSLIB.
@@ -10105,7 +10105,7 @@ char *fitshdrtext;
Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.
http://www.atnf.csiro.au/people/Mark.Calabretta
- $Id: fitshdr.c,v 4.19 2013/09/29 14:17:52 mcalabre Exp $
+ $Id: fitshdr.c,v 4.20 2013/12/18 05:42:49 mcalabre Exp $
*=============================================================================
*
* fitshdr.l is a Flex description file containing a lexical scanner
@@ -16669,7 +16669,7 @@ char *wcsbthtext;
#line 1 "wcsbth.l"
/*============================================================================
- WCSLIB 4.19 - an implementation of the FITS WCS standard.
+ WCSLIB 4.20 - an implementation of the FITS WCS standard.
Copyright (C) 1995-2013, Mark Calabretta
This file is part of WCSLIB.
@@ -16691,7 +16691,7 @@ char *wcsbthtext;
Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.
http://www.atnf.csiro.au/people/Mark.Calabretta
- $Id: wcsbth.c,v 4.19 2013/09/29 14:17:52 mcalabre Exp $
+ $Id: wcsbth.c,v 4.20 2013/12/18 05:42:49 mcalabre Exp $
*=============================================================================
*
* wcsbth.l is a Flex description file containing the definition of a lexical
@@ -8153,7 +8153,7 @@ char *wcspihtext;
#line 1 "wcspih.l"
/*============================================================================
- WCSLIB 4.19 - an implementation of the FITS WCS standard.
+ WCSLIB 4.20 - an implementation of the FITS WCS standard.
Copyright (C) 1995-2013, Mark Calabretta
This file is part of WCSLIB.
@@ -8175,7 +8175,7 @@ char *wcspihtext;
Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.
http://www.atnf.csiro.au/people/Mark.Calabretta
- $Id: wcspih.c,v 4.19 2013/09/29 14:17:52 mcalabre Exp $
+ $Id: wcspih.c,v 4.20 2013/12/18 05:42:49 mcalabre Exp $
*=============================================================================
*
* wcspih.l is a Flex description file containing the definition of a lexical
@@ -6860,7 +6860,7 @@ char *wcsulextext;
#line 1 "wcsulex.l"
/*============================================================================
- WCSLIB 4.19 - an implementation of the FITS WCS standard.
+ WCSLIB 4.20 - an implementation of the FITS WCS standard.
Copyright (C) 1995-2013, Mark Calabretta
This file is part of WCSLIB.
@@ -6882,7 +6882,7 @@ char *wcsulextext;
Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.
http://www.atnf.csiro.au/people/Mark.Calabretta
- $Id: wcsulex.c,v 4.19 2013/09/29 14:17:52 mcalabre Exp $
+ $Id: wcsulex.c,v 4.20 2013/12/18 05:42:49 mcalabre Exp $
*=============================================================================
*
* wcsulex.l is a Flex description file containing the definition of a
@@ -3982,7 +3982,7 @@ char *wcsutrntext;
#line 1 "wcsutrn.l"
/*============================================================================
- WCSLIB 4.19 - an implementation of the FITS WCS standard.
+ WCSLIB 4.20 - an implementation of the FITS WCS standard.
Copyright (C) 1995-2013, Mark Calabretta
This file is part of WCSLIB.
@@ -4004,7 +4004,7 @@ char *wcsutrntext;
Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.
http://www.atnf.csiro.au/people/Mark.Calabretta
- $Id: wcsutrn.c,v 4.19 2013/09/29 14:17:52 mcalabre Exp $
+ $Id: wcsutrn.c,v 4.20 2013/12/18 05:42:49 mcalabre Exp $
*=============================================================================
*
* wcsutrn.l is a Flex description file containing the definition of a lexical
@@ -1,6 +1,6 @@
/*============================================================================
- WCSLIB 4.19 - an implementation of the FITS WCS standard.
+ WCSLIB 4.20 - an implementation of the FITS WCS standard.
Copyright (C) 1995-2013, Mark Calabretta
This file is part of WCSLIB.
@@ -22,7 +22,7 @@
Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.
http://www.atnf.csiro.au/people/Mark.Calabretta
- $Id: getwcstab.c,v 4.19 2013/09/29 14:17:51 mcalabre Exp $
+ $Id: getwcstab.c,v 4.20 2013/12/18 05:42:49 mcalabre Exp $
*===========================================================================*/
#include <stdlib.h>
@@ -1,6 +1,6 @@
/*============================================================================
- WCSLIB 4.19 - an implementation of the FITS WCS standard.
+ WCSLIB 4.20 - an implementation of the FITS WCS standard.
Copyright (C) 1995-2013, Mark Calabretta
This file is part of WCSLIB.
@@ -22,7 +22,7 @@
Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.
http://www.atnf.csiro.au/people/Mark.Calabretta
- $Id: getwcstab.h,v 4.19 2013/09/29 14:17:51 mcalabre Exp $
+ $Id: getwcstab.h,v 4.20 2013/12/18 05:42:49 mcalabre Exp $
*=============================================================================
*
* Summary of the getwcstab routines
Oops, something went wrong.

0 comments on commit 711fe9a

Please sign in to comment.