[AstroPy] pywcs problem on Linux

Thomas Robitaille thomas.robitaille@gmail....
Wed May 6 08:30:16 CDT 2009


Hi Akira,

The API for the pix2sky and sky2pix methods is different in the new  
version, you now have to specify a non-optional 'origin' argument  
which specifies whether the pixel origin of the image is (1,1) (as  
defined in the FITS standard) or (0,0) (as defined for numpy arrays).  
So for example the following are valid:

wcs.wcs_pix2sky(x,y,0)
wcs.wcs_pix2sky(x,y,1)
wcs.wcs_pix2sky(xy,0)
wcs.wcs_pix2sky(xy,1)

Best,

Thomas


On May 6, 2009, at 9:14 AM, OKUMURA, Akira wrote:

> Hello Nadia,
>
> Thank you for your reply. I didn't know that new version has been
> released recently. I installed pywcs-1.4-4.3.tar.gz and tried test.py
> in the package. But I got errors again.
>
> 1)
> $ ./test.py .
> =
> =
> =
> = 
> = 
> ======================================================================
> ./cmap.fits
> zsh: segmentation fault  ./test.py .
>
> the line wcs.wcs.fix() causes the seg fault.
>
> 2) comment out wcs.wcs.fix()
> $ ./test.py .
> =
> =
> =
> = 
> = 
> ======================================================================
> ./cmap.fits
> Traceback (most recent call last):
>   File "./test.py", line 82, in <module>
>     run_directory(directory)
>   File "./test.py", line 74, in run_directory
>     test_file(filepath)
>   File "./test.py", line 38, in test_file
>     world = wcs.wcs_pix2sky(data3)
>   File "/usr/local/lib/python2.5/site-packages/pywcs/pywcs.py", line
> 419, in wcs_pix2sky
>     *args, **kwargs)
>   File "/usr/local/lib/python2.5/site-packages/pywcs/pywcs.py", line
> 378, in _array_converter
>     raise TypeError("Expected 2 or 3 arguments, %d given" % len(args))
> TypeError: Expected 2 or 3 arguments, 1 given
>
> I tried several FITS files but I got the same errors. Do you have any
> idea?
>
> Regards,
>
> OKUMURA, Akira oxon@ceres.phys.s.u-tokyo.ac.jp
> Department of Physics, The University of Tokyo
> 7-3-1 Hongo, Bunkyo-ku, Tokyo 113-0033
> TEL/FAX +81 3-5841-4173/4059
> Skype : okumura.akira
>
> On 2009/05/06, at 20:47, Nadezhda Dencheva wrote:
>
>> Hi,
>>
>> You are running an older version of pywcs.
>> I believe an upgrade to the latest release will fix this.
>>
>>
>> Nadia Dencheva
>>
>> ---- Original message ----
>>> Date: Wed, 6 May 2009 15:30:23 +0900
>>> From: astropy-bounces@scipy.org (on behalf of "OKUMURA, Akira" <oxon@ceres.phys.s.u-tokyo.ac.jp
>>>> )
>>> Subject: [AstroPy] pywcs problem on Linux
>>> To: astropy@scipy.org
>>>
>>> Hello all,
>>>
>>> I have installed pywcs in two environments.
>>> (1) Scientific Linux 4.7 (64 bit)
>>> + Python 2.5.4 (r254:67916, May  6 2009, 07:09:17)
>>> + GCC 3.4.6 20060404 (Red Hat 3.4.6-10)] on linux2
>>> + pyfits-1.3
>>> + pywcs-1.3a1-4.3
>>> (2) Red Hat Enterprise Linux 4 (32 bit).
>>> + Python 2.5.1 (r251:54863, Aug 24 2007, 16:22:50)
>>> + GCC 3.4.3 (TWW)] on linux2
>>> + pywcs-1.3a1-4.3
>>> + pyfits-2.1.1
>>>
>>> But I got following errors even though it runs properly on Mac OS X
>>> 10.5.
>>> === Error on (1) ===
>>>>>> hdulist = pyfits.open("cmap.fits")
>>>>>> wcs = pywcs.WCS(hdulist[0].header)
>>> zsh: segmentation fault  python
>>>
>>> === Error on (2) ===
>>>>>> hdulist = pyfits.open("cmap.fits")
>>>>>> wcs = pywcs.WCS(hdulist[0].header)
>>> Traceback (most recent call last):
>>> File "<stdin>", line 1, in <module>
>>> File "/u/gl/oxon/tmp/lib/python2.5/site-packages/pywcs/pywcs.py",
>>> line 155, in __init__
>>>   self.footprint = self._calcFootprint(header)
>>> File "/u/gl/oxon/tmp/lib/python2.5/site-packages/pywcs/pywcs.py",
>>> line 181, in _calcFootprint
>>>   return self.all_pix2sky(corners)
>>> File "/u/gl/oxon/tmp/lib/python2.5/site-packages/pywcs/pywcs.py",
>>> line 307, in all_pix2sky
>>>   return self._array_converter(self._all_pix2sky, *args, **kwargs)
>>> File "/u/gl/oxon/tmp/lib/python2.5/site-packages/pywcs/pywcs.py",
>>> line 294, in _array_converter
>>>   return func(args[0], **kwargs)
>>> SystemError: Python/getargs.c:1246: bad argument to internal  
>>> function
>>>
>>> Is there any tips on running pywcs with Linux ?
>>>
>>> The FITS is as follows.
>>>
>>>>>> print hdulist[0].header
>>> SIMPLE  =                    T / File conforms to NOST standard
>>> BITPIX  =                   32 / Bits per pixel
>>> NAXIS   =                    2 / No data is associated with this
>>> header
>>> NAXIS1  =                  160 / Length of data axis 1
>>> NAXIS2  =                  160 / Length of data axis 2
>>> EXTEND  =                    T / Extensions may be present
>>> COMMENT   FITS (Flexible Image Transport System) format is defined  
>>> in
>>> 'Astronomy
>>> COMMENT   and Astrophysics', volume 376, page 359; bibcode:
>>> 2001A&A...
>>> 376..359H
>>> CTYPE1  = 'GLON-AIT'           / RA---%%%, %%% represents the
>>> projection method
>>> CRPIX1  =                 80.5 / Reference pixel
>>> CRVAL1  =                 211. / RA at the reference pixel
>>> CDELT1  =                -0.25 / X-axis incr per pixel of physical
>>> coord at posi
>>> CUNIT1  = 'deg     '           / Physical unit of X-axis
>>> CTYPE2  = 'GLAT-AIT'           / DEC---%%%, %%% represents the
>>> projection method
>>> CRPIX2  =                 80.5 / Reference pixel
>>> CRVAL2  =                 -17. / DEC at the reference pixel
>>> CDELT2  =                 0.25 / Y-axis incr per pixel of physical
>>> coord at posi
>>> CUNIT2  = 'deg     '           / Physical unit of Y-axis
>>> CROTA2  =                   0. / Image rotation (deg)
>>> DATE    = '2009-04-01T15:34:22' / file creation date (YYYY-MM-
>>> DDThh:mm:ss U
>>> FILENAME= 'cmap.fits'          /
>>> TELESCOP= 'GLAST   '           /  name of telescope generating data
>>> INSTRUME= 'LAT     '           /  name of instrument generating data
>>> DATE-OBS= '2009-03-11T21:33:18.000' / start date and time of the
>>> observation (U
>>> DATE-END= '2009-03-17T16:26:38.000' / end date and time of the
>>> observation (UTC
>>> NDSKEYS =                    5
>>> EQUINOX =                2000. / Equinox of RA & DEC specifications
>>> OBSERVER= 'Peter Michelson'    /  GLAST/LAT PI
>>> CREATOR = 'gtbin   '           / Software and version creating file
>>> HISTORY                   LatCountMapTemplate,v 1.3 2005/04/05
>>> 21:06:39 peachey
>>> HISTORY Exp
>>> CHECKSUM= 'c8JZf8JXc8JXc8JX'   / HDU checksum updated
>>> 2009-04-01T06:34:22
>>> DATASUM = '182648  '           / data unit checksum updated
>>> 2009-04-01T06:34:22
>>> DSTYP1  = 'TIME    '
>>> DSUNI1  = 's       '
>>> DSVAL1  = 'TABLE   '
>>> DSREF1  = ':GTI    '
>>> DSTYP2  = 'POS(RA,DEC)'
>>> DSUNI2  = 'deg     '
>>> DSVAL2  = 'CIRCLE(86.81257852,-6.005536809,20)'
>>> DSTYP3  = 'CTBCLASSLEVEL'
>>> DSUNI3  = 'dimensionless'
>>> DSVAL3  = '3:      '
>>> DSTYP4  = 'ENERGY  '
>>> DSUNI4  = 'MeV     '
>>> DSVAL4  = '200:20000'
>>> DSTYP5  = 'ZENITH_ANGLE'
>>> DSUNI5  = 'deg     '
>>> DSVAL5  = '0:100   '
>>>
>>>
>>> Regards,
>>>
>>> OKUMURA, Akira oxon@ceres.phys.s.u-tokyo.ac.jp
>>> Department of Physics, The University of Tokyo
>>> 7-3-1 Hongo, Bunkyo-ku, Tokyo 113-0033
>>> TEL/FAX +81 3-5841-4173/4059
>>> Skype : okumura.akira
>>>
>>> _______________________________________________
>>> AstroPy mailing list
>>> AstroPy@scipy.org
>>> http://mail.scipy.org/mailman/listinfo/astropy
>
> _______________________________________________
> AstroPy mailing list
> AstroPy@scipy.org
> http://mail.scipy.org/mailman/listinfo/astropy



More information about the AstroPy mailing list