comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: WCS Coordinates not kept with WRITEFITS
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: WCS Coordinates not kept with WRITEFITS [message #68979] Thu, 10 December 2009 07:30 Go to next message
Bringfried Stecklum is currently offline  Bringfried Stecklum
Messages: 75
Registered: January 1996
Member
Laurence wrote:
> Hi,
> I am writing because I have a problem while creating new fits files
> and I could not find any similar topic on the web.
> Basically, I simply cut a small region from a larger fit file and save
> it with writefits .
>
> im1=readfits('pp.fit',hdr)
> temp1='p.fit'
> imnew1=fltarr(2000,2000)
> imnew1=im1(3303:3512,3095:3293)
> writefits,temp1,imnew1,hdr
>
> But in the newly created .fit file, the coordinates are off and then
> wrong !
> Is there a way to solve this ? (I have idl_6.0 )
>
> Thanks,
Of course, since the header needs to be updated as well to account for the size
and WCS change. The routine hextract from the IDL Astro Lib does the job of
extracting FITS subimages, see

http://idlastro.gsfc.nasa.gov/ftp/pro/astrom/hextract.pro

Regards,

Bringfried
Re: WCS Coordinates not kept with WRITEFITS [message #68980 is a reply to message #68979] Thu, 10 December 2009 07:30 Go to previous messageGo to next message
jeanh is currently offline  jeanh
Messages: 79
Registered: November 2009
Member
Laurence wrote:
> Hi,
> I am writing because I have a problem while creating new fits files
> and I could not find any similar topic on the web.
> Basically, I simply cut a small region from a larger fit file and save
> it with writefits .
>
> im1=readfits('pp.fit',hdr)
> temp1='p.fit'
> imnew1=fltarr(2000,2000)
> imnew1=im1(3303:3512,3095:3293)
> writefits,temp1,imnew1,hdr
>
> But in the newly created .fit file, the coordinates are off and then
> wrong !
> Is there a way to solve this ? (I have idl_6.0 )
>
> Thanks,

Hi,

you are saving the header of your big file along with the data of your
small file... it can not work. You would have to update the header
information (sorry, I don't use fits files so I can't help you on this
one). Mainly, the new coordinate of your top left (could be another
corner) corner is needed, as the resolution and map info should be the
same.

Jean
Re: WCS Coordinates not kept with WRITEFITS [message #69060 is a reply to message #68979] Tue, 15 December 2009 11:02 Go to previous message
Laurence is currently offline  Laurence
Messages: 2
Registered: December 2009
Junior Member
On Dec 10, 3:30 pm, Bringfried Stecklum <steck...@tls-tautenburg.de>
wrote:
> Laurencewrote:
>> Hi,
>> I am writing because I have a problem while creating new fits files
>> and I could not find any similar topic on the web.
>> Basically, I simply cut a small region from a larger fit file and save
>> it with writefits .
>
>> im1=readfits('pp.fit',hdr)
>> temp1='p.fit'
>> imnew1=fltarr(2000,2000)
>> imnew1=im1(3303:3512,3095:3293)
>> writefits,temp1,imnew1,hdr
>
>> But in the newly created .fit file, the coordinates are off and then
>> wrong !
>> Is there a way to solve this ? (I have idl_6.0 )
>
>> Thanks,
>
> Of course, since the header needs to be updated as well to account for the size
> and WCS change. The routine hextract from the IDL Astro Lib does the job of
> extracting FITS subimages, see
>
> http://idlastro.gsfc.nasa.gov/ftp/pro/astrom/hextract.pro
>
> Regards,
>
> Bringfried


Thanks! In the meanwhile I used IRAF which works very well .

Laurence
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: ittlicense crash
Next Topic: significant digits represented with plot

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:08:05 PDT 2025

Total time taken to generate the page: 0.00545 seconds