Changeset 669
- Timestamp:
- 10/08/08 09:49:33 (1 month ago)
- Files:
-
- trunk/pywcs/pywcs/pywcs.py (modified) (3 diffs)
- trunk/pywcs/src/distortion.c (modified) (1 diff)
- trunk/pywcs/src/util.c (modified) (2 diffs)
- trunk/pywcs/src/util.h (modified) (1 diff)
- trunk/pywcs/src/wcslib_wrap.c (modified) (1 diff)
- trunk/pywcs/test/p4_test.py (added)
- trunk/pywcs/test/sip_test.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/pywcs/pywcs/pywcs.py
r660 r669 141 141 cpdis = (None, None) 142 142 else: 143 wcsprm = _pywcs._Wcsprm(header=str(header.ascardlist()), key=key, 144 relax=relax, naxis=naxis) 143 try: 144 wcsprm = _pywcs._Wcsprm(header=str(header.ascardlist()), key=key, 145 relax=relax, naxis=naxis) 146 except _pywcs.NoWcsKeywordsFoundError: 147 wcsprm = _pywcs._Wcsprm(header=None, key=key, 148 relax=relax, naxis=naxis) 145 149 cpdis = self._read_distortion_kw(header, fobj, dist='CPDIS') 146 150 sip = self._read_sip_kw(header) … … 168 172 if dis == 'lookup': 169 173 assert isinstance(fobj, pyfits.NP_pyfits.HDUList), \ 170 'A pyfits HDUList is required for Lookup table distortion.'174 'A pyfits HDUList is required for Lookup table distortion.' 171 175 dp = d_kw+str(i) 172 176 d_extver = header[dp+'.EXTVER'] … … 185 189 186 190 if len(tables) == 2: 187 return (tables[ 0], tables[1])191 return (tables[1], tables[2]) 188 192 return (None, None) 189 193 trunk/pywcs/src/distortion.c
r660 r669 199 199 assert(pix); 200 200 assert(foc); 201 assert(pix != foc);202 201 203 202 if (pix == NULL || foc == NULL || lookup[0] == NULL || lookup[1] == NULL) { trunk/pywcs/src/util.c
r653 r669 176 176 PyObject* WcsExc_InvalidSubimageSpecification; 177 177 PyObject* WcsExc_NonseparableSubimageCoordinateSystem; 178 PyObject* WcsExc_NoWcsKeywordsFound; 178 179 179 180 /* This is an array mapping the wcs status codes to Python exception … … 215 216 DEFINE_EXCEPTION(InvalidSubimageSpecification); 216 217 DEFINE_EXCEPTION(NonseparableSubimageCoordinateSystem); 218 DEFINE_EXCEPTION(NoWcsKeywordsFound); 217 219 return 0; 218 220 } trunk/pywcs/src/util.h
r561 r669 123 123 extern PyObject* WcsExc_InvalidSubimageSpecification; 124 124 extern PyObject* WcsExc_NonseparableSubimageCoordinateSystem; 125 extern PyObject* WcsExc_NoWcsKeywordsFound; 125 126 126 127 /* This is an array mapping the wcs status codes to Python exception trunk/pywcs/src/wcslib_wrap.c
r660 r669 210 210 211 211 if (nwcs == 0) { 212 PyErr_SetString( PyExc_KeyError,212 PyErr_SetString(WcsExc_NoWcsKeywordsFound, 213 213 "No WCS keywords found in the given header"); 214 214 return -1; trunk/pywcs/test/sip_test.py
r660 r669 2 2 import pyfits 3 3 import numpy 4 import sys 4 5 5 hdulist = pyfits.open( "sip_reference.fits")6 hdulist = pyfits.open(sys.argv[-1]) 6 7 7 8 data1 = numpy.array([0,2,4,6])
