#include <FitsNTuple.h>
Inheritance diagram for FitsNTuple:
The source of the data can be copied from FITS binary table or image. Data from the FITS file is read in from memory only when needed.
Definition at line 31 of file FitsNTuple.h.
Public Types | |
typedef void(Observer::*) | Action (const Observable *) |
The member function of the Observer that is called. | |
typedef std::list< Observer * > | ObserverList_t |
The type of STL container to maintain list of Observer objects. | |
Public Member Functions | |
virtual int | addColumn (const std::string &label, const std::vector< double > &column, const std::vector< intptr_t > &shape) |
Adds a column to the end of the FitsNTuple. | |
int | addColumn (const std::string &label, const std::vector< double > &column) |
Adds a column to the end of the FitsNTuple. | |
void | addObserver (Observer *) |
Adds an Observer to the Observer list. | |
virtual void | addRow (const std::vector< double > &row) |
Adds a row to the data source. | |
virtual void | append (const DataSource *source) |
Appends the contents of the DataSource source. | |
virtual void | clear () |
Clears the data cache; doesn't not modify the contained fits file. | |
unsigned int | columns () const |
Returns the number of columns or data arrays available from this DataSource. | |
virtual void | copy (const DataSource &) |
Raises exception because with this release, copying the fits table is not supported. | |
virtual bool | empty () const |
Returns true , if FitsNTuple is empty, i.e. | |
virtual void | eraseRow (unsigned int index) |
Erase a row from the data source. | |
virtual void | expandIfNeeded (const std::vector< std::string > &labels) const |
Expand the multidimension column if needed. | |
virtual bool | fillRange (unsigned int column, Range &) const |
Fills the Range object from data indexed by column. | |
virtual void | fillShape (std::vector< int > &v, const std::string &label) const |
Fills the vector with the shape of a column. | |
virtual void | fillShape (std::vector< int > &v, unsigned int column) const |
Fills the vector with the shape of a column. | |
virtual void | fillShape (std::vector< intptr_t > &shape, unsigned int index) const |
Returns the shape of the column index. | |
FitsNTuple (FitsFile *file) | |
A constructor with a FitsFile as argument. | |
virtual const std::vector< double > & | getColumn (const std::string &name) const |
Returns the data in the column with label name. | |
virtual const std::vector< double > & | getColumn (unsigned int c) const |
Returns the data of the column. | |
const std::vector< std::string > & | getDuplicatedLabels () const |
Returns the column labels that were duplicated, or an empty vector. | |
const FitsFile * | getFile () const |
Returns the FITS file used to create this object. | |
virtual const std::string & | getLabelAt (unsigned int index) const |
Returns the label for the column at index index. | |
virtual const std::vector< std::string > & | getLabels () const |
Returns the list of available labels. | |
const std::string & | getName () const |
Returns the name of the data source. | |
const ObserverList_t & | getObservers () const |
Returns the list of observers. | |
unsigned int | getRank () const |
Returns the rank of the data source. | |
virtual const std::vector< double > & | getRow (unsigned int) const |
Returns a const reference to slice along the axis known as a row. | |
const std::vector< unsigned int > & | getShape () const |
Returns the shape of the data elements. | |
virtual int | indexOf (const std::string &label) const |
Returns the index of the column whose label is label. | |
virtual unsigned int | indexOfMaxElement (unsigned int index) const |
Returns row index of the maximum element in a column for the given column. | |
virtual unsigned int | indexOfMinElement (unsigned int index) const |
Returns row index of the minimum element in a column for the given column. | |
virtual bool | isMultiDimensional (const std::string &column) const |
Returns true if the column contains multidimensional data. | |
bool | isNull () const |
Returns true if the receiving objects is a null object. | |
virtual bool | isUseable (const std::string &column) const |
Returns true if the column is usable. | |
bool | isValidLabel (const std::string &label) const |
Returns true if label is a valid label for a column in the DataSource. | |
virtual void | notifyObservers () const |
Notifies observers. | |
virtual double | operator[] (std::vector< unsigned int > &indices) const |
Raises assertion as this method is not yet implemented. | |
void | removeObserver (Observer *) |
Removes an Observer from the Observer list. | |
virtual void | replaceColumn (const std::string &label, const std::vector< double > &array) |
Replaces data in column label with contents of array. | |
void | replaceColumn (const std::string &label, const std::vector< double > &data, const std::vector< intptr_t > &shape) |
Replaces the data in column labeled label. | |
virtual void | replaceColumn (unsigned int index, const std::vector< double > &data, const std::vector< intptr_t > &shape) |
Replaces the data in column index. | |
void | replaceColumn (unsigned int index, const std::vector< double > &data) |
Replaces the data in column index. | |
virtual void | reserve (unsigned int count) |
Raises assertion as the contained FITS file should not be changed. | |
virtual unsigned int | rows () const |
Returns the number of rows of FITS ASCII or binary table. | |
virtual bool | setLabelAt (const std::string &s, unsigned int index) |
Changes the label of a data column to s. | |
virtual void | setLabels (const std::vector< std::string > &v) |
Assigns the label to each column from the vector of strings @ v. | |
void | setName (const std::string &name) |
Sets the name of the data source. | |
virtual bool | setReleventIndex (const std::string &column, const std::vector< unsigned int > &index) |
In case we are dealing with multidimensional data in rows of this column we would like to deal with on one entry of this multidimensional data. | |
virtual void | setShape (std::vector< unsigned int > &shape) |
Sets the shape of the data elements. | |
virtual void | setTitle (const std::string &title) |
Sets the title of the data source to title. | |
std::size_t | size (unsigned int c) const |
Returns the the column. | |
virtual double | sum (unsigned int column) const |
Returns the sum of all the elements in the sequence of column column. | |
virtual void | throwIfInvalidLabel (const std::string &label) const |
Throws a DataSourceException object if label is not a valid label for this DataSource. | |
void | throwIfInvalidRowSize (const std::vector< double > &row) |
Throws a DataSourceException if the size of the row is not equal to the number of columns, otherwise does nothing. | |
const std::string & | title () const |
Returns a const reference to the title of the data source. | |
virtual double | valueAt (unsigned int row, unsigned int column) const |
Returns the value in the table in position given by the row and column indexes. | |
virtual double | valueAtNoCache (unsigned int row, unsigned int column) const |
Returns the value in the table in position given by the row and column indexes without storing it into cache. | |
virtual | ~FitsNTuple () |
The destructor. | |
Protected Member Functions | |
virtual void | addLabel (const std::string &label) |
Adds a new label for a column. | |
virtual void | checkWidth (const DataSource *source) |
Checks the number of columns. | |
virtual void | copyPrivate (const DataSource &other) |
Copies the contents of the other DataSource. | |
bool | isValidColumn (unsigned int index) const |
Returns true if index is valid, otherwise throws a DataSourceException. | |
void | notifyObservers (Action action) const |
An internal method to iterate over all observers and to send the message action. | |
Protected Attributes | |
std::vector< double > | m_array |
A temporary array that can be returned by const reference. | |
std::vector< std::string > | m_dups |
A list of labels that duplicated others in a DataSource file. | |
std::vector< unsigned int > | m_shape |
The shape of the data. | |
Private Member Functions | |
void | checkLabel (const std::string &label) |
If label already exists for a column, throw DataSourceException, otherwise do nothing. | |
virtual double * | doubleArrayAt (unsigned int row, unsigned int column) const |
Returns data array as double for row and column. | |
int | fillDataCache (unsigned int column) |
Fills the data cache for column column. | |
FitsNTuple () | |
The default constructor. | |
void | initColumns () |
Initializes the columns of the DataSource. | |
Private Attributes | |
std::vector< DataColumn * > | m_columns |
The DataColumn objects that contains the data and its attributes. | |
FitsFile * | m_file |
The FitsFile used for this DataSource. | |
int | m_hdu_num |
The HDU number used for this object. |
typedef void( Observer::*) Action(const Observable *) [inherited] |
typedef std::list< Observer * > ObserverList_t [inherited] |
The type of STL container to maintain list of Observer objects.
Definition at line 45 of file Observable.h.
FitsNTuple | ( | ) | [private] |
The default constructor.
Definition at line 43 of file FitsNTuple.cxx.
FitsNTuple | ( | FitsFile * | file | ) |
A constructor with a FitsFile as argument.
Definition at line 34 of file FitsNTuple.cxx.
References FitsNTuple::initColumns(), FitsNTuple::m_file, and FitsNTuple::m_hdu_num.
~FitsNTuple | ( | ) | [virtual] |
int addColumn | ( | const std::string & | label, | |
const std::vector< double > & | column, | |||
const std::vector< intptr_t > & | shape | |||
) | [virtual] |
Adds a column to the end of the FitsNTuple.
If the number of rows of the input array is the same as that of existing columns adds input array to then end of the FitsNTuple . Gives the column the label label and sets its shape attribute. Returns the index of the newly created column. If the size of the input array differs from the size of existing columns or if the label already exists, then throws a std::runtime_error object.
Reimplemented from DataSource.
Definition at line 246 of file FitsNTuple.cxx.
References DataSource::addLabel(), FitsNTuple::checkLabel(), num_util::data(), FitsNTuple::m_columns, FitsNTuple::rows(), and FitsNTuple::setShape().
int addColumn | ( | const std::string & | label, | |
const std::vector< double > & | column | |||
) | [virtual] |
Adds a column to the end of the FitsNTuple.
If the size of the input array is the same as the size of the existing columns adds input array to then end of the FitsNTuple . Gives the column the label label and sets its shape as a rank 1 array. Returns the index of the newly created column. If the size of the input array differs from the size of existing columns or if the label already exists, then throws a DataSourceException object.
Reimplemented from DataSource.
Definition at line 233 of file FitsNTuple.cxx.
References num_util::shape(), and FitsNTuple::size().
Referenced by hippodraw::Python::export_FitsNTuple(), and FitsNTuple::initColumns().
void addLabel | ( | const std::string & | label | ) | [protected, virtual, inherited] |
Adds a new label for a column.
Definition at line 154 of file DataSource.cxx.
References DataSource::m_labels.
Referenced by RootNTuple::addColumn(), NumArrayTuple::addColumn(), NTuple::addColumn(), ListTuple::addColumn(), and FitsNTuple::addColumn().
void addObserver | ( | Observer * | ) | [inherited] |
Adds an Observer to the Observer list.
Definition at line 52 of file Observable.cxx.
References Observable::m_list.
Referenced by XyPlotter::addDataRep(), FunctionRep::FunctionRep(), BinningProjector::normalizeTo(), DataRepController::setAxisBindings(), DisplayController::setNTuple(), CutPlotter::setNTuple(), and TextPlotter::setParentDataRep().
void addRow | ( | const std::vector< double > & | row | ) | [virtual, inherited] |
Adds a row to the data source.
Since most derived classes are not capable of adding a row, the implementation of this member functions throws std::runtime_error.
Reimplemented in CircularBuffer, NTuple, RTuple, and PyNTuple.
Definition at line 548 of file DataSource.cxx.
Referenced by DataSource::append().
void append | ( | const DataSource * | source | ) | [virtual, inherited] |
Appends the contents of the DataSource source.
Appends the contents of the DataSource source to end by adding rows.
Reimplemented in NTuple, and PyNTuple.
Definition at line 580 of file DataSource.cxx.
References DataSource::addRow(), DataSource::checkWidth(), DataSource::getRow(), DataSource::rows(), and num_util::size().
Referenced by NTuple::append().
void checkLabel | ( | const std::string & | label | ) | [private] |
If label already exists for a column, throw DataSourceException, otherwise do nothing.
Definition at line 221 of file FitsNTuple.cxx.
References DataSource::isValidLabel().
Referenced by FitsNTuple::addColumn().
void checkWidth | ( | const DataSource * | source | ) | [protected, virtual, inherited] |
Checks the number of columns.
Check that the number of columns of source is the same as the receiving object. Throws a std::runtime_error if they are different, otherwise does nothing.
Definition at line 565 of file DataSource.cxx.
References DataSource::columns(), and hippodraw::String::convert().
Referenced by NTuple::append(), and DataSource::append().
void clear | ( | ) | [virtual] |
Clears the data cache; doesn't not modify the contained fits file.
Implements DataSource.
Definition at line 131 of file FitsNTuple.cxx.
References DataColumn::clear(), and FitsNTuple::m_columns.
unsigned int columns | ( | ) | const [inline, inherited] |
Returns the number of columns or data arrays available from this DataSource.
Reimplemented in QtRootNTuple.
Definition at line 458 of file DataSource.h.
References DataSource::m_labels.
Referenced by PyDataSource::addColumn(), ProfileProjector::changedNTuple(), Profile2DProjector::changedNTuple(), MeshProjector::changedNTuple(), MapMatrixProjector::changedNTuple(), Map3Projector::changedNTuple(), Map2Projector::changedNTuple(), Map1Projector::changedNTuple(), EqualEntriesHist1DProjector::changedNTuple(), DyHist2DProjector::changedNTuple(), DyHist1DProjector::changedNTuple(), DataSource::checkWidth(), QtRootNTuple::columns(), PyDataSource::columns(), NTupleSorter::columns(), NTuple::copy(), CreateNTuple::createButtonClicked(), NTupleXML::createChildren(), NTupleProjector::createEmptyNTuple(), NTupleProjector::dataRange(), NTupleProjector::dataRangeWithError(), hippodraw::Python::export_CircularBuffer(), hippodraw::Python::export_DataSource(), DataSource::fillRange(), NTuple::getColumn(), NumArrayTuple::getNumArray(), NTupleProjector::getPos(), NTupleProjector::getPosWithError(), NTuple::getRow(), DataSource::indexOfMaxElement(), DataSource::indexOfMinElement(), DataSource::isValidColumn(), RTuple::operator[](), RootNTuple::replaceColumn(), NumArrayTuple::replaceColumn(), NTuple::replaceColumn(), ListTuple::replaceColumn(), FitsNTuple::replaceColumn(), NTuple::setLabels(), DataSource::sum(), and DataSource::throwIfInvalidRowSize().
void copy | ( | const DataSource & | ) | [virtual] |
Raises exception because with this release, copying the fits table is not supported.
Definition at line 55 of file FitsNTuple.cxx.
void copyPrivate | ( | const DataSource & | other | ) | [protected, virtual, inherited] |
Copies the contents of the other DataSource.
For use by derived classes only.
Definition at line 114 of file DataSource.cxx.
References DataSource::m_ds_name, DataSource::m_is_null, DataSource::m_labels, DataSource::m_shape, and DataSource::m_title.
Referenced by RTuple::copy(), and NTuple::copy().
double * doubleArrayAt | ( | unsigned int | row, | |
unsigned int | column | |||
) | const [private, virtual] |
Returns data array as double for row and column.
Reimplemented from DataSource.
Definition at line 358 of file FitsNTuple.cxx.
References num_util::data(), and FitsNTuple::m_columns.
bool empty | ( | ) | const [virtual] |
Returns true
, if FitsNTuple is empty, i.e.
has no data.
Implements DataSource.
Definition at line 146 of file FitsNTuple.cxx.
References FitsNTuple::rows().
void eraseRow | ( | unsigned int | index | ) | [virtual, inherited] |
Erase a row from the data source.
The implementation throws std::runtime_error.
Reimplemented in NTuple.
Definition at line 556 of file DataSource.cxx.
void expandIfNeeded | ( | const std::vector< std::string > & | labels | ) | const [virtual, inherited] |
Expand the multidimension column if needed.
Do nothing in base class. Reimplemented in RootNTuple.
Reimplemented in QtRootNTuple, and RootNTuple.
Definition at line 602 of file DataSource.cxx.
Referenced by DataRepController::createDataRep(), and DisplayController::createDisplay().
int fillDataCache | ( | unsigned int | column | ) | [private] |
Fills the data cache for column column.
Returns the cfitsio status variable.
Definition at line 113 of file FitsNTuple.cxx.
References num_util::data(), FitsNTuple::fillShape(), FitsNTuple::m_columns, FitsNTuple::m_file, FitsNTuple::setShape(), num_util::shape(), and FitsNTuple::size().
Referenced by FitsNTuple::fillRange(), FitsNTuple::getColumn(), and FitsNTuple::valueAt().
bool fillRange | ( | unsigned int | column, | |
Range & | ||||
) | const [virtual] |
Fills the Range object from data indexed by column.
Returns true
if all the data in the column was valid, otherwise returns false
. Invalid data is +/- HUGE_VAL or NAN. Invalid data is not used in setting the range.
Reimplemented from DataSource.
Definition at line 203 of file FitsNTuple.cxx.
References num_util::data(), FitsNTuple::fillDataCache(), FitsNTuple::m_columns, and Range::setRange().
void fillShape | ( | std::vector< int > & | v, | |
const std::string & | label | |||
) | const [virtual, inherited] |
Fills the vector with the shape of a column.
Returns via the vector v, the shape of the data at column column. Most derived classes will only support a vector in a column. Thus as convenience to implementers of derived classes the implementation of this base class returns a shape of size 1 containing the number of rows.
Definition at line 328 of file DataSource.cxx.
References DataSource::fillShape(), and DataSource::indexOf().
void fillShape | ( | std::vector< int > & | v, | |
unsigned int | column | |||
) | const [virtual, inherited] |
Fills the vector with the shape of a column.
Returns via the vector v, the shape of the data at column column. Most derived classes will only support a vector in a column. Thus as convenience to implementers of derived classes this base class implementation returns a shape of size 1 containing the number of rows.
Reimplemented in RootNTuple.
Definition at line 320 of file DataSource.cxx.
References DataSource::rows().
Referenced by DataSource::fillShape().
void fillShape | ( | std::vector< intptr_t > & | shape, | |
unsigned int | column | |||
) | const [virtual] |
Returns the shape of the column index.
Definition at line 350 of file FitsNTuple.cxx.
References FitsNTuple::getShape(), and FitsNTuple::m_columns.
Referenced by FitsNTuple::fillDataCache().
const vector< double > & getColumn | ( | const std::string & | name | ) | const [virtual, inherited] |
Returns the data in the column with label name.
Reimplemented in NTuple, QtRootNTuple, and RootNTuple.
Definition at line 243 of file DataSource.cxx.
References DataSource::indexOf().
Referenced by PyDataSource::columnAsNumArray(), NTupleXML::createChildren2D(), hippodraw::Python::export_DataSource(), NTupleProjector::fillColumnAfterCuts(), PyDataSource::getColumn(), and ProjectorBase::getZValues().
const vector< double > & getColumn | ( | unsigned int | c | ) | const [virtual] |
Returns the data of the column.
Returns a reference to the total data in column c. If the column contains an array, the size of the vector will the the product of its dimensions including the number of rows of the FITS binary table.
Reimplemented from DataSource.
Definition at line 174 of file FitsNTuple.cxx.
References num_util::data(), FitsNTuple::fillDataCache(), DataSource::isValidColumn(), and FitsNTuple::m_columns.
const vector< string > & getDuplicatedLabels | ( | ) | const [inherited] |
Returns the column labels that were duplicated, or an empty vector.
Definition at line 534 of file DataSource.cxx.
References DataSource::m_dups.
const FitsFile * getFile | ( | ) | const |
Returns the FITS file used to create this object.
Definition at line 62 of file FitsNTuple.cxx.
References FitsNTuple::m_file.
Referenced by FitsController::checkForImage().
const string & getLabelAt | ( | unsigned int | index | ) | const [virtual, inherited] |
Returns the label for the column at index index.
Returns the label for the column at index index, or throws a DataSourceException if index is out of range.
Definition at line 179 of file DataSource.cxx.
References DataSource::isNull(), DataSource::m_labels, and DataSource::title().
Referenced by NTupleXML::createChildren2D(), hippodraw::Python::export_ListTuple(), hippodraw::Python::export_NTuple(), hippodraw::Python::export_NumArrayTuple(), NTupleProjector::getAxisBindings(), NTupleProjector::getXLabel(), NTupleProjector::getYLabel(), Map1Projector::getYLabel(), Profile2DProjector::getZLabel(), MeshProjector::getZLabel(), MapMatrixProjector::getZLabel(), and Map3Projector::getZLabel().
const vector< string > & getLabels | ( | ) | const [virtual, inherited] |
Returns the list of available labels.
Reimplemented in QtRootNTuple.
Definition at line 172 of file DataSource.cxx.
References DataSource::m_labels.
Referenced by Inspector::availPlotTypesActivated(), NTupleProjector::createEmptyNTuple(), hippodraw::Python::export_DataSource(), DisplayController::getDataSourceLabels(), QtRootNTuple::getLabels(), PyDataSource::getLabels(), RootNTuple::getRow(), PyDataSource::replaceColumn(), RootNTuple::smartExpandRootNTuple(), Inspector::updateCutVarGroupBox(), and NTupleController::writeNTupleToFile().
const string & getName | ( | ) | const [inherited] |
Returns the name of the data source.
Definition at line 136 of file DataSource.cxx.
References DataSource::m_ds_name.
Referenced by HiNTupleXML::createElement(), NTupleProjector::getNTupleName(), DataSourceController::registerNTuple(), and NTupleXML::setAttributes().
const Observable::ObserverList_t & getObservers | ( | ) | const [inherited] |
Returns the list of observers.
Definition at line 60 of file Observable.cxx.
References Observable::m_list.
unsigned int getRank | ( | ) | const [inherited] |
Returns the rank of the data source.
Returns the number of axes of the data source, i.e the rank.
Definition at line 343 of file DataSource.cxx.
References DataSource::m_shape.
Referenced by RTuple::operator[](), NTuple::operator[](), and RootNTuple::smartExpandRootNTuple().
const std::vector< double > & getRow | ( | unsigned | int | ) | const [virtual] |
Returns a const reference to slice along the axis known as a row.
Implements DataSource.
Definition at line 190 of file FitsNTuple.cxx.
References DataSource::m_array, FitsNTuple::m_columns, FitsNTuple::size(), and FitsNTuple::valueAt().
const vector< unsigned int > & getShape | ( | ) | const [virtual] |
Returns the shape of the data elements.
Reimplemented from DataSource.
Definition at line 339 of file FitsNTuple.cxx.
References DataSource::m_shape.
Referenced by FitsNTuple::fillShape().
int indexOf | ( | const std::string & | label | ) | const [virtual, inherited] |
Returns the index of the column whose label is label.
Returns the index of the data column whose label is label, or -1 if label does not exist.
Definition at line 193 of file DataSource.cxx.
References DataSource::m_labels.
Referenced by RootNTuple::addColumn(), NumArrayTuple::addColumn(), NTuple::addColumn(), ListTuple::addColumn(), NTupleController::createNTuple(), DataSource::fillShape(), RootNTuple::getColumn(), NTuple::getColumn(), DataSource::getColumn(), QtRootNTuple::getColumnAsArray(), QtRootNTuple::getColumnShape(), NumArrayTuple::getNumArray(), RootNTuple::getTBranch(), NTupleProjector::indexOf(), RootNTuple::initBranches(), FitsNTuple::initColumns(), RootNTuple::isMultiDimensional(), RootNTuple::isUseable(), NumArrayTuple::replaceColumn(), ListTuple::replaceColumn(), FitsNTuple::replaceColumn(), DataSource::replaceColumn(), NTupleProjector::setAxisBinding(), RootNTuple::setReleventIndex(), RootNTuple::smartExpandRootNTuple(), and QtRootNTuple::valueAt().
unsigned int indexOfMaxElement | ( | unsigned int | index | ) | const [virtual, inherited] |
Returns row index of the maximum element in a column for the given column.
Reimplemented in NTuple.
Definition at line 476 of file DataSource.cxx.
References DataSource::columns(), DataSource::rows(), num_util::size(), and DataSource::valueAt().
unsigned int indexOfMinElement | ( | unsigned int | index | ) | const [virtual, inherited] |
Returns row index of the minimum element in a column for the given column.
Reimplemented in NTuple.
Definition at line 497 of file DataSource.cxx.
References DataSource::columns(), DataSource::rows(), num_util::size(), and DataSource::valueAt().
void initColumns | ( | ) | [private] |
Initializes the columns of the DataSource.
Definition at line 69 of file FitsNTuple.cxx.
References FitsNTuple::addColumn(), DataSource::indexOf(), DataSource::m_dups, FitsNTuple::m_file, and FitsNTuple::size().
Referenced by FitsNTuple::FitsNTuple().
bool isMultiDimensional | ( | const std::string & | column | ) | const [virtual, inherited] |
Returns true
if the column contains multidimensional data.
Returns false
. Derived classes should return true
if the column contains multidimensional data.
Reimplemented in QtRootNTuple, and RootNTuple.
Definition at line 451 of file DataSource.cxx.
bool isNull | ( | ) | const [inherited] |
Returns true
if the receiving objects is a null object.
Definition at line 125 of file DataSource.cxx.
References DataSource::m_is_null.
Referenced by ProfileProjector::execute(), Profile2DProjector::execute(), DataSource::getLabelAt(), NTupleProjector::NTupleProjector(), NTupleProjector::setNTuple(), and NTupleProjector::~NTupleProjector().
bool isUseable | ( | const std::string & | column | ) | const [virtual, inherited] |
Returns true
if the column is usable.
Returns true
. Derived classes should return false
if the column is not usable in the context of a DataSource.
Reimplemented in RootNTuple.
Definition at line 458 of file DataSource.cxx.
bool isValidColumn | ( | unsigned int | index | ) | const [protected, inherited] |
Returns true
if index is valid, otherwise throws a DataSourceException.
Definition at line 212 of file DataSource.cxx.
References DataSource::columns(), hippodraw::String::convert(), and num_util::size().
Referenced by RootNTuple::getColumn(), NTuple::getColumn(), FitsNTuple::getColumn(), and DataSource::getColumn().
bool isValidLabel | ( | const std::string & | label | ) | const [inherited] |
Returns true
if label is a valid label for a column in the DataSource.
The search is case sensitive. If the label is not found, returns false
.
Definition at line 257 of file DataSource.cxx.
References DataSource::m_labels.
Referenced by FitsNTuple::checkLabel(), and DataSource::throwIfInvalidLabel().
void notifyObservers | ( | Action | action | ) | const [protected, inherited] |
An internal method to iterate over all observers and to send the message action.
Definition at line 72 of file Observable.cxx.
References Observable::m_list.
void notifyObservers | ( | ) | const [virtual] |
Notifies observers.
Reimplemented from Observable.
Definition at line 91 of file FitsNTuple.cxx.
References Observable::notifyObservers().
Referenced by FitsNTuple::replaceColumn().
double operator[] | ( | std::vector< unsigned int > & | indices | ) | const [virtual] |
Raises assertion as this method is not yet implemented.
Implements DataSource.
Definition at line 153 of file FitsNTuple.cxx.
void removeObserver | ( | Observer * | ) | [inherited] |
Removes an Observer from the Observer list.
Definition at line 66 of file Observable.cxx.
References Observable::m_list.
Referenced by BinningProjector::normalizeTo(), CutPlotter::removeFromTarget(), DisplayController::removeTextObservers(), NTupleProjector::setNTuple(), FunctionRep::willDelete(), FunctionRep::~FunctionRep(), and NTupleProjector::~NTupleProjector().
void replaceColumn | ( | const std::string & | label, | |
const std::vector< double > & | array | |||
) | [virtual, inherited] |
Replaces data in column label with contents of array.
If column label label exists, replace it contents with array, otherwise throw std::runtime_error.
Reimplemented in PyNTuple.
Definition at line 360 of file DataSource.cxx.
References DataSource::indexOf().
Referenced by hippodraw::Python::export_DataSource(), hippodraw::Python::export_FitsNTuple(), PyNTuple::replaceColumn(), and PyDataSource::saveColumnFromNumArray().
void replaceColumn | ( | const std::string & | label, | |
const std::vector< double > & | data, | |||
const std::vector< intptr_t > & | shape | |||
) | [virtual] |
Replaces the data in column labeled label.
If the label is valid and if the size of data is the same as existing columns, then replaces the specified column with a copy of data in data and sets its shape. If the label is not valid or the sizes differ, then throws a DataSourceException.
Reimplemented from DataSource.
Definition at line 321 of file FitsNTuple.cxx.
References DataSource::indexOf(), and FitsNTuple::replaceColumn().
void replaceColumn | ( | unsigned int | index, | |
const std::vector< double > & | data, | |||
const std::vector< intptr_t > & | shape | |||
) | [virtual] |
Replaces the data in column index.
If index is in a valid range and if the size of data is the same as existing columns, then replaces the specified column with a copy of data in data and sets its shape. If index is not a valid range or the sizes differ, then throws a DataSourceException. In neither case is the FITS file modified.
Definition at line 289 of file FitsNTuple.cxx.
References DataSource::columns(), hippodraw::String::convert(), FitsNTuple::m_columns, FitsNTuple::notifyObservers(), FitsNTuple::rows(), FitsNTuple::setShape(), and FitsNTuple::size().
void replaceColumn | ( | unsigned int | index, | |
const std::vector< double > & | data | |||
) | [virtual] |
Replaces the data in column index.
If index is in a valid range and if the size of data is the same as existing columns, then replaces the specified column with a copy of data in data and sets it shape to rank 1 array. If index is not a valid range or the sizes differ, then throws a DataSourceException. In neither case is the FITS file modified.
Reimplemented from DataSource.
Definition at line 279 of file FitsNTuple.cxx.
References num_util::shape(), and FitsNTuple::size().
Referenced by hippodraw::Python::export_FitsNTuple(), and FitsNTuple::replaceColumn().
void reserve | ( | unsigned int | count | ) | [virtual] |
Raises assertion as the contained FITS file should not be changed.
Implements DataSource.
Definition at line 139 of file FitsNTuple.cxx.
unsigned int rows | ( | ) | const [virtual] |
Returns the number of rows of FITS ASCII or binary table.
Implements DataSource.
Definition at line 98 of file FitsNTuple.cxx.
References FitsNTuple::m_file.
Referenced by FitsNTuple::addColumn(), FitsNTuple::empty(), and FitsNTuple::replaceColumn().
bool setLabelAt | ( | const std::string & | s, | |
unsigned int | index | |||
) | [virtual, inherited] |
Changes the label of a data column to s.
s | the new label. | |
index | the column number starting at zero. |
Definition at line 161 of file DataSource.cxx.
References DataSource::m_labels, and Observable::notifyObservers().
void setLabels | ( | const std::vector< std::string > & | v | ) | [virtual, inherited] |
Assigns the label to each column from the vector of strings @ v.
Reimplemented in NTuple.
Definition at line 297 of file DataSource.cxx.
References DataSource::m_labels, and Observable::notifyObservers().
Referenced by hippodraw::Python::export_ListTuple(), hippodraw::Python::export_NumArrayTuple(), RTuple::RTuple(), and NTuple::setLabels().
void setName | ( | const std::string & | name | ) | [inherited] |
Sets the name of the data source.
Definition at line 130 of file DataSource.cxx.
References DataSource::m_ds_name, and Observable::notifyObservers().
Referenced by hippodraw::Python::export_DataSource(), PyDataSource::registerNTuple(), DataSourceController::registerNTuple(), and PyDataSource::setName().
bool setReleventIndex | ( | const std::string & | column, | |
const std::vector< unsigned int > & | index | |||
) | [virtual, inherited] |
In case we are dealing with multidimensional data in rows of this column we would like to deal with on one entry of this multidimensional data.
So here we set index of this relevant entry.
Reimplemented in RootNTuple.
Definition at line 465 of file DataSource.cxx.
void setShape | ( | std::vector< unsigned int > & | shape | ) | [virtual] |
Sets the shape of the data elements.
Sets the shape data elements from the vector shape. The rank is given by the size of the vector. A rank of 2 correspond to table. If the total number of elements in the FitsNTuple is not equal to the product of the shape, then an assertion is raised.
Reimplemented from DataSource.
Definition at line 331 of file FitsNTuple.cxx.
References DataSource::m_shape.
Referenced by FitsNTuple::addColumn(), FitsNTuple::fillDataCache(), and FitsNTuple::replaceColumn().
void setTitle | ( | const std::string & | title | ) | [virtual, inherited] |
Sets the title of the data source to title.
Reimplemented in PyNTuple.
Definition at line 146 of file DataSource.cxx.
References DataSource::m_title, and Observable::notifyObservers().
Referenced by hippodraw::Python::export_DataSource(), NTupleController::readAsciiNTuple(), PyNTuple::setTitle(), and PyDataSource::setTitle().
std::size_t size | ( | unsigned int | c | ) | const |
Returns the the column.
Returns the total size of the column c. If the column contains an array, then the size is the product of shape dimensions, otherwise the size is the number of rows.
Definition at line 104 of file FitsNTuple.cxx.
References FitsNTuple::m_columns.
Referenced by FitsNTuple::addColumn(), FitsNTuple::fillDataCache(), FitsNTuple::getRow(), FitsNTuple::initColumns(), and FitsNTuple::replaceColumn().
double sum | ( | unsigned int | column | ) | const [virtual, inherited] |
Returns the sum of all the elements in the sequence of column column.
Reimplemented in NTuple.
Definition at line 518 of file DataSource.cxx.
References DataSource::columns(), DataSource::rows(), num_util::size(), and DataSource::valueAt().
void throwIfInvalidLabel | ( | const std::string & | label | ) | const [virtual, inherited] |
Throws a DataSourceException object if label is not a valid label for this DataSource.
The exception object contains a message that the label is invalid. Derived classes may over-ride this method with more information on why the label is invalid.
Definition at line 268 of file DataSource.cxx.
References DataSource::isValidLabel().
Referenced by RootNTuple::getColumn(), NTuple::getColumn(), QtRootNTuple::getColumnAsArray(), and QtRootNTuple::valueAt().
void throwIfInvalidRowSize | ( | const std::vector< double > & | row | ) | [inherited] |
Throws a DataSourceException if the size of the row is not equal to the number of columns, otherwise does nothing.
Definition at line 281 of file DataSource.cxx.
References DataSource::columns(), hippodraw::String::convert(), and num_util::size().
Referenced by RTuple::addRow(), NTuple::addRow(), and NTuple::replaceRow().
const string & title | ( | ) | const [inherited] |
Returns a const reference to the title of the data source.
Definition at line 141 of file DataSource.cxx.
References DataSource::m_title.
Referenced by hippodraw::Python::export_DataSource(), DataSource::getLabelAt(), PyDataSource::getTitle(), NTupleProjector::getTitle(), and NTupleController::writeNTupleToFile().
double valueAt | ( | unsigned int | row, | |
unsigned int | column | |||
) | const [virtual] |
Returns the value in the table in position given by the row and column indexes.
Implements DataSource.
Definition at line 161 of file FitsNTuple.cxx.
References num_util::data(), FitsNTuple::fillDataCache(), and FitsNTuple::m_columns.
Referenced by FitsNTuple::getRow().
double valueAtNoCache | ( | unsigned int | row, | |
unsigned int | column | |||
) | const [virtual, inherited] |
Returns the value in the table in position given by the row and column indexes without storing it into cache.
Reimplemented in RootNTuple.
Definition at line 541 of file DataSource.cxx.
References DataSource::valueAt().
Referenced by NTupleController::createNTuple().
std::vector< double > m_array [mutable, protected, inherited] |
A temporary array that can be returned by const reference.
Definition at line 88 of file DataSource.h.
Referenced by DataSource::getColumn(), RootNTuple::getRow(), and FitsNTuple::getRow().
std::vector< DataColumn * > m_columns [private] |
The DataColumn objects that contains the data and its attributes.
Definition at line 38 of file FitsNTuple.h.
Referenced by FitsNTuple::addColumn(), FitsNTuple::clear(), FitsNTuple::doubleArrayAt(), FitsNTuple::fillDataCache(), FitsNTuple::fillRange(), FitsNTuple::fillShape(), FitsNTuple::getColumn(), FitsNTuple::getRow(), FitsNTuple::replaceColumn(), FitsNTuple::size(), and FitsNTuple::valueAt().
std::vector< std::string > m_dups [protected, inherited] |
A list of labels that duplicated others in a DataSource file.
Definition at line 100 of file DataSource.h.
Referenced by DataSource::getDuplicatedLabels(), RootNTuple::initBranches(), and FitsNTuple::initColumns().
The FitsFile used for this DataSource.
Definition at line 42 of file FitsNTuple.h.
Referenced by FitsNTuple::fillDataCache(), FitsNTuple::FitsNTuple(), FitsNTuple::getFile(), FitsNTuple::initColumns(), and FitsNTuple::rows().
int m_hdu_num [private] |
The HDU number used for this object.
The first (primary) HDU is = 1.
Definition at line 47 of file FitsNTuple.h.
Referenced by FitsNTuple::FitsNTuple().
std::vector< unsigned int > m_shape [protected, inherited] |
The shape of the data.
The elements the DataSource can have an arbitrary number of dimensions, called rank. An ordinary table has rank of 2 and the shape is number of columns and number of rows. That is m_shape[0] is number of columns and m_share[1] is number of rows.
Definition at line 96 of file DataSource.h.
Referenced by DataSource::copyPrivate(), DataSource::getRank(), RootNTuple::getShape(), NumArrayTuple::getShape(), ListTuple::getShape(), FitsNTuple::getShape(), DataSource::getShape(), RTuple::operator[](), NTuple::operator[](), RootNTuple::setShape(), NumArrayTuple::setShape(), ListTuple::setShape(), FitsNTuple::setShape(), and DataSource::setShape().