cube_save.h

00001 
00002 /*----------------------------------------------------------------------------
00003  *                                  E.S.O.
00004  *----------------------------------------------------------------------------
00005  * File name    :   cube_save.h
00006  * Author       :   Nicolas Devillard
00007  * Created on   :   May 1999
00008  * Language     :   ANSI C
00009  *                  Part of ECLIPSE library for Adonis
00010  * Description  :   save cubes to FITS format
00011  *--------------------------------------------------------------------------*/
00012 
00013 /*
00014 
00015  $Id: cube_save.h,v 1.1 2003/09/03 12:50:47 amodigli Exp $
00016  $Author: amodigli $
00017  $Date: 2003/09/03 12:50:47 $
00018  $Revision: 1.1 $
00019 
00020  */
00021 
00022 #ifndef _CUBE_SAVE_H_
00023 #define _CUBE_SAVE_H_
00024 
00025 
00026 /*----------------------------------------------------------------------------
00027  *                              Includes
00028  *--------------------------------------------------------------------------*/
00029 
00030 #include <stdio.h>
00031 #include <math.h>
00032 #include <limits.h>
00033 
00034 #include "memory.h"
00035 #include "cube_defs.h"
00036 #include "image_handling.h"
00037 #include "conversions.h"
00038 #include "file_handling.h"
00039 #include "simple.h"
00040 #include "fits_rw.h"
00041 
00042 
00043 /*----------------------------------------------------------------------------
00044  *                          Function prototypes
00045  *--------------------------------------------------------------------------*/
00046 
00047 
00048 
00049 /*----------------------------------------------------------------------------
00050    Function :   save_cube_to_fits()
00051    In       :   cube, filename
00052    Out      :   void
00053    Job      :   writes a cube to disk in FITS format
00054    Notice   :   saving with minimal FITS header, prefer
00055                 save_cube_to_fits_hdrcopy() to conserve headers
00056    ---------------------------------------------------------------------------*/
00057 
00058 /* <python> */
00059 void
00060 save_cube_to_fits(  
00061     OneCube *   to_save,
00062     char    *   filename
00063 );
00064 /* </python> */
00065 
00066 
00067 /*----------------------------------------------------------------------------
00068  * Function :   save_cube_to_fits_hdr_dump()
00069  * In       :   cube, filename, FITS header
00070  * Out      :   void
00071  * Job      :   writes a cube to disk in FITS format
00072  * Notice   :   provide a FITS header to save the file with 
00073  *--------------------------------------------------------------------------*/
00074 
00075 /* <python> */
00076 void
00077 save_cube_to_fits_hdr_dump(  
00078     OneCube     *   to_save,
00079     char        *   filename,
00080     fits_header *   fh
00081 );
00082 /* </python> */
00083 
00084 
00085 /*----------------------------------------------------------------------------
00086  * Function :   save_cube_to_fits_hdrcopy()
00087  * In       :   cube, file name, name of the reference file, history to add
00088  * Out      :   void
00089  * Job      :   write out a cube to disk as a FITS file. The header will
00090  *              be a copy of another file which acts as a reference. All
00091  *              keywords of the reference file are copied, except those
00092  *              local to the cube definition (NAXIS, BSCALE, ...)
00093  *              ASCII lists are also accepted, in that case the file
00094  *              used for reference is the first one found in the list.
00095  * Notice   :   author: CDdA, modified from ND
00096  *--------------------------------------------------------------------------*/
00097 
00098 /* <python> */
00099 void save_cube_to_fits_hdrcopy(
00100 OneCube *   to_save, 
00101 char    *   filename,
00102 char    *   ref_file);
00103 /* </python> */
00104 
00105 
00106 
00107 
00108 /*----------------------------------------------------------------------------
00109  * Function :   stuff_with_zeros()
00110  * In       :   name of file to stuff, file size (before stuffing)
00111  * Out      :   void
00112  * Job      :   appends zeroes to a file until the size is a multiple of
00113  *              FITS_BLOCK_SIZE (see FITS norm about that).
00114  * Notice   :
00115  *--------------------------------------------------------------------------*/
00116 
00117 void 
00118 stuff_with_zeros(
00119     char    *   filename,
00120     size_t      size_before
00121 );
00122 
00123 
00124 
00125 /*----------------------------------------------------------------------------
00126  * Function :   append_image_data_to_fits_file()
00127  * In       :   file name, 1 image, pixel type
00128  * Out      :   error code 0 if ok, -1 otherwise
00129  * Job      :   append an image data to a FITS file, with the requested
00130  *              pixeltype.
00131  * Notice   :
00132  *--------------------------------------------------------------------------*/
00133 
00134 int append_image_data_to_fits_file(
00135     char            *   filename,
00136     OneImage        *   appended,
00137     int                 pixtype
00138 );
00139 
00140 
00141 
00142 /*----------------------------------------------------------------------------
00143  * Function :   append_data_to_fits_file()
00144  * In       :   file name, pointer to a list of pixelvalues, number of
00145  *              pixels, pixel type.
00146  * Out      :   error code 0 if ok, -1 otherwise
00147  * Job      :   appends pixels to a fits file, in a given pixeltype
00148  * Notice   :   author: CDdA modified from ND
00149  *--------------------------------------------------------------------------*/
00150 
00151 int
00152 append_data_to_fits_file(
00153     char        *   filename, 
00154     pixelvalue  *   pix_data, 
00155     size_t          npts, 
00156     int             pixtype);
00157 
00158 
00159 
00160 
00161 /*----------------------------------------------------------------------------
00162  * Function :   output_fits_header()
00163  * In       :   1 cube, filename, pixel type
00164  * Out      :   error code 0 if ok, -1 otherwise
00165  * Job      :   creates a simple FITS header and outputs it to a file
00166  * Notice   :   file is always overwritten
00167  *              this is used to make temporary data files
00168  *--------------------------------------------------------------------------*/
00169 
00170 int
00171 output_fits_header(
00172     OneCube     *   cube1,
00173     char        *   filename
00174 );
00175 
00176 
00177 /*----------------------------------------------------------------------------
00178  * Function :   save_fits_header()
00179  * In       :   1 cube, out file name, fits header
00180  * Out      :   error code 0 if Ok, -1 otherwise
00181  * Job      :   a FITS header is written to disk. It contains all
00182  *              ancillary information taken from the input FITS header,
00183  *              and all local information to the input cube.
00184  * Notice   :
00185  *              This function makes sure a FITS header is carried along
00186  *              by a command. By providing a reference FITS file, all
00187  *              ancillary informations are transferred to the new file.
00188  *              Information local to the new file is conserved (NAXIS?,
00189  *              BITPIX, BSCALE, etc.).
00190  *
00191  *              File is always overwritten
00192  *
00193  *              author: CDdA modified from ND
00194  *--------------------------------------------------------------------------*/
00195 
00196 int save_fits_header(
00197     OneCube     *   cube1, 
00198     char        *   filename, 
00199     fits_header *   fh);
00200 
00201 
00202 /*----------------------------------------------------------------------------
00203  * Function :   write_history_in_header()
00204  * In       :   fits header, comments
00205  * Out      :   void
00206  * Out      :   write out comment into a fits header structure
00207  * Notice   :
00208  *--------------------------------------------------------------------------*/
00209 
00210 void 
00211 write_history_in_header(
00212     fits_header  *  fh,
00213     char         *  history,
00214     int             n_comments
00215 );
00216 
00217 /*----------------------------------------------------------------------------
00218  * Function :   add_cube_comment()
00219  * In       :   character string, 1 cube
00220  * Out      :   void
00221  * Job      :   add a comment into history field of a cube
00222  * Notice   :   this comment will make its way to the output FITS header
00223  *              when the cube is saved.
00224  *--------------------------------------------------------------------------*/
00225 
00226 void 
00227 add_cube_comment(
00228     OneCube *   cube1,
00229     char    *   comment_to_add
00230 );
00231 
00232 
00233 #endif

Generated on Wed Oct 26 13:08:52 2005 for SINFONI Pipeline Reference Manual by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001