Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

funflush(3) [debian man page]

funflush(3)							SAORD Documentation						       funflush(3)

NAME
FunFlush - flush data to output file SYNOPSIS
#include <funtools.h> void FunFlush(Fun fun, char *plist) DESCRIPTION
The FunFlush routine will flush data to a FITS output file. In particular, it can be called after all rows have been written (using the FunTableRowPut() routine) in order to add the null padding that is required to complete a FITS block. It also should be called after com- pletely writing an image using FunImagePut() or after writing the final row of an image using FunTableRowPut(). The plist (i.e., parameter list) argument is a string containing one or more comma-delimited keyword=value parameters. If the plist string contains the parameter "copy=remainder" and the file was opened with a reference file, which, in turn, was opened for extension copying (i.e. the input FunOpen() mode also was "c" or "C"), then FunFlush also will copy the remainder of the FITS extensions from the input ref- erence file to the output file. This normally would be done only at the end of processing. Note that FunFlush() is called with "copy=remainder" in the mode string by FunClose(). This means that if you close the output file before the reference input file, it is not necessary to call FunFlush() explicitly, unless you are writing more than one extension. See the evmerge example code. However, it is safe to call FunFlush() more than once without fear of re-writing either the padding or the copied extensions. In addition, if FunFlush() is called on an output file with the plist set to "copy=reference" and if the file was opened with a reference file, the reference extension is written to the output file. This mechanism provides a simple way to copy input extensions to an output file without processing the former. For example, in the code fragment below, an input extension is set to be the reference file for a newly opened output extension. If that reference extension is not a binary table, it is written to the output file: /* process each input extension in turn */ for(ext=0; ;ext++){ /* get new extension name */ sprintf(tbuf, "%s[%d]", argv[1], ext); /* open input extension -- if we cannot open it, we are done */ if( !(ifun=FunOpen(tbuf, "r", NULL)) ) break; /* make the new extension the reference handle for the output file */ FunInfoPut(ofun, FUN_IFUN, &ifun, 0); /* if its not a binary table, just write it out */ if( !(s=FunParamGets(ifun, "XTENSION", 0, NULL, &got)) || strcmp(s, "BINTABLE")){ if( s ) free(s); FunFlush(ofun, "copy=reference"); FunClose(ifun); continue; } else{ /* process binary table */ .... } } SEE ALSO
See funtools(7) for a list of Funtools help pages version 1.4.2 January 2, 2008 funflush(3)

Check Out this Related Man Page

funimageput(3)							SAORD Documentation						    funimageput(3)

NAME
FunImagePut - put an image to a Funtools file SYNOPSIS
#include <funtools.h> int FunImagePut(Fun fun, void *buf, int dim1, int dim2, int bitpix, char *plist) DESCRIPTION
The FunImagePut() routine outputs an image array to a FITS file. The image is written either as a primary header/data unit or as an image extension, depending on whether other data have already been written to the file. That is, if the current file position is at the begin- ning of the file, a primary HDU is written. Otherwise, an image extension is written. The first argument is the Funtools handle returned by FunOpen(). The second buf argument is a pointer to a data buffer to write. The dim1and dim2 arguments that follow specify the dimensions of the image, where dim1 corresponds to naxis1 and dim2 corresponds to naxis2. The bitpix argument specifies the data type of the image and can have the following FITS-standard values: o 8 unsigned char o 16 short o 32 int o -32 float o -64 double When FunTableRowPut() is first called for a given image, Funtools checks to see if the primary header has already been written (by having previously written an image or a binary table.) If not, this image is written to the primary HDU. Otherwise, it is written to an image extension. Thus, a simple program to generate a FITS image might look like this: int i; int dim1=512, dim2=512; double *dbuf; Fun fun; dbuf = malloc(dim1*dim2*sizeof(double)); /* open the output FITS image, preparing to copy input params */ if( !(fun = FunOpen(argv[1], "w", NULL)) ) gerror(stderr, "could not FunOpen output file: %s ", argv[1]); for(i=0; i<(dim1*dim2); i++){ ... fill dbuf ... } /* put the image (header will be generated automatically */ if( !FunImagePut(fun, buf, dim1, dim2, -64, NULL) ) gerror(stderr, "could not FunImagePut: %s ", argv[1]); FunClose(fun); free(dbuf); In addition, if a Funtools reference handle was specified when this table was opened, the parameters from this Funtools reference handle are merged into the new image header. Furthermore, if a reference image was specified during FunOpen(), the values of dim1, dim2, and bit- pix in the calling sequence can all be set to 0. In this case, default values are taken from the reference image section. This is useful if you are reading an image section in its native data format, processing it, and then writing that section to a new FITS file. See the imblank example code. The data are assumed to be in the native machine format and will automatically be swapped to FITS big-endian format if necessary. This behavior can be over-ridden with the convert=[true|false] keyword in the plist param list string. When you are finished writing the image, you should call FunFlush() to write out the FITS image padding. However, this is not necessary if you subsequently call FunClose() without doing any other I/O to the FITS file. SEE ALSO
See funtools(7) for a list of Funtools help pages version 1.4.2 January 2, 2008 funimageput(3)
Man Page

Featured Tech Videos