|
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. | |
|
staticconstexpr |
Convert a FITS status code to error_t.
| [in] | err | the fits status code to convert |
Definition at line 2169 of file error_t.hpp.
References mx::error, mx::fits_angle_too_big, mx::fits_approx_wcs_key, mx::fits_array_too_big, mx::fits_bad_atable_format, mx::fits_bad_bitpix, mx::fits_bad_btable_format, mx::fits_bad_c2d, mx::fits_bad_c2f, mx::fits_bad_c2i, mx::fits_bad_col_num, mx::fits_bad_data_fill, mx::fits_bad_datatype, mx::fits_bad_date, mx::fits_bad_decim, mx::fits_bad_dimen, mx::fits_bad_doublekey, mx::fits_bad_elem_num, mx::fits_bad_f2c, mx::fits_bad_fileptr, mx::fits_bad_floatkey, mx::fits_bad_gcount, mx::fits_bad_group_attach, mx::fits_bad_group_detach, mx::fits_bad_group_id, mx::fits_bad_hdu_num, mx::fits_bad_header_fill, mx::fits_bad_heap_ptr, mx::fits_bad_i2c, mx::fits_bad_index_key, mx::fits_bad_intkey, mx::fits_bad_keychar, mx::fits_bad_logicalkey, mx::fits_bad_naxes, mx::fits_bad_naxis, mx::fits_bad_nettimeout, mx::fits_bad_option, mx::fits_bad_order, mx::fits_bad_pcount, mx::fits_bad_pix_num, mx::fits_bad_row_num, mx::fits_bad_row_width, mx::fits_bad_simple, mx::fits_bad_tbcol, mx::fits_bad_tdim, mx::fits_bad_tfields, mx::fits_bad_tform, mx::fits_bad_tform_dtype, mx::fits_bad_url_prefix, mx::fits_bad_wcs_proj, mx::fits_bad_wcs_val, mx::fits_col_not_found, mx::fits_col_not_unique, mx::fits_col_too_wide, mx::fits_data_compression_err, mx::fits_data_decompression_err, mx::fits_driver_init_failed, mx::fits_end_junk, mx::fits_end_of_file, mx::fits_file_not_closed, mx::fits_file_not_created, mx::fits_file_not_opened, mx::fits_group_not_found, mx::fits_hdu_already_member, mx::fits_hdu_already_tracked, mx::fits_header_not_empty, mx::fits_identical_pointers, mx::fits_key_no_exist, mx::fits_key_out_bounds, mx::fits_member_not_found, mx::fits_memory_allocation, mx::fits_neg_axis, mx::fits_neg_bytes, mx::fits_neg_file_pos, mx::fits_neg_rows, mx::fits_neg_width, mx::fits_ngp_bad_arg, mx::fits_ngp_empty_curline, mx::fits_ngp_eof, mx::fits_ngp_err_fopen, mx::fits_ngp_inc_nesting, mx::fits_ngp_no_memory, mx::fits_ngp_nul_ptr, mx::fits_ngp_read_err, mx::fits_ngp_token_not_expect, mx::fits_ngp_unread_queue_full, mx::fits_no_bitpix, mx::fits_no_end, mx::fits_no_gcount, mx::fits_no_matching_driver, mx::fits_no_naxes, mx::fits_no_naxis, mx::fits_no_null, mx::fits_no_pcount, mx::fits_no_quote, mx::fits_no_simple, mx::fits_no_tbcol, mx::fits_no_tfields, mx::fits_no_tform, mx::fits_no_wcs_key, mx::fits_no_xtension, mx::fits_not_ascii_col, mx::fits_not_atable, mx::fits_not_btable, mx::fits_not_group_table, mx::fits_not_image, mx::fits_not_logical_col, mx::fits_not_pos_int, mx::fits_not_table, mx::fits_not_vari_len, mx::fits_null_input_ptr, mx::fits_num_overflow, mx::fits_parse_bad_col, mx::fits_parse_bad_output, mx::fits_parse_bad_type, mx::fits_parse_lrg_vector, mx::fits_parse_no_output, mx::fits_parse_syntax_err, mx::fits_range_parse_error, mx::fits_read_error, mx::fits_readonly_file, mx::fits_same_file, mx::fits_seek_error, mx::fits_shared_again, mx::fits_shared_badarg, mx::fits_shared_ipcerr, mx::fits_shared_nofile, mx::fits_shared_nomem, mx::fits_shared_noresize, mx::fits_shared_notinit, mx::fits_shared_nulptr, mx::fits_shared_tabfull, mx::fits_too_many_drivers, mx::fits_too_many_files, mx::fits_too_many_hdus_tracked, mx::fits_unknown_ext, mx::fits_unknown_rec, mx::fits_url_parse_error, mx::fits_value_undefined, mx::fits_wcs_error, mx::fits_write_error, mx::fits_zero_scale, and mx::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(), and mx::fits::fits_write_key().
Referenced by mx::fits::fits_write_key(), and mx::fits::fits_write_key< bool >().
| 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(), and mx::fits::fits_write_key().
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 |
| 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 935 of file fitsHeader.hpp.
| 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.
| 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 893 of file fitsHeader.hpp.
References mx::error, and mx::noerror.
Referenced by mx::unitTest::fitsTest::fitsHeaderTest::TEST_CASE().