General class for handling 2D tables - xy data, for example.
More...
#include <table_2d.h>
|
| enum | type { HISTOGRAM,
XYDATA
} |
| |
|
|
Ty | sumy () const |
| | Sum of all y values (same as count())
|
| |
| | Table2D (Tx resolution=0.2, type key=XYDATA) |
| | Constructor. More...
|
| |
|
std::map< std::string, std::vector< double > > | to_map () |
| | Convert to map.
|
| |
|
void | clear () |
| |
|
void | setResolution (Tx resolution) |
| |
|
void | setResolution (std::vector< Tx > &resolution) |
| |
|
Ty & | operator() (Tx x) |
| | Access operator - returns reference to y(x)
|
| |
|
Ty & | operator() (std::vector< Tx > &x) |
| | Access operator - returns reference to y(x)
|
| |
|
Ty | find (std::vector< Tx > &x) |
| | Find key and return corresponding value otherwise zero.
|
| |
|
template<class T = double> |
| void | save (const std::string &filename, T scale=1, T translate=0) |
| | Save table to disk.
|
| |
|
template<class T = double> |
| void | normSave (const std::string &filename) |
| | Save normalized table to disk.
|
| |
|
template<class T = double> |
| void | sumSave (std::string filename, T scale=1) |
| | Sums up all previous elements and saves table to disk.
|
| |
|
const Tmap & | getMap () const |
| |
|
Tmap & | getMap () |
| |
|
Tx | getResolution () |
| |
| Tx | mean () |
| |
| Tx | std () |
| |
| Tmap::const_iterator | min () |
| |
| Tmap::const_iterator | max () |
| |
| Tx | minx () |
| |
| Ty | avg (const std::vector< Tx > &limits) |
| |
|
std::vector< double > | hist2buf (int &size) |
| | Convert table2D to vector of floats.
|
| |
|
void | buf2hist (std::vector< double > &v) |
| | Convert vector of floats to table2D.
|
| |
| bool | load (const std::string &filename) |
| | Load table from disk. More...
|
| |
|
Eigen::MatrixXd | tableToMatrix () |
| | Convert table to matrix.
|
| |
|
|
typedef std::map< Tx, Ty > | Tmap |
| |
|
|
Tx | dx |
| |
|
Tmap | map |
| |
|
std::string | name |
| |
template<typename Tx, typename Ty>
class Faunus::Table2D< Tx, Ty >
General class for handling 2D tables - xy data, for example.
- Date
- Lund 2011
- Note
Tx is used as the std::map key and which may be problematic due to direct floating point comparison (== operator). We have not experienced any issues with this, though. This uses std::map and table lookup is of complexity logarithmic with N.
◆ Table2D()
template<typename Tx, typename Ty>
Constructor.
- Parameters
-
| resolution | Resolution of the x axis |
| key | Table type: HISTOGRAM or XYDATA |
◆ avg()
template<typename Tx, typename Ty>
Returns average in interval
◆ load()
template<typename Tx, typename Ty>
Load table from disk.
- Note
- The first line - used for comments - is ignored.
- Todo:
- Implement end bin compensation as in the save() function when loading HISTOGRAMs
◆ max()
template<typename Tx, typename Ty>
Returns iterator of maximum y
◆ mean()
template<typename Tx, typename Ty>
◆ min()
template<typename Tx, typename Ty>
Returns iterator of minumum y
◆ minx()
template<typename Tx, typename Ty>
◆ std()
template<typename Tx, typename Ty>
Returns standard deviation
The documentation for this class was generated from the following file: