Exemple #1
0
/***********************************************************************//**
 * @brief Print table information
 ***************************************************************************/
std::string GFitsTable::print(void) const
{
    // Initialise result string
    std::string result;

    // Append header
    result.append("=== GFitsTable ===\n");

    // Append HDU information
    result.append(print_hdu());

    // Append table type
    result.append(parformat("Table type"));
    switch (m_type) {
    case GFitsHDU::HT_ASCII_TABLE:
        result.append("ASCII table\n");
        break;
    case GFitsHDU::HT_BIN_TABLE:
        result.append("Binary table\n");
        break;
    default:
        result.append("Unknown\n");
        break;
    }

    // Append table dimensions
    result.append(parformat("Number of rows")+str(m_rows)+"\n");
    result.append(parformat("Number of columns")+str(m_cols)+"\n");

    // Append header information
    result.append(m_header.print());

    // Append table columns
    if (m_columns != NULL) {
        for (int i = 0; i < m_cols; ++i) {
            result.append("\n");
            if (m_columns[i] != NULL)
                result.append(m_columns[i]->print());
            else
                result.append(" Column "+str(i)+" undefined");
        }
    }
    else
        result.append(" Table columns undefined");

    // Return result
    return result;
}
Exemple #2
0
/***********************************************************************//**
 * @brief Print column information
 *
 * @param[in] chatter Chattiness.
 * @return String containing column information.
 *
 * @todo Format and cfitsio information is mainly for debugging. This could
 * be vanish in a more stable version of the code, or it could be compiled
 * in conditionally using a debug option.
 ***************************************************************************/
std::string GFitsImage::print(const GChatter& chatter) const
{
    // Initialise result string
    std::string result;

    // Continue only if chatter is not silent
    if (chatter != SILENT) {

        // Append header
        result.append("=== GFitsImage ===");

        // Append HDU information
        result.append("\n"+print_hdu(chatter));

        // Append image dimensions
        result.append("\n"+gammalib::parformat("Image type"));
        result.append(typecode(type()));
        result.append("\n"+gammalib::parformat("Number of dimensions"));
        result.append(gammalib::str(naxis()));
        result.append("\n"+gammalib::parformat("Number of image pixels"));
        result.append(gammalib::str(npix()));
        for (int i = 0; i < naxis(); ++i) {
            result.append("\n"+gammalib::parformat("Number of bins in "+gammalib::str(i)));
            result.append(gammalib::str(naxes(i)));
        }

        // NORMAL: Append header information
        if (chatter >= NORMAL) {
            result.append(+"\n"+m_header.print(gammalib::reduce(chatter)));
        }

    } // endif: chatter was not silent

    // Return result
    return result;
}