7 #include "qwt_plot_curve.h"
31 printMessage(tr(
"Analyzing PE MetaData from %1").arg(path));
35 QVector<double> xData, y1Data, y2Data, y3Data, y4Data;
37 if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
48 int isRotScan =
false;
50 QRegExp scanRE(
"^#S\\s*(\\d+)\\s+(\\w+)");
51 QRegExp ncolsRE(
"^#N\\s*(\\d+)");
54 QString line = file.readLine();
56 if (line.startsWith(
"#S")) {
57 if (line.contains(scanRE)) {
58 if (isRotScan && (rowNum >= 1200)) {
59 fit1->performFit(10, 80);
60 fit2->performFit(10, 80);
61 fit3->performFit(10, 80);
62 fit4->performFit(10, 80);
66 .arg(fit1->slope(), 20,
'f', 14)
67 .arg(fit1->intercept(), 20,
'f', 14)
68 .arg(fit1->rSquared(), 20,
'f', 14)
69 .arg(fit2->slope(), 20,
'f', 14)
70 .arg(fit2->intercept(), 20,
'f', 14)
71 .arg(fit2->rSquared(), 20,
'f', 14) +
73 .arg(fit3->slope(), 20,
'f', 14)
74 .arg(fit3->intercept(), 20,
'f', 14)
75 .arg(fit3->rSquared(), 20,
'f', 14) +
77 .arg(fit4->slope(), 20,
'f', 14)
78 .arg(fit4->intercept(), 20,
'f', 14)
79 .arg(fit4->rSquared(), 20,
'f', 14));
85 xData.append(scanNumber);
92 scanNumber = scanRE.cap(1).toInt();
93 scanCmd = scanRE.cap(2);
94 isRotScan = (scanCmd ==
"rotscan") && line.contains(
"auxth");
99 }
else if (line.startsWith(
"#D")) {
101 }
else if (line.startsWith(
"#L")) {
103 }
else if (line.startsWith(
"#N")) {
104 if (line.contains(ncolsRE)) {
105 QString f = ncolsRE.cap(1);
112 }
else if (line.startsWith(
"#")) {
114 }
else if (isRotScan) {
118 QStringList fields = line.split(QRegExp(
"\\s+"));
120 if (fields.count() >= ncols) {
121 double x1 = fields[1].toDouble();
122 double y1 = fields[0].toDouble();
124 double x2 = fields[1].toDouble() + fields[2].toDouble();
125 double y2 = fields[0].toDouble();
127 double x3 = fields[1].toDouble();
128 double y3 = fields[3].toDouble();
130 double x4 = fields[3].toDouble();
131 double y4 = fields[0].toDouble();
141 fit1->appendPoint(x1, y1);
142 fit2->appendPoint(x2, y2);
143 fit3->appendPoint(x3, y3);
144 fit4->appendPoint(x4, y4);
151 QwtPlotCurve *pc1 =
new QwtPlotCurve(
"auxth vs spec epoch");
153 pc1->setSamples(xData, y1Data);
155 QwtPlotCurve *pc2 =
new QwtPlotCurve(
"auxth vs det epoch");
157 pc2->setSamples(xData, y2Data);
160 QwtPlotCurve *pc3 =
new QwtPlotCurve(
"index vs spec epoch");
162 pc3->setSamples(xData, y3Data);
164 QwtPlotCurve *pc4 =
new QwtPlotCurve(
"auxth vs index");
166 pc4->setSamples(xData, y4Data);
180 }
else if (r > 0.8) {
182 }
else if (r > 0.4) {
CctwApplication * m_Application
void analyzeSpecDataFile(QString path)
virtual void printMessage(QString msg, QDateTime dt=QDateTime::currentDateTime())
virtual void printLine(QString line)
double normalizedValue(double v)
CctwPEIngressCommand(CctwApplication *app, QString name, QObject *parent)
void plotCurves(QwtPlotCurve *c1, QwtPlotCurve *c2, QwtPlotCurve *c3, QwtPlotCurve *c4)
void analyzePEMetaData(QString path)