Version 0.3.8  

The S-Lang CFITSIO Module Page

 

The CFITSIO library consists of a set of functions for reading and writing FITS files. The S-Lang CFITSIO module wraps many of the functions of the CFITSIO library and permits one to easily manipulate FITS files from the S-Lang interpreter.

The module consists of a high-level interface and a low-level one. The high-level interface makes use of the low-level functions to perform common tasks. For example, consider the job of binning the X and Y columns from a binary table into an image and saving the result to a FITS file with the proper WCS:

    infile = "evt2.fits[EVENTS]"; outfile = "img.fits";
    (y,x) = fits_read_col (infile, "Y", "X");
    wcs = fitswcs_get_column_wcs (infile, ["Y","X"]);
    xgrid = [0:8192:8]; ygrid = [0:8192:8];
    img = hist2d (y,x,ygrid,xgrid);
    fits_write_image_hdu (outfile, NULL, img);
    wcs = fitswcs_rebin_wcs (wcs, ygrid, xgrid);
    fitswcs_write_img_wcs (outfile, wcs);

Here, the histogram module's hist2d function was used to bin the image. As the example also indicates, the cfitsio module includes routines to manipulate FITS World Coordinate Systems (WCS).


This page was last updated Apr 26, 2007 by John E. Davis. To comment on it or the material presented here, send email to davis at space mit edu.
Valid HTML 4.01! Made with JED Viewable With Any Browser