#include <FitsController.h>
Collaboration diagram for FitsController:
Definition at line 39 of file FitsController.h.
Public Member Functions | |
void | checkForImage (PlotterBase *plotter, const DataSource &source) |
Check and fix plotter for FITS image data source. | |
DataSource * | createNTuple (const std::string &filename, const std::string &name, int index) |
Creates a FitsNTuple from a ASCII or binary table in a FITS file. | |
DataSource * | createNTuple (const std::string &filename, const std::string &name) |
Creates a FitsNTuple from a ASCII or binary table in a FITS file. | |
const std::vector< std::string > & | getNTupleNames (const std::string &file_name) |
Returns a temporarily list of the names of the DataSource objects in the FITS file. | |
FitsFile * | openFile (const std::string &file) |
Opens the named file, if not already opened. | |
const std::string & | version () const |
Returns the version of cfitsio being used. | |
void | writeImageToFile (unsigned int x, unsigned int y, const std::vector< double > &data, const std::string &filename) |
Write a image to a FITS image. | |
int | writeNTupleToFile (const DataSource *source, const std::string &filename, const std::string &name, const std::vector< std::string > &column_list, const std::vector< const TupleCut * > &cut_list) |
Writes the DataSource to a FITS file as binary table. | |
void | writeNTupleToFile (const std::string &name, const std::string &filename) |
Write a DataSource to a FITS file as binary table. | |
void | writeNTupleToFile (const DataSource *ntuple, const std::string &filename) |
Write a DataSource to a FITS file as binary table. | |
virtual | ~FitsController () |
The destructor. | |
Static Public Member Functions | |
static FitsController * | instance () |
Returns the singleton instance of the FitsController. | |
Private Member Functions | |
std::size_t | calcColumnWidth (const DataSource *source, unsigned int column) const |
Returns the number of elements in a column. | |
void | closeFile (const std::string &name) |
Closed the named file, if found in list of opened files. | |
Private Attributes | |
std::map< std::string, FitsFile * > | m_file_map |
A map of open FITS files. | |
std::vector< std::string > | m_ntuple_names |
A list of possible DataSource names in the FITS file. | |
std::string | m_version |
The version of cfitsio being used. | |
Static Private Attributes | |
static FitsController * | s_instance = 0 |
The singleton instance of the FitsController. |
~FitsController | ( | ) | [virtual] |
size_t calcColumnWidth | ( | const DataSource * | source, | |
unsigned int | column | |||
) | const [private] |
Returns the number of elements in a column.
If a column contains an array, returns the size of the array for a single row, otherwise returns 1
.
Definition at line 353 of file FitsController.cxx.
References num_util::rank(), and num_util::shape().
Referenced by FitsController::writeNTupleToFile().
void checkForImage | ( | PlotterBase * | plotter, | |
const DataSource & | source | |||
) |
Check and fix plotter for FITS image data source.
If the data source for the Plotter is a FITS image file, then sets the parameters of the image. Otherwise does nothing.
Definition at line 199 of file FitsController.cxx.
References FitsNTuple::getFile(), FitsFileBase::Image, PlotterBase::setAspectRatio(), PlotterBase::setFitsTransform(), Range::setLength(), Range::setLow(), PlotterBase::setOffset(), Range::setRange(), num_util::type(), hippodraw::Axes::X, and hippodraw::Axes::Y.
void closeFile | ( | const std::string & | name | ) | [private] |
Closed the named file, if found in list of opened files.
Definition at line 108 of file FitsController.cxx.
DataSource * createNTuple | ( | const std::string & | filename, | |
const std::string & | name, | |||
int | index | |||
) |
Creates a FitsNTuple from a ASCII or binary table in a FITS file.
Returns a FitsNTuple object from the file filename, with HDU number index. Use name as the HDU name. name name. If the object already exists, return it, otherwise creates and returns a new one. If error occurs in the creation, throws a DataSourceException. Since HDU may not have a name, one uses the index to find it.
Definition at line 165 of file FitsController.cxx.
References DataSourceController::instance(), and FitsController::openFile().
DataSource * createNTuple | ( | const std::string & | filename, | |
const std::string & | name | |||
) |
Creates a FitsNTuple from a ASCII or binary table in a FITS file.
Looks from an HDU with extension name name. If none exists, throws a DataSourceException. If it does exist, then returns the created FitsNTuple.
Definition at line 134 of file FitsController.cxx.
References FitsController::getNTupleNames(), and num_util::size().
const vector< string > & getNTupleNames | ( | const std::string & | file_name | ) |
Returns a temporarily list of the names of the DataSource objects in the FITS file.
Definition at line 120 of file FitsController.cxx.
References FitsController::m_ntuple_names, and FitsController::openFile().
Referenced by FitsController::createNTuple().
FitsController * instance | ( | ) | [static] |
Returns the singleton instance of the FitsController.
Definition at line 44 of file FitsController.cxx.
References FitsController::s_instance.
Referenced by DisplayController::createDisplay(), CreateNTuple::createFileButtonClicked(), QtCut::createFits(), HiNTupleXML::getObject(), CanvasView::helpAbout(), PyFitsController::instance(), QtFileDialog::isFitsFile(), QtFileDialog::openFitsTuple(), QtFileDialog::saveFitsTuple(), and CanvasView::savePlotAsFits().
FitsFile * openFile | ( | const std::string & | file | ) |
Opens the named file, if not already opened.
Opens and returns pointer to a FITS file. If file is not found, or file is not a FITS file, then throws DataSourceException.
Definition at line 71 of file FitsController.cxx.
References FitsController::m_file_map.
Referenced by FitsController::createNTuple(), FitsController::getNTupleNames(), and QtFileDialog::isFitsFile().
const std::string & version | ( | ) | const |
Returns the version of cfitsio being used.
Definition at line 59 of file FitsController.cxx.
References hippodraw::String::convert(), and FitsController::m_version.
void writeImageToFile | ( | unsigned int | x, | |
unsigned int | y, | |||
const std::vector< double > & | data, | |||
const std::string & | filename | |||
) |
Write a image to a FITS image.
Definition at line 328 of file FitsController.cxx.
Referenced by CanvasView::savePlotAsFits().
int writeNTupleToFile | ( | const DataSource * | source, | |
const std::string & | filename, | |||
const std::string & | name, | |||
const std::vector< std::string > & | column_list, | |||
const std::vector< const TupleCut * > & | cut_list | |||
) |
Writes the DataSource to a FITS file as binary table.
source | The DataSource of any type | |
filename | The file name. | |
name | The HDU extension name. | |
column_list | The list of columns to be written to file | |
cut_list | The list of cuts on the rows of the table. |
Definition at line 368 of file FitsController.cxx.
References FitsController::calcColumnWidth(), CutController::fillAcceptedRows(), DataSource::rows(), num_util::shape(), and num_util::size().
void writeNTupleToFile | ( | const std::string & | name, | |
const std::string & | filename | |||
) |
Write a DataSource to a FITS file as binary table.
Definition at line 316 of file FitsController.cxx.
References DataSourceController::instance(), and FitsController::writeNTupleToFile().
void writeNTupleToFile | ( | const DataSource * | ntuple, | |
const std::string & | filename | |||
) |
Write a DataSource to a FITS file as binary table.
Definition at line 272 of file FitsController.cxx.
References num_util::shape().
Referenced by QtFileDialog::saveFitsTuple(), and FitsController::writeNTupleToFile().
std::map< std::string, FitsFile * > m_file_map [private] |
A map of open FITS files.
Definition at line 46 of file FitsController.h.
Referenced by FitsController::openFile().
std::vector< std::string > m_ntuple_names [private] |
A list of possible DataSource names in the FITS file.
Definition at line 58 of file FitsController.h.
Referenced by FitsController::getNTupleNames().
std::string m_version [mutable, private] |
The version of cfitsio being used.
Definition at line 50 of file FitsController.h.
Referenced by FitsController::version().
FitsController * s_instance = 0 [static, private] |
The singleton instance of the FitsController.
Definition at line 54 of file FitsController.h.
Referenced by FitsController::instance().