ifw-core
2.0.0
|
Classes | |
class | FitsReport |
Typedefs | |
using | CfitsioType = int32_t |
Functions | |
CfitsioType | DidToCfitsioType (ctd::defines::DataType did_type) |
Convert an ELT ICS data type to the corresponding cfitsio data type. More... | |
void | HandleCfitsioError (const std::string &operation, const int cfitsio_status) |
Throw an exception, extracting the relevant info from cfitsio, if status != 0. More... | |
std::string | GenerateKey (const std::string &key, const std::string &hierarch_prefix=FITS_KEY_ESO_HIERARCH) |
Generates an ESO hierarchical keyword. More... | |
void | Verify (const std::string &filename, std::string &target_filename, dit::fits::FitsReport &report) |
Function to carry out a verification check on a FITS file. More... | |
void | Verify (const std::string &filename, std::string &target_filename, const dit::did::Did &dictionary, dit::fits::FitsReport &report) |
Function to carry out a verification check on a FITS file. Dictionary taken into account. More... | |
void | CreateFile (std::shared_ptr< CCfits::FITS > &fits_handle, const std::string &filename, const dit::did::Did &dictionary, const int32_t bitpix, const std::vector< int32_t > &naxes, std::string &target_filename, const bool remove_if_exists=false, const uint16_t nb_of_hdr_blocks=1) |
Create a new FITS file. More... | |
void | MoveToHdu (std::shared_ptr< CCfits::FITS > &fits_handle, const int16_t hdu_nb) |
Move to the given HDU. More... | |
bool | KeyInHdu (std::shared_ptr< CCfits::FITS > &fits_handle, const int16_t hdu_nb, const std::string &key) |
Check if a given key is contained in the referenced HDU (primary HDU = 1). More... | |
void | AddDoubleKey (std::shared_ptr< CCfits::FITS > &fits_handle, const dit::did::Did &dictionary, const std::string &key, const double value, const uint16_t hdu_nb) |
Add a double type key in an existing FITS file. More... | |
void | PrepForAddingKey (std::shared_ptr< CCfits::FITS > &fits_handle, const dit::did::Did &dictionary, const std::string &key, const int16_t hdu_nb, dit::did::Record &did_record, std::string &target_key, bool &key_in_hdu, CfitsioType &cfitsio_type, dit::did::FormatSpecifier &format_specifier) |
Used to prepare for adding a keyword card in a FITS file (mostly internal usage). More... | |
void | ExtractHeaders (std::shared_ptr< CCfits::FITS > &fits_handle, std::string &hdr_buf, const int16_t hdr_ref=ALL_HEADERS) |
Extract the keyword cards in one or more HDU's in an ASCII format (newline terminated). More... | |
void | ExtractHeaders (const std::string &filename, std::string &target_filename, std::string &hdr_buf, const int16_t hdr_ref=ALL_HEADERS) |
Extract all or a specific header from a FITS file. More... | |
void | OpenFitsFile (std::shared_ptr< CCfits::FITS > &fits_handle, const std::string &filename, std::string &target_filename, CCfits::RWmode mode=CCfits::Read) |
Open an existing FITS file. More... | |
template<class TYPE > | |
void | AddKey (std::shared_ptr< CCfits::FITS > &fits_handle, const dit::did::Did &dictionary, const std::string &key, const TYPE &value, const int16_t hdu_nb) |
Template function to add a keyword card in an existing FITS file. More... | |
Variables | |
const std::string | FITS_KEY_ESO_HIERARCH = "HIERARCH ESO" |
const int16_t | ALL_HEADERS = SHRT_MAX |
using dit::fits::CfitsioType = typedef int32_t |
void dit::fits::AddDoubleKey | ( | std::shared_ptr< CCfits::FITS > & | fits_handle, |
const dit::did::Did & | dictionary, | ||
const std::string & | key, | ||
const double | value, | ||
const uint16_t | hdu_nb | ||
) |
Add a double type key in an existing FITS file.
fits_handle | CCfits object associated to the FITS file. |
dictionary | Dictionary obejct containing information about keys to be added. |
hdu_nb | HDU in which to add the key (primary header = 1). |
value | Double value to be added. |
key | Key to be added. |
void dit::fits::AddKey | ( | std::shared_ptr< CCfits::FITS > & | fits_handle, |
const dit::did::Did & | dictionary, | ||
const std::string & | key, | ||
const TYPE & | value, | ||
const int16_t | hdu_nb | ||
) |
Template function to add a keyword card in an existing FITS file.
fits_handle | CCfits object associated to a FITS file. |
dictionary | Dictionary obejct containing information about keys to be added. |
key | Key to be added, e.g. "INS OPTI1 ID". |
value | Value to be added. |
hdu_nb | Target HDU number (primary header = 1). |
Note: For Double type keys, use "dit::fits::AddDoubleKey()".
void dit::fits::CreateFile | ( | std::shared_ptr< CCfits::FITS > & | fits_handle, |
const std::string & | filename, | ||
const dit::did::Did & | dictionary, | ||
const int32_t | bitpix, | ||
const std::vector< int32_t > & | naxes, | ||
std::string & | target_filename, | ||
const bool | remove_if_exists = false , |
||
const uint16_t | nb_of_hdr_blocks = 1 |
||
) |
Create a new FITS file.
fits_handle | The CCfits handle for the new file. Will be allocated by the function. |
filename | Basename for target file. |
dictionary | Dictionary containing the definition of the keys to be created. |
target_filename | The resulting final target filename. |
remove_if_exists | If true, remove a file if already exsting with the target filename. |
nb_of_hdr_blocks | Number of header blocks to reserve ( |
data_size | Size in bytes to allocate for the data ( |
Files given by their basename, will be created in "$DATAROOT/resource/data".
CfitsioType dit::fits::DidToCfitsioType | ( | ctd::defines::DataType | did_type | ) |
Convert an ELT ICS data type to the corresponding cfitsio data type.
did_type |
void dit::fits::ExtractHeaders | ( | std::shared_ptr< CCfits::FITS > & | fits_handle, |
std::string & | hdr_buf, | ||
const int16_t | hdr_ref = ALL_HEADERS |
||
) |
Extract the keyword cards in one or more HDU's in an ASCII format (newline terminated).
fits_handle | CCfits handle object associated with existing FITS file. |
hdr_buf | Buffer which will contain the ASCII dump of the requested headers. |
hdr_ref | Single HDU or all for which to extract the keyword cards. |
void dit::fits::ExtractHeaders | ( | const std::string & | filename, |
std::string & | target_filename, | ||
std::string & | hdr_buf, | ||
const int16_t | hdr_ref = ALL_HEADERS |
||
) |
Extract all or a specific header from a FITS file.
filename | Basename of the file. |
target_filename | Complete name of target file. |
hdr_buf | Buffer with the newline terminated FITS keyword cards from the requested HDU's. |
hdr_ref | HDU to extract, or all (primary HDU = 1). |
std::string dit::fits::GenerateKey | ( | const std::string & | key, |
const std::string & | hierarch_prefix = FITS_KEY_ESO_HIERARCH |
||
) |
Generates an ESO hierarchical keyword.
key | Input key to be checked and possibly converted. |
For hierarchical keys, these shall be given as follows: "<cat> [<subsystem>] <parameter>".
A primary key is returned unmodified.
void dit::fits::HandleCfitsioError | ( | const std::string & | operation, |
const int | cfitsio_status | ||
) |
Throw an exception, extracting the relevant info from cfitsio, if status != 0.
bool dit::fits::KeyInHdu | ( | std::shared_ptr< CCfits::FITS > & | fits_handle, |
const int16_t | hdu_nb, | ||
const std::string & | key | ||
) |
Check if a given key is contained in the referenced HDU (primary HDU = 1).
fits_handle | The CCfits object. |
hdu_nb | HDU to check. |
key | Name of the key, e.g. "INS FILT1 NAME". |
void dit::fits::MoveToHdu | ( | std::shared_ptr< CCfits::FITS > & | fits_handle, |
const int16_t | hdu_nb | ||
) |
Move to the given HDU.
fits_handle | CCfits fits handle. |
hdu_nb | HDU number requested (primary header = 1). |
void dit::fits::OpenFitsFile | ( | std::shared_ptr< CCfits::FITS > & | fits_handle, |
const std::string & | filename, | ||
std::string & | target_filename, | ||
CCfits::RWmode | mode = CCfits::Read |
||
) |
Open an existing FITS file.
fits_handle | CCfits fits handle object. Will be allocated by the function. |
filename | Basename of FITS file to open. |
target_filename | Complete name of file opened. |
mode | CCfits::Read or CCfits::Write. |
void dit::fits::PrepForAddingKey | ( | std::shared_ptr< CCfits::FITS > & | fits_handle, |
const dit::did::Did & | dictionary, | ||
const std::string & | key, | ||
const int16_t | hdu_nb, | ||
dit::did::Record & | did_record, | ||
std::string & | target_key, | ||
bool & | key_in_hdu, | ||
CfitsioType & | cfitsio_type, | ||
dit::did::FormatSpecifier & | format_specifier | ||
) |
Used to prepare for adding a keyword card in a FITS file (mostly internal usage).
dictionary | Dictionary object defining the keys in the FITS file. |
fits_handle | The CCfits object. |
key | Key to be added. |
hdu_nb | HDU number where the shall be added (primary header = 1). |
did_record | Copy of the dictionary record for the key. |
target_key | The final target keyname, e.g. "HIERARCH ESO INS1 FILT2 NAME". |
key_in_hdu | True if key already defined in the given HDU. |
cfitsio_type | The cfitsio data type for the key. |
format_specifier | Object with information about the format of the value. |
Note, the function does actually not add the key in the file.
void dit::fits::Verify | ( | const std::string & | filename, |
std::string & | target_filename, | ||
dit::fits::FitsReport & | report | ||
) |
Function to carry out a verification check on a FITS file.
filename | Basename of file to check. |
target_filename | Filename of the FITS file checked. |
report | Report object with the results from the check. |
This is a basic verification check, not involving a ICS dictionary.
void dit::fits::Verify | ( | const std::string & | filename, |
std::string & | target_filename, | ||
const dit::did::Did & | dictionary, | ||
dit::fits::FitsReport & | report | ||
) |
Function to carry out a verification check on a FITS file. Dictionary taken into account.
filename | Basename of file to check. |
target_filename | Complete filename of file checked. |
dictionary | ICS dictionary with keyword definitions. |
report | Report object with the results from the check. |
const int16_t dit::fits::ALL_HEADERS = SHRT_MAX |
const std::string dit::fits::FITS_KEY_ESO_HIERARCH = "HIERARCH ESO" |