write_bintabh

This routine is designed to write large (or huge) arrays into a binary table extension of a FITS file. The user can choose to write the array piece by piece. This is designed to deal with Time Ordered Data set (tod).

Location in HEALPix directory tree: src/f90/mod/fitstools.F90 


FORMAT

call write_bintabh( tod, npix, ntod, header, nlheader, filename, [extno, firstpix, repeat] )

Arguments appearing in italic are optional.


ARGUMENTS

name & dimensionality kind in/out description
       
tod(0:npix-1,1:ntod) SP/ DP IN The map or tod to write to the FITS file. It will be written in the file at the location corresponding to pixels (or time samples) firstpix to firtpix + npix -1.
npix I8B IN Number of pixels or time samples in the map or TOD. See Note below.
ntod I4B IN Number of maps or tods to be written. Each of them will be in a different column of the FITS binary table.
header(LEN=80) (1:nlheader) CHR IN The header for the FITS file.
nlheader I4B IN number of header lines to write to the file.
filename(LEN=filenamelen) CHR IN The array is written into a FITS file with this filename.
extno I4B IN extension number in which to write the data (0 based). default:0
firstpix I8B IN 0 Location in the FITS file of the first pixel (or time sample) to be written (0 based). default: 0. See Note below.
repeat I4B IN Length of the element vector used in the binary table. default:1024 if npix $\propto 1024$; 12000 if npix $> 12000$ and 1 otherwise.
Choosing a large repeat for multi-column tables (ntod $>1$) generally speeds up the I/O. It also helps bringing the number of rows of the table under $2^{31}$, which is a hard limit of cfitsio.
If the number of samples or pixels of each map or TOD is not a multiple of repeat, then the last element vector will be padded with sentinel values HPX_SBADVAL or HPX_DBADVAL.
Note : Indices and number of data elements larger than $2^{31}$ are only accessible in FITS files on computers with 64 bit enabled compilers and with some specific compilation options of cfitsio (see cfitsio documentation).


EXAMPLE:

use healpix_types
use fitstools, only : write_bintabh
character(len=80), dimension(1:128) :: hdr
real(SP), dimension(0:49,1) :: tod
character(len=FILENAMELEN) :: fname='tod.fits'
hdr(:) = ' '
tod(:,1) = 1.
call write_bintabh(tod, 50_i8b, 1, hdr, 128, fname, firstpix=0_i8b, repeat=10)
tod = tod * 3.
call write_bintabh(tod, 20_i8b, 1, hdr, 128, fname, firstpix=40_i8b)
Writes into the FITS file `tod.fits' a 1 column binary table, where the first 40 data samples have the value $1.$ and the next 20 have the value $3.$ (Note that in this example the second call to write_bintabh overwrites some of the pixels written by the first call). The samples will be written in element vectors of length 10. The header for the FITS file is given in the string array hdr and its number of lines is 128.


MODULES & ROUTINES

This section lists the modules and routines used by write_bintabh.

fitstools
module, containing:
printerror
routine for printing FITS error messages.
cfitsio
library for FITS file handling.


RELATED ROUTINES

This section lists the routines related to write_bintabh

input_tod*
routine that reads a file created by write_bintabh.
input_map, read_bintab
routines to read HEALPix sky map,
write_minimal_header
routine to write minimal FITS header

Version 3.82, 2022-07-28