Alexandria
2.14.1
Please provide a description of the project.
|
Tool for reading FITS tables from streams. More...
#include <FitsParser.h>
Public Member Functions | |
FitsParser (const std::string &keyword="") | |
Constructor Tool for reading FITS tables from streams. More... | |
std::string | getName (const std::string &file) override |
Get the dataset name of a FITS file. More... | |
std::unique_ptr< XYDataset > | getDataset (const std::string &file) override |
Get a XYDataset object reading data from an FITS file. More... | |
bool | isDatasetFile (const std::string &file) override |
Check that the FITS file is a dataset file(with at least one HDU table) More... | |
![]() | |
virtual | ~FileParser ()=default |
Default destructor. More... | |
Private Attributes | |
std::string | m_name_keyword |
Tool for reading FITS tables from streams.
The FitsParser reads FITS file which contains a primary HDU and one binary extension. The extension must contain two columns of double types. The first column contains the X data and the second the Y data. The name of the dataset is extracted from one of the keywords stored in the first extension. The name of this keyword can be specified in the constructor. If the keyword does not exist, the dataset name is extracted from the FITS filename itself removing the path and extension (.fits).
Definition at line 51 of file FitsParser.h.
|
inline |
Constructor Tool for reading FITS tables from streams.
keyword | The keyword name where the dataset name is stored in the FITS file. The default is the empty string. |
Definition at line 62 of file FitsParser.h.
|
overridevirtual |
Get a XYDataset object reading data from an FITS file.
It reads data in the first extension of a FITS file and put the data into a XYDataset object. It makes the assumption that the file only contains two columns of double values.
file | Filename of the FITS file to be read (including the absolute path). |
Elements::Exception | A FITS exception occured |
Implements Euclid::XYDataset::FileParser.
Definition at line 79 of file FitsParser.cpp.
References std::make_pair(), std::vector< T >::push_back(), and Euclid::Table::TableReader::read().
|
overridevirtual |
Get the dataset name of a FITS file.
This function gets the dataset name. It tries first to get the dataset name from the keyword stored in the binary extension. The keyword name to look for is specified at the constructor level. If no keyword specified or found, the dataset name is extracted from the filename removing the path and the extension.
file | Filename of the file to be read including absolute path |
ElementException | : File not found |
Implements Euclid::XYDataset::FileParser.
Definition at line 47 of file FitsParser.cpp.
References m_name_keyword, Euclid::XYDataset::removeAllBeforeLastSlash(), and Euclid::XYDataset::removeExtension().
|
overridevirtual |
Check that the FITS file is a dataset file(with at least one HDU table)
This checking should avoid reading any files which do not contain any dataset.
file | Filename of the FITS file to be read including the absolute path. |
Implements Euclid::XYDataset::FileParser.
Definition at line 112 of file FitsParser.cpp.
References ELEMENTS_UNUSED.
|
private |
Definition at line 113 of file FitsParser.h.
Referenced by getName().