Extracting a sub-cube from a cube [message #93403] |
Tue, 05 July 2016 16:13  |
Miguel
Messages: 18 Registered: April 2015
|
Junior Member |
|
|
Hi,
I have a data cube with longitude, latitude and velocity and I wanted to know if there was a good alternative to the hextract routine but for data cube ?
Moreover, is it possible to use hextract for a velocity-latitude 2-D array (in short, a 2D fits file whose CTYPE1-2 are not longitude and latitude)and update the header ? I manage to extract the area I wanted but the WCS keywords disappear after the extraction.
Thank you
Miguel
|
|
|
Re: Extracting a sub-cube from a cube [message #93404 is a reply to message #93403] |
Wed, 06 July 2016 07:03  |
wlandsman
Messages: 743 Registered: June 2000
|
Senior Member |
|
|
On Tuesday, July 5, 2016 at 7:13:29 PM UTC-4, miguelfigue...@gmail.com wrote:
>
> Moreover, is it possible to use hextract for a velocity-latitude 2-D array (in short, a 2D fits file whose CTYPE1-2 are not longitude and latitude)and update the header ? I manage to extract the area I wanted but the WCS keywords disappear after the extraction.
>
I don't know of any existing routines in the Astronomy library to do this, but it is not hard to do it yourself. The FITS format describes a linear velocity scale with a reference pixel (CRPIX1) and value at the reference pixel (CRVAL1), and increment per pixel (CDELT1). When you extract a subarray you are just shifting the origin so CDELT1 doesn't change. You just need to update CRPIX1 so it accounts for the offset. So if you extract starting at pixel 30, you just need to subtract 30 from CRPIX1 (using sxaddpar for example).
|
|
|