mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]
|
FITS file utilities and wrappers.
Functions | |
template<typename dataT > | |
void | mx::fits::headersToValues (std::vector< dataT > &v, std::vector< fitsHeader > &heads, const std::string &keyw) |
Convert the values in a std::vector of fits headers into a std::vector of values. | |
template<typename dataT > | |
std::vector< dataT > | mx::fits::headersToValues (std::vector< fitsHeader > &heads, const std::string &keyw) |
Convert the values in a std::vector of fits headers into a std::vector of values. | |
void | mx::fits::fitsHeaderGitStatus (fitsHeader &head, const std::string &repoName, const char *sha1, int modified) |
Write the status of a Git repository to HISTORY in a FITS header. | |
int 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 349 of file fitsUtils.hpp.
References mx::fits::fits_write_key().
Referenced by mx::fits::fits_write_key(), and mx::fits::fits_write_key< bool >().
int 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 123 of file fitsUtils.cpp.
References mx::fits::fits_write_key().
|
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::fitsErrText | ( | std::string & | explan, |
const std::string & | filename, | ||
int | fstatus | ||
) |
Generate a rich error meesage from a FITS status code.
[out] | explan | the explanatory message |
[in] | filename | the FITS file's name which generated the problem |
[in] | fstatus | the cfitstio status code |
Definition at line 169 of file fitsUtils.cpp.
References mx::ioutils::convertToString().
Referenced by mx::fits::fitsFile< dataT >::close(), mx::fits::fitsFile< dataT >::open(), mx::fits::fitsFile< dataT >::read(), mx::fits::fitsFile< dataT >::read(), mx::fits::fitsFile< dataT >::read(), mx::fits::fitsFile< dataT >::readHeader(), and mx::fits::fitsFile< dataT >::write().
void mx::fits::fitsHeaderGitStatus | ( | fitsHeader & | 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 259 of file fitsHeader.cpp.
References mx::fits::fitsHeader::append().
Referenced by mx::improc::HCIobservation< _realT >::outputPSFSub(), and mx::improc::HCIobservation< _realT >::writeFinim().
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.
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 104 of file fitsUtils.hpp.
void mx::fits::headersToValues | ( | std::vector< dataT > & | v, |
std::vector< fitsHeader > & | 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.
dataT | is the type of the header value |
[out] | v | will contain the converted values |
[in] | heads | contains the headers |
[in] | keyw | contains the keyword designating which value to convert |
Definition at line 311 of file fitsHeader.hpp.
Referenced by mx::fits::headersToValues().
std::vector< dataT > mx::fits::headersToValues | ( | std::vector< fitsHeader > & | heads, |
const std::string & | keyw | ||
) |
Convert the values in a std::vector of fits headers into a std::vector of values.
Creates a vector of the appropriate type and size.
dataT | is the type of the header value |
[in] | heads | contains the headers |
[in] | keyw | contains the keyword designating which value to convert |
std::vector<dataT> | containing the converted values |
Definition at line 332 of file fitsHeader.hpp.
References mx::fits::headersToValues().