<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<br>
<div class="moz-cite-prefix">On 17/10/13 08:54, David Berry wrote:<br>
</div>
<blockquote
cite="mid:CAALafn6Njodzr4U8nZ9MRtNTp64dOV576c3sYBvSiaK+CLAtgg@mail.gmail.com"
type="cite">
<div dir="ltr">AST attempts to speed up this sort of thing by
using a recursive scheme as follows:
<div class="gmail_extra">
<div class="gmail_quote">...
<div style="">This means that for typical mappings that are
locally smooth, you are usually using a very simple and
fast linear transformation for each point rather than the
full might of the complete pixel->wcs mapping. Clearly,
you need to set some limit to the depth of recursion - we
use the criterion that the number of pixels in the pane
must be at least 4 times the number of points needed to do
the linear fit. </div>
<div style=""><br>
</div>
<div style="">The user specifies the accuracy with which the
points are to be found, and this determines the maximum
acceptable residuals for the fit. If the residuals are
higher, the pane is subdivided.</div>
<div style=""><br>
</div>
<div style="">See for instance <a moz-do-not-send="true"
href="http://starlink.jach.hawaii.edu/devdocs/sun211.htx/node430.html">http://starlink.jach.hawaii.edu/devdocs/sun211.htx/node430.html</a></div>
</div>
</div>
</div>
</blockquote>
<br>
I tried to use trangrid (with starlink-pyast) but I must be doing
something wrong:<br>
<br>
width = hdulist[0].header['NAXIS1']<br>
height = hdulist[0].header['NAXIS2']<br>
(wcs,_) = starlink.Atl.readfitswcs(hdulist[0])<br>
mapping = wcs.getmapping( starlink.Ast.BASE, starlink.Ast.CURRENT )<br>
print mapping.trangrid([0,0],[width-1,height-1])<br>
<br>
[[-0.69877269 -0.69914315 -0.69951373 ..., -1.22724324 -1.22756251<br>
-1.22788175]<br>
[ 0.83534859 0.83540118 0.83545372 ..., 0.5841799 0.58413968<br>
0.58409942]]<br>
<br>
I am expecting coordinates ranging from 320..285 for RA and 48..33
for Dec.<br>
<br>
For comparison, my astropy code looks like that:<br>
<br>
wcs = WCS(hdulist[0].header)<br>
x, y = np.meshgrid(np.arange(width), np.arange(height)) <br>
ra, dec = wcs.wcs_pix2world(x, y, 0)<br>
<br>
Cheers<br>
Maik<br>
<br>
<blockquote
cite="mid:CAALafn6Njodzr4U8nZ9MRtNTp64dOV576c3sYBvSiaK+CLAtgg@mail.gmail.com"
type="cite">
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">
<div style="">
David</div>
<div><br>
</div>
<div> </div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Cheers,<br>
Tom<br>
<br>
><br>
> Maik<br>
><br>
><br>
> On 16/10/13 15:15, Thomas Robitaille wrote:<br>
>><br>
>> Hi Maik,<br>
>><br>
>> Someone asked a very similar question just
yesterday on GitHub:<br>
>><br>
>> <a moz-do-not-send="true"
href="https://github.com/astropy/astropy/issues/1587"
target="_blank">https://github.com/astropy/astropy/issues/1587</a><br>
>><br>
>> In short, the solution in your case is:<br>
>><br>
>> NAXIS1 = 4256<br>
>> NAXIS2 = 2832<br>
>> x = np.arange(NAXIS1)<br>
>> y = np.arange(NAXIS2)<br>
>> X, Y = np.meshgrid(x, y)<br>
>> ra, dec = wcs.wcs_pix2world(X, Y, 0)<br>
>><br>
>> Any luck?<br>
>><br>
>> Tom<br>
>><br>
>><br>
>><br>
>><br>
>> On 16 October 2013 14:48, Maik Riechert <<a
moz-do-not-send="true"
href="mailto:maik.riechert@arcor.de">maik.riechert@arcor.de</a>>
wrote:<br>
>>><br>
>>> Hi,<br>
>>><br>
>>> I'm quite new to python and astropy and got
stuck at the following which<br>
>>> probably is extremely easy to do.<br>
>>><br>
>>> I created a WCS object out of a FITS header
and wanted to get the RA/Dec<br>
>>> coordinates of each image pixel. I tried:<br>
>>><br>
>>> w.wcs_pix2world(np.ndindex(4256, 2832), 0)<br>
>>><br>
>>> where 4256x2832 are the image dimensions.
This returns 'ValueError:<br>
>>> object of too small depth for desired array'.
I was trying to avoid<br>
>>> allocating an array with all pixel
coordinates and thought an iterator<br>
>>> would work too.<br>
>>><br>
>>> What would you recommend for my case
(translating every pixel)?<br>
>>><br>
>>> Cheers and thanks,<br>
>>> Maik<br>
>>><br>
>>><br>
>>>
_______________________________________________<br>
>>> AstroPy mailing list<br>
>>> <a moz-do-not-send="true"
href="mailto:AstroPy@scipy.org">AstroPy@scipy.org</a><br>
>>> <a moz-do-not-send="true"
href="http://mail.scipy.org/mailman/listinfo/astropy"
target="_blank">http://mail.scipy.org/mailman/listinfo/astropy</a><br>
><br>
><br>
_______________________________________________<br>
AstroPy mailing list<br>
<a moz-do-not-send="true" href="mailto:AstroPy@scipy.org">AstroPy@scipy.org</a><br>
<a moz-do-not-send="true"
href="http://mail.scipy.org/mailman/listinfo/astropy"
target="_blank">http://mail.scipy.org/mailman/listinfo/astropy</a><br>
</blockquote>
</div>
<br>
</div>
</div>
</blockquote>
<br>
</body>
</html>