qse  0.5.4
qsedatareference.cpp
Go to the documentation of this file.
1 #include "qsedatareference.h"
2 #include "qsedataset.h"
3 
4 QseDataReference::QseDataReference(const QseDataSet *ds, int scan, int xcol, int ycol, int normcol)
5  : m_DataSet(ds),
6  m_Scan(scan),
7  m_XCol(xcol),
8  m_YCol(ycol),
9  m_NormCol(normcol),
10  m_XData(ds->scan(scan)->column(xcol)),
11  m_YData(ds->scan(scan)->column(ycol)),
12  m_NormData(NULL)
13 {
14  if (m_NormCol >= 0) {
15  m_NormData = ds->scan(scan)->column(m_NormCol);
16  }
17 }
18 
19 size_t QseDataReference::size() const
20 {
21  return m_XData->rowCount();
22 }
23 
24 double QseDataReference::x(size_t i) const
25 {
26  return m_XData->data(i);
27 }
28 
29 double QseDataReference::y(size_t i) const
30 {
31  if (m_NormData) {
32  return m_YData->data(i)/m_NormData->data(i);
33  } else {
34  return m_YData->data(i);
35  }
36 }
37 
39 {
41 }
42 
43 QPointF QseDataReference::sample(size_t i) const
44 {
45  return QPointF(x(i), y(i));
46 }
QseScan * scan(int n) const
Definition: qsedataset.cpp:70
const double * data() const
Definition: qsecolumn.cpp:62
QseDataReference * copy() const
const QseColumn * m_YData
QseScan * scan(int n)
size_t size() const
const QseColumn * m_NormData
const QseColumn * m_XData
QPointF sample(size_t i) const
const QseDataSet * m_DataSet
int rowCount() const
Definition: qsecolumn.cpp:48
double y(size_t i) const
double x(size_t i) const
QseDataReference(const QseDataSet *ds, int scan, int xcol, int ycol, int normcol=-1)
QseColumn * column(int n) const
Definition: qsescan.cpp:104