#include "spherehealpix.h" #include "fitsspherehealpix.h" #include "fitstarray.h" #include "tmatrix.h" //........................... int m=...; SphereHEALPix<r_8> sph(m); ................ int dim1=...; int dim2=...; TMatrix<r_8> mat(dim1,dim2); ............ FITS_SphereHEALPix<r_8> sph_temp(sph); FITS_TArray<r_8> mat_temp(mat); // writing FitsOutFile os("myfile.fits"); sph_temp.Write(os); mat_temp.Write(os); // reading FitsInFile is("myfile.fits"); sph_temp.Read(is); mat_temp.Read(is); SphereHEALPix<r_8> new_sph=(SphereHEALPix<r_8>)sph_temp; TMatrix<r_8> new_mat=(TMatrix<r_8>)mat_temp; ................
The operators operator << (FitsOutFile ...) and operator >> (FitsInFile ...) are defined in order to facilitate the FITS file operations:
// Writing an array object to a FITS file #include "fitstarray.h" FitsOutFile fio("arr.fits"); Matrix m(20,30); m = 12345.; fio << m; // ..... // Reading a binary table to a XNTuple #include "fitsxntuple.h" XNTuple xn; FitsInFile fii("table.fits"); fii >> xn;