Changeset 669

Show
Ignore:
Timestamp:
10/08/08 09:49:33 (1 month ago)
Author:
mdroe
Message:

Paper IV rendering passing smoke test.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/pywcs/pywcs/pywcs.py

    r660 r669  
    141141            cpdis = (None, None) 
    142142        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) 
    145149            cpdis = self._read_distortion_kw(header, fobj, dist='CPDIS') 
    146150            sip = self._read_sip_kw(header) 
     
    168172                if dis == 'lookup': 
    169173                    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.' 
    171175                    dp = d_kw+str(i) 
    172176                    d_extver = header[dp+'.EXTVER'] 
     
    185189 
    186190        if len(tables) == 2: 
    187             return (tables[0], tables[1]) 
     191            return (tables[1], tables[2]) 
    188192        return (None, None) 
    189193 
  • trunk/pywcs/src/distortion.c

    r660 r669  
    199199  assert(pix); 
    200200  assert(foc); 
    201   assert(pix != foc); 
    202201 
    203202  if (pix == NULL || foc == NULL || lookup[0] == NULL || lookup[1] == NULL) { 
  • trunk/pywcs/src/util.c

    r653 r669  
    176176PyObject* WcsExc_InvalidSubimageSpecification; 
    177177PyObject* WcsExc_NonseparableSubimageCoordinateSystem; 
     178PyObject* WcsExc_NoWcsKeywordsFound; 
    178179 
    179180/* This is an array mapping the wcs status codes to Python exception 
     
    215216  DEFINE_EXCEPTION(InvalidSubimageSpecification); 
    216217  DEFINE_EXCEPTION(NonseparableSubimageCoordinateSystem); 
     218  DEFINE_EXCEPTION(NoWcsKeywordsFound); 
    217219  return 0; 
    218220} 
  • trunk/pywcs/src/util.h

    r561 r669  
    123123extern PyObject* WcsExc_InvalidSubimageSpecification; 
    124124extern PyObject* WcsExc_NonseparableSubimageCoordinateSystem; 
     125extern PyObject* WcsExc_NoWcsKeywordsFound; 
    125126 
    126127/* This is an array mapping the wcs status codes to Python exception 
  • trunk/pywcs/src/wcslib_wrap.c

    r660 r669  
    210210 
    211211    if (nwcs == 0) { 
    212       PyErr_SetString(PyExc_KeyError
     212      PyErr_SetString(WcsExc_NoWcsKeywordsFound
    213213                      "No WCS keywords found in the given header"); 
    214214      return -1; 
  • trunk/pywcs/test/sip_test.py

    r660 r669  
    22import pyfits 
    33import numpy 
     4import sys 
    45 
    5 hdulist = pyfits.open("sip_reference.fits"
     6hdulist = pyfits.open(sys.argv[-1]
    67 
    78data1 = numpy.array([0,2,4,6])