|
mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]
|
FITS file utilities and wrappers.
Functions | |
| static constexpr error_t | mx::fits_status2error_t (const int &err) |
| Convert a FITS status code to error_t. | |
| template<typename dataT, class fitsHeaderT> | |
| error_t | mx::fits::headersToValues (std::vector< dataT > &v, std::vector< size_t > &bad, std::vector< fitsHeaderT > &heads, const std::string &keyw) |
| Convert the values in a std::vector of fits headers into a std::vector of values. | |
| template<class fitsHeaderT> | |
| void | mx::fits::fitsHeaderGitStatus (fitsHeaderT &head, const std::string &repoName, const char *sha1, int modified) |
| Write the status of a Git repository to HISTORY in a FITS header. | |
| template<typename scalarT> | |
| constexpr int | mx::fits::fitsType () |
| Return the cfitsio constant for a given data type. | |
| template<typename typeT> | |
| mx::error_t | mx::fits::fits_write_key (fitsfile *fptr, char *keyword, void *value, char *comment) |
| Write a header card to a file. | |
| template<typename scalarT> | |
| constexpr int | mx::fits::fitsBITPIX () |
| int | mx::fits::fitsStripApost (std::string &s) |
| Strip the apostrophes from a FITS value string. | |
| void | mx::fits::fitsPopulateCard (char headStr[81], char *keyword, char *value, char *comment) |
| Populate a fits header card with the value string copied verbatim. | |
| template<> | |
| mx::error_t | mx::fits::fits_write_key< bool > (fitsfile *fptr, char *keyword, void *value, char *comment) |
| Specialization to handle the case bool. | |
|
staticconstexpr |
Convert a FITS status code to error_t.
| [in] | err | the fits status code to convert |
Definition at line 2219 of file error_t.hpp.
References error, fits_angle_too_big, fits_approx_wcs_key, fits_array_too_big, fits_bad_atable_format, fits_bad_bitpix, fits_bad_btable_format, fits_bad_c2d, fits_bad_c2f, fits_bad_c2i, fits_bad_col_num, fits_bad_data_fill, fits_bad_datatype, fits_bad_date, fits_bad_decim, fits_bad_dimen, fits_bad_doublekey, fits_bad_elem_num, fits_bad_f2c, fits_bad_fileptr, fits_bad_floatkey, fits_bad_gcount, fits_bad_group_attach, fits_bad_group_detach, fits_bad_group_id, fits_bad_hdu_num, fits_bad_header_fill, fits_bad_heap_ptr, fits_bad_i2c, fits_bad_index_key, fits_bad_intkey, fits_bad_keychar, fits_bad_logicalkey, fits_bad_naxes, fits_bad_naxis, fits_bad_nettimeout, fits_bad_option, fits_bad_order, fits_bad_pcount, fits_bad_pix_num, fits_bad_row_num, fits_bad_row_width, fits_bad_simple, fits_bad_tbcol, fits_bad_tdim, fits_bad_tfields, fits_bad_tform, fits_bad_tform_dtype, fits_bad_url_prefix, fits_bad_wcs_proj, fits_bad_wcs_val, fits_col_not_found, fits_col_not_unique, fits_col_too_wide, fits_data_compression_err, fits_data_decompression_err, fits_driver_init_failed, fits_end_junk, fits_end_of_file, fits_file_not_closed, fits_file_not_created, fits_file_not_opened, fits_group_not_found, fits_hdu_already_member, fits_hdu_already_tracked, fits_header_not_empty, fits_identical_pointers, fits_key_no_exist, fits_key_out_bounds, fits_member_not_found, fits_memory_allocation, fits_neg_axis, fits_neg_bytes, fits_neg_file_pos, fits_neg_rows, fits_neg_width, fits_ngp_bad_arg, fits_ngp_empty_curline, fits_ngp_eof, fits_ngp_err_fopen, fits_ngp_inc_nesting, fits_ngp_no_memory, fits_ngp_nul_ptr, fits_ngp_read_err, fits_ngp_token_not_expect, fits_ngp_unread_queue_full, fits_no_bitpix, fits_no_end, fits_no_gcount, fits_no_matching_driver, fits_no_naxes, fits_no_naxis, fits_no_null, fits_no_pcount, fits_no_quote, fits_no_simple, fits_no_tbcol, fits_no_tfields, fits_no_tform, fits_no_wcs_key, fits_no_xtension, fits_not_ascii_col, fits_not_atable, fits_not_btable, fits_not_group_table, fits_not_image, fits_not_logical_col, fits_not_pos_int, fits_not_table, fits_not_vari_len, fits_null_input_ptr, fits_num_overflow, fits_parse_bad_col, fits_parse_bad_output, fits_parse_bad_type, fits_parse_lrg_vector, fits_parse_no_output, fits_parse_syntax_err, fits_range_parse_error, fits_read_error, fits_readonly_file, fits_same_file, fits_seek_error, fits_shared_again, fits_shared_badarg, fits_shared_ipcerr, fits_shared_nofile, fits_shared_nomem, fits_shared_noresize, fits_shared_notinit, fits_shared_nulptr, fits_shared_tabfull, fits_too_many_drivers, fits_too_many_files, fits_too_many_hdus_tracked, fits_unknown_ext, fits_unknown_rec, fits_url_parse_error, fits_value_undefined, fits_wcs_error, fits_write_error, fits_zero_scale, and noerror.
Referenced by mx::fits::fitsFile< dataT, verboseT >::close(), mx::fits::fits_write_key(), mx::fits::fits_write_key< bool >(), mx::fits::fitsFile< dataT, verboseT >::open(), mx::fits::fitsFile< dataT, verboseT >::read(), mx::fits::fitsFile< dataT, verboseT >::read(), mx::fits::fitsFile< dataT, verboseT >::read(), mx::fits::fitsFile< dataT, verboseT >::readHeader(), unitTest::errorTest::error_tTest::TEST_CASE(), and mx::fits::fitsFile< dataT, verboseT >::write().
| mx::error_t mx::fits::fits_write_key | ( | fitsfile * | fptr, |
| char * | keyword, | ||
| void * | value, | ||
| char * | comment ) |
Write a header card to a file.
This is a templatized wrapper for the cfitsio routine fits_write_key.
| typeT | is the type of the value |
| fptr | is a pointer to an open fits file |
| keyword | is a c-string containing the keyword |
| value | is a pointer to the memory location of the value |
| comment | is a c-string, possibly NULL, containing a comment string |
| int | containing the status returned by the cfitsio routine. |
Definition at line 372 of file fitsUtils.hpp.
References mx::fits_status2error_t(), fits_write_key(), and fitsType().
Referenced by fits_write_key(), fits_write_key< bool >(), and mx::fits::fitsHeaderCard< verboseT >::write().
| mx::error_t mx::fits::fits_write_key< bool > | ( | fitsfile * | fptr, |
| char * | keyword, | ||
| void * | value, | ||
| char * | comment ) |
Specialization to handle the case bool.
This gets converted to unsigned char.
Definition at line 128 of file fitsUtils.cpp.
References mx::fits_status2error_t(), fits_write_key(), and fitsType().
Referenced by mx::fits::fitsHeaderCard< verboseT >::write().
|
constexpr |
Return the cfitsio BITPIX value for a given data type.
| scalarT | is the type |
| int | > 0 if a constant is defined in cfitsio corresponding to the native type |
| -1 | if not a defined type in cfitsio |
References fitsBITPIX().
Referenced by fitsBITPIX(), and mx::fits::fitsFile< dataT, verboseT >::write().
| void mx::fits::fitsHeaderGitStatus | ( | fitsHeaderT & | head, |
| const std::string & | repoName, | ||
| const char * | sha1, | ||
| int | modified ) |
Write the status of a Git repository to HISTORY in a FITS header.
| [in,out] | head | the HISTORY cards will be appended to this header |
| [in] | repoName | the name of the repository |
| [in] | sha1 | is the SHA-1 hash string of the repository |
| [in] | modified | whether or not the repository has been modified after the commit referred to by sha1 |
Definition at line 949 of file fitsHeader.hpp.
Referenced by mx::unitTest::fitsTest::fitsHeaderTest::TEST_CASE().
| void mx::fits::fitsPopulateCard | ( | char | headStr[81], |
| char * | keyword, | ||
| char * | value, | ||
| char * | comment ) |
Populate a fits header card with the value string copied verbatim.
| headStr | is a c-string which must be 81 characters in length, including the ' ' |
| keyword | is the keyword name |
| value | is the value string |
| comment | is the comment string |
Definition at line 63 of file fitsUtils.cpp.
References stdValWidth.
| int mx::fits::fitsStripApost | ( | std::string & | s | ) |
Strip the apostrophes from a FITS value string.
The argument is modified if the first and/or last non-whitespace character is '
| s | is the string from which to strip apostrophes |
| int | containing the number of stripped apostrophes |
Definition at line 34 of file fitsUtils.cpp.
|
constexpr |
Return the cfitsio constant for a given data type.
| scalarT | is the type |
Definition at line 121 of file fitsUtils.hpp.
Referenced by mx::fits::fitsHeaderCard< verboseT >::fitsHeaderCard(), mx::fits::fitsHeaderCard< verboseT >::fitsHeaderCard(), mx::fits::fitsHeaderCard< verboseT >::fitsHeaderCard(), mx::fits::fitsHeaderCard< verboseT >::fitsHeaderCard(), mx::fits::fitsHeaderCard< verboseT >::fitsHeaderCard(), mx::fits::fitsHeader< verboseT >::append(), mx::fits::fitsHeaderCard< verboseT >::convertedValue(), mx::fits::fitsHeaderCard< verboseT >::convertFromString(), mx::fits::fitsHeaderCard< verboseT >::convertToString(), mx::fits::fitsHeaderCard< verboseT >::convertValue(), fits_write_key(), fits_write_key< bool >(), mx::fits::fitsHeader< verboseT >::insert_after(), mx::fits::fitsHeader< verboseT >::insert_before(), mx::fits::fitsFile< dataT, verboseT >::read(), mx::fits::fitsFile< dataT, verboseT >::read(), mx::fits::fitsFile< dataT, verboseT >::read(), mx::unitTest::fitsTest::fitsFileTest::TEST_CASE(), mx::unitTest::fitsTest::fitsHeaderCardTest::TEST_CASE(), mx::unitTest::fitsTest::fitsHeaderCardTest::TEST_CASE(), mx::unitTest::fitsTest::fitsHeaderCardTest::TEST_CASE(), mx::unitTest::fitsTest::fitsHeaderCardTest::TEST_CASE(), mx::unitTest::fitsTest::fitsHeaderCardTest::TEST_CASE(), mx::unitTest::fitsTest::fitsHeaderCardTest::TEST_CASE(), mx::unitTest::fitsTest::fitsHeaderTest::TEST_CASE(), mx::unitTest::fitsTest::fitsHeaderTest::TEST_CASE(), mx::unitTest::fitsTest::fitsHeaderTest::TEST_CASE(), mx::unitTest::fitsTest::fitsHeaderTest::TEST_CASE(), mx::unitTest::fitsTest::fitsHeaderTest::TEST_CASE(), mx::fits::fitsHeaderCard< verboseT >::value(), mx::fits::fitsHeaderCard< verboseT >::value(), mx::fits::fitsHeaderCard< verboseT >::valueNonString(), mx::fits::fitsFile< dataT, verboseT >::write(), and mx::fits::fitsHeaderCard< verboseT >::write().
| error_t mx::fits::headersToValues | ( | std::vector< dataT > & | v, |
| std::vector< size_t > & | bad, | ||
| std::vector< fitsHeaderT > & | heads, | ||
| const std::string & | keyw ) |
Convert the values in a std::vector of fits headers into a std::vector of values.
Resizes the vector of the appropriate type.
bad will be empty. bad will contain the indices of heads for which the extraction of a value for keyw failed| dataT | is the type of the header value |
| fitsHeaderT | is the fitsHeader type |
| [out] | v | will contain the converted values |
| [out] | bad | will contain the indices of any headers that failed conversion |
| [in] | heads | contains the headers |
| [in] | keyw | contains the keyword designating which value to convert |
Definition at line 907 of file fitsHeader.hpp.
References mx::error, and mx::noerror.
Referenced by mx::unitTest::fitsTest::fitsHeaderTest::TEST_CASE().