Reply to topic  [ 1 post ] 
Changes in FITS support 
Author Message
Yorick Guru

Joined: Wed Nov 24, 2004 12:51 pm
Posts: 97
Location: Observatoire de Lyon (France)
Post Changes in FITS support
The last CVS version of fits.i adds some new features:
    * Very basic handling of HIERARCH keywords (thanks to Thibaut Paumard).
    * Formatting of real values changed to improve readability of FITS headers, for instance "0.0" instead of "0.0000000000000E+00".
    * New functions fits_copy_header, fits_copy_data and fits_copy_hdu which can be used to edit FITS files.
For instance, to copy a complete FITS file with (minor) editing of the headers:
Code:
// Open input and output FITS files:
src = fits_open("input.fits");
dst = fits_open("output.fits", 'w');

// Copy & edit primary HDU:
fits_copy_header, dst, src;
fits_set, dst, "HISTORY", "This primary HDU is a copy.";
fits_write_header, dst;
fits_copy_data, dst, src;

// Copy & edit extensions:
while (! fits_eof(fits_next_hdu(src))) {
    fits_new_hdu, dst, "";  // add undefined extension
    fits_copy_header, dst, src;
    fits_set, dst, "HISTORY", "This extension HDU is also a copy.";
    fits_write_header, dst;
    fits_copy_data, dst, src;
}

// Close files (most important for the destination):
fits_close, src;
fits_close, dst;

Please note that to edit HDU headers with these functions, you are not limited to supported extensions (IMAGE and BINTABLE at this time) because data are copied verbatim.

Enjoy!

Eric.


Tue Sep 30, 2008 6:16 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 1 post ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.