<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On 18 October 2013 14:01, Thomas Robitaille <span dir="ltr"><<a href="mailto:thomas.robitaille@gmail.com" target="_blank">thomas.robitaille@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">In the Astropy routine, you need to take care to set the origin<br>
correctly (the last argument in the call to all_pix2world) - if it is<br>
set to zero, the pixel coordinates have to be zero based (the bottom<br>
left corner of the FITS image is then (0,0)). Tools such as ds9 assume<br>
the bottom left corner is (1,1). Since you mention a 1 pixel offset, I<br>
thought it could be related to this.</blockquote><div><br></div><div style>Thanks for the tip. That indeed clears up the discrepancy.</div><div> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Does AST always assume the pixel<br>
values are 1-based?<br>
<br></blockquote><div style><br></div><div style>It all depends on the context. The FitsChan class takes in a set of FITS headers and spits out a network of Frames with interconnecting Mappings (a.k.a. "FrameSet"). One Frame represents pixel coordinates, and the others represent the primary and alternate world coordinate systems. In this context, a position of (1,1) in the pixel frame corresponds to the first pixel in the data array, because that's the convention used by FITS. For instance, this means that a pixel position of (crpix1,crpix2) gets mapped onto a world position of (crval1,crval2), as required by the published FITS-WCS papers.</div>
<div><br></div><div style>On the other hand, there is nothing to stop a user from adding a second pixel frame into this FrameSet to define some alternative pixel coordinate system that is shifted with respect to FITS pixel coordinates.</div>
<div style><br></div><div style>Indeed, this is *exactly* what is done by the NDF data format that has been in use by Starlink for 20 plus years. It defines two pixel coordinate systems - "GRID" coordinates in which the first pixel has coords (1,1) (i.e. the usual FITS definition), and "PIXEL" coordinates which is shifted by an arbitrary amount with respect to GRID coords. The NDF format uses AST to record the transformation between these two systems, and all the other coordinate systems it knows about. For instance, this means that if you take a cut-out of an image, then the user can there-after choose to refer to pixels within the cut-out using either their offset from first pixel in the cut-out (i.e. GRID coords), or their offset from the first pixel in the in the original image (PIXEL coords). </div>
<div style><br></div><div style>So the bottom line is that AST allows you to put the origin of pixels coords where ever you want.</div><div style><br></div><div style>David</div><div><br></div><div><br></div><div> </div></div>
</div></div>