CosmoBolognaLib
Free Software C++/Python libraries for cosmological calculations
cbl::wrapper::ccfits Namespace Reference

The namespace of the FITS wrappers More...

Functions

std::vector< std::vector< double > > read_table_fits (const std::string input_fits, const std::vector< std::string > column_names, const int next=1, const double fill_value=cbl::par::defaultDouble)
 function to read a table from a fits file More...
 
void write_table_fits (const std::string output_dir, const std::string file_fits, const std::vector< std::string > column_names, const std::vector< std::vector< double >> table, const std::vector< std::string > column_units={})
 function that writes a table on a fits file More...
 

Detailed Description

The namespace of the FITS wrappers

The FITS namespace contains all the wrapper functions of the FITS routines.

The CCfits headers are expected to be installed in a subdirectory of the include path. The <CCfits> header file contains all that is necessary to use both the CCfits library and the cfitsio library (for example, it includes fitsio.h), thus making all of cfitsio's macro definitions available.

<CCfits/CCfits> includes 12 of the CCfits headers and will support all CCfits operations. The installed location of the library headers is /include/CCfits to use the library either add -I/include/CCfits or # include <CCfits/CCfits> in the compilation target.

Function Documentation

◆ read_table_fits()

vector< vector< double > > cbl::wrapper::ccfits::read_table_fits ( const std::string  input_fits,
const std::vector< std::string >  column_names,
const int  next = 1,
const double  fill_value = cbl::par::defaultDouble 
)

function to read a table from a fits file

This function searches for columns indicated in column_names and reads them. If one or more columns are not found in the selected extension, the output is filled with user-defined value(s). If no column is found, an error is raised.

Parameters
input_fitsname of the input fits file
column_namesvector containing the columns to read
nextthe number of the extension
fill_valueif a column is not found, the column vector is filled with the value specified in fill_value; if no column is found, an error is raised
Returns
vector containing the columns
Examples
fits.cpp.

Definition at line 45 of file FITSwrapper.cpp.

◆ write_table_fits()

void cbl::wrapper::ccfits::write_table_fits ( const std::string  output_dir,
const std::string  file_fits,
const std::vector< std::string >  column_names,
const std::vector< std::vector< double >>  table,
const std::vector< std::string >  column_units = {} 
)

function that writes a table on a fits file

This function writes columns in a binary table on a FITS file

Parameters
output_diroutput directory
file_fitsname of the file fits
column_namesvector containing the column names to write
tablevector containing the columns
column_unitsvector containing the column units
Examples
fits.cpp.

Definition at line 88 of file FITSwrapper.cpp.