<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html; charset=ISO-8859-1"
 http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
On 08/18/2010 03:56 PM, Peter Erwin wrote:
<blockquote cite="mid:C20BAC07-3700-4C2D-BFFD-6B55B87D0555@mpe.mpg.de"
 type="cite">
  <pre wrap="">Hi Mike,

Thanks for the quick reply!

It looks like what happened is that *was* an earlier version of pywcs hiding
in /Users/erwin/lib/python [as opposed to
/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6 ,
which is where pywcs 1.9 got installed].  Possibly it got installed as part of
an earlier installation of stsci_python ...

Anyway, I nuked the earlier installation, and now pywcs seems to work.


Am I missing something, or does the documentation for pywcs mention anywhere what
"sky coordinates" actually means (i.e., allowed formats, types, order, etc.?).
  </pre>
</blockquote>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<span class="Apple-style-span"
 style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;"><span
 class="Apple-style-span"
 style="font-family: 'Lucida Grande','Lucida Sans Unicode',Geneva,Verdana,sans-serif; font-size: 14px; line-height: 17px; text-align: left;">
<p style="margin: 0px 0px 0.5em; line-height: 17px;">The order is
described in the wcs_sky2pix docstring:<br>
</p>
<p style="margin: 0px 0px 0.5em; line-height: 17px;">"""<br>
</p>
<p style="margin: 0px 0px 0.5em; line-height: 17px;">Either two or
three arguments may be provided.</p>
<blockquote>
  <ul class="simple"
 style="margin-bottom: 0px; margin-top: 0px; padding-top: 0px; padding-bottom: 0px;">
    <li style="line-height: 17px;">2 arguments: An<span
 class="Apple-converted-space"> </span><em>N</em><span
 class="Apple-converted-space"> </span>x<span
 class="Apple-converted-space"> </span><em>naxis</em><span
 class="Apple-converted-space"> </span>array of<span
 class="Apple-converted-space"> </span><em>x</em>- and<span
 class="Apple-converted-space"> </span><em>y</em>-coordinates, and an<span
 class="Apple-converted-space"> </span><em>origin</em>.</li>
    <li style="line-height: 17px;">3 arguments: 2 one-dimensional
arrays of<span class="Apple-converted-space"> </span><em>x</em><span
 class="Apple-converted-space"> </span>and<span
 class="Apple-converted-space"> </span><em>y</em><span
 class="Apple-converted-space"> </span>coordinates, and an<span
 class="Apple-converted-space"> </span><em>origin</em>.</li>
  </ul>
</blockquote>
</span></span>"""<br>
<br>
As for types, it may be any numeric type (and the underlying
calculations are performed in doubles).<br>
<br class="Apple-interchange-newline">
<blockquote cite="mid:C20BAC07-3700-4C2D-BFFD-6B55B87D0555@mpe.mpg.de"
 type="cite">
  <pre wrap="">(From my experiments so far, I'm guessing that the output of WCS.wcs_pix2sky()
for a single pair of pixel coordinates is [[Dec, RA]], with both in decimal degrees...?)
  </pre>
</blockquote>
The fact that it's decimal degrees is somewhat buried (in the
description of the lower-level wcslib functions.)  I will move this
information up to the higher-level functions -- and that should make it
into the next version of the docs.<br>
<br>
Mike<br>
<blockquote cite="mid:C20BAC07-3700-4C2D-BFFD-6B55B87D0555@mpe.mpg.de"
 type="cite">
  <pre wrap="">
cheers,

Peter

On Aug 18, 2010, at 9:04 PM, Michael Droettboom wrote:

  </pre>
  <blockquote type="cite">
    <pre wrap="">This problem occurs due to a version incompatibility between pyfits and 
pywcs.

Recent versions of pyfits (2.3 and later) were refactored to no longer 
support numarray.  pywcs required a change to be compatible with this 
(this change first appeared in pywcs 1.8).

Given the versions you list, you should be ok -- however it seems that 
you are not running the version of pywcs you think you are.  Perhaps you 
need to blitz the installation directory (in your case, 
/Users/erwin/lib/python/pywcs) and reinstall.

Mike

On 08/18/2010 02:40 PM, Peter Erwin wrote:
    </pre>
    <blockquote type="cite">
      <pre wrap="">Hi,

I decided to check out pywcs (in part because using Pyraf to get pixel values from
RA,Dec pairs seemed to be overkill, and wcwcstran was failing to work for SDSS
images with declinations close to zero).

The installation ("python setup.py install") seemd to go fine, but I ran into the following when I tried
running the example from <a class="moz-txt-link-freetext" href="http://stsdas.stsci.edu/astrolib/pywcs/examples.html">http://stsdas.stsci.edu/astrolib/pywcs/examples.html</a>

<<begin quote>>
In [164]: hdulist = pyfits.open("pgc1905g_94-220.fits")   # this is an SDSS g-band image
In [165]: wcs = pywcs.WCS(hdulist[0].header)
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)

/Users/erwin/Documents/Working/ESO_observing/WFI/targets/pgc1905_808/<ipython console>  in<module>()

/Users/erwin/lib/python/pywcs/pywcs.py in __init__(self, header, fobj, key, minerr, relax, naxis)
    176             self.naxis = wcsprm.naxis
    177
-->  178             det2im = self._read_det2im_kw(header, fobj)
    179             cpdis = self._read_distortion_kw(
    180                 header, fobj, key=key,dist='CPDIS', err=minerr)

/Users/erwin/lib/python/pywcs/pywcs.py in _read_det2im_kw(self, header, fobj)
    278         cdelt = [1.,1.]
    279
-->  280         if not isinstance(fobj, pyfits.NP_pyfits.HDUList):
    281             return (None, None)
    282

AttributeError: 'module' object has no attribute 'NP_pyfits'
<<end quote>>

My system is: MacBook Pro (2009) running Mac OS 10.6.4, Python 2.6.5 (standard framework install
from python.org) via ipython 0.10
numpy 1.4.1
pyfits 2.3.1 [same problem occurred for pyfits 2.2.2; I
pywcs v1.9-4.4.4

(All packages are installed inside the framework directory, *except* for pyfits, which installed in
~/lib/python )

Any suggestions?

   -- Peter

=============================================================
Peter Erwin                   Max-Planck-Insitute for Extraterrestrial
<a class="moz-txt-link-abbreviated" href="mailto:erwin@mpe.mpg.de">erwin@mpe.mpg.de</a>              Physics, Giessenbachstrasse
tel. +49 (0)89 30000 3695     85748 Garching, Germany
fax  +49 (0)89 30000 3495     <a class="moz-txt-link-freetext" href="http://www.mpe.mpg.de/~erwin">http://www.mpe.mpg.de/~erwin</a>



_______________________________________________
AstroPy mailing list
<a class="moz-txt-link-abbreviated" href="mailto:AstroPy@scipy.org">AstroPy@scipy.org</a>
<a class="moz-txt-link-freetext" href="http://mail.scipy.org/mailman/listinfo/astropy">http://mail.scipy.org/mailman/listinfo/astropy</a>

      </pre>
    </blockquote>
    <pre wrap="">

-- 
Michael Droettboom
Science Software Branch
Space Telescope Science Institute
Baltimore, Maryland, USA

_______________________________________________
AstroPy mailing list
<a class="moz-txt-link-abbreviated" href="mailto:AstroPy@scipy.org">AstroPy@scipy.org</a>
<a class="moz-txt-link-freetext" href="http://mail.scipy.org/mailman/listinfo/astropy">http://mail.scipy.org/mailman/listinfo/astropy</a>
    </pre>
  </blockquote>
  <pre wrap="">
=============================================================
Peter Erwin                   Max-Planck-Insitute for Extraterrestrial 
<a class="moz-txt-link-abbreviated" href="mailto:erwin@mpe.mpg.de">erwin@mpe.mpg.de</a>              Physics, Giessenbachstrasse
tel. +49 (0)89 30000 3695     85748 Garching, Germany
fax  +49 (0)89 30000 3495     <a class="moz-txt-link-freetext" href="http://www.mpe.mpg.de/~erwin">http://www.mpe.mpg.de/~erwin</a>



_______________________________________________
AstroPy mailing list
<a class="moz-txt-link-abbreviated" href="mailto:AstroPy@scipy.org">AstroPy@scipy.org</a>
<a class="moz-txt-link-freetext" href="http://mail.scipy.org/mailman/listinfo/astropy">http://mail.scipy.org/mailman/listinfo/astropy</a>
  </pre>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">-- 
Michael Droettboom
Science Software Branch
Space Telescope Science Institute
Baltimore, Maryland, USA</pre>
</body>
</html>