General Purpose Geodetic Library
SgGuiPiaReport.cpp
Go to the documentation of this file.
1 /*
2  *
3  * This file is a part of Space Geodetic Library. The library is used by
4  * nuSolve, a part of CALC/SOLVE system, and designed to make analysis of
5  * geodetic VLBI observations.
6  * Copyright (C) 2014-2020 Sergei Bolotin.
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  *
21  */
22 
23 
24 
25 
26 #include <SgGuiPiaReport.h>
27 
28 
29 #if QT_VERSION >= 0x050000
30 # include <QtWidgets/QBoxLayout>
31 # include <QtWidgets/QButtonGroup>
32 # include <QtWidgets/QCheckBox>
33 # include <QtWidgets/QComboBox>
34 # include <QtWidgets/QFrame>
35 # include <QtWidgets/QGroupBox>
36 # include <QtWidgets/QHeaderView>
37 # include <QtWidgets/QLabel>
38 # include <QtWidgets/QLineEdit>
39 # include <QtWidgets/QMessageBox>
40 # include <QtWidgets/QPlainTextEdit>
41 # include <QtWidgets/QPushButton>
42 # include <QtWidgets/QRadioButton>
43 # include <QtWidgets/QSpinBox>
44 #else
45 # include <QtGui/QBoxLayout>
46 # include <QtGui/QButtonGroup>
47 # include <QtGui/QCheckBox>
48 # include <QtGui/QComboBox>
49 # include <QtGui/QFrame>
50 # include <QtGui/QGroupBox>
51 # include <QtGui/QHeaderView>
52 # include <QtGui/QLabel>
53 # include <QtGui/QLineEdit>
54 # include <QtGui/QMessageBox>
55 # include <QtGui/QPlainTextEdit>
56 # include <QtGui/QPushButton>
57 # include <QtGui/QRadioButton>
58 # include <QtGui/QSpinBox>
59 #endif
60 
61 
62 
63 
64 #include <SgVlbiBand.h>
65 #include <SgVlbiObservation.h>
66 
67 
68 
69 
70 
71 
72 
73 /*=======================================================================================================
74 *
75 * SgGuiPiaReport's METHODS:
76 *
77 *======================================================================================================*/
78 //
80  SgVlbiSession* session, QWidget *parent, Qt::WindowFlags f)
81  : QDialog(parent, f)
82 {
83  config_ = config;
84  parametersDescriptor_ = parDescriptor;
85  session_ = session;
86 
88  QString str("finished successfully");
89  if (!isSuccess)
90  str = "failed";
91 
92  setWindowTitle("Automatic data processing " + str);
93  // setWindowModality(Qt::WindowModal);
94 
95  QBoxLayout *layout;
96  QLabel *label;
97  layout = new QVBoxLayout(this);
98 
99  if (isSuccess)
100  {
101  // collect info and diplay it:
102  QList<SgVlbiObservation*> listOfExcludedObs;
103  QStringList listOfStrings;
104  for (int i=0; i<session_->observations().size(); i++)
105  {
109  listOfExcludedObs << obs;
110  };
111  QString str2copyBlName(""), strQCs("");
112  for (int i=0; i<listOfExcludedObs.size(); i++)
113  {
114  SgVlbiObservation *obs=listOfExcludedObs.at(i);
115  SgVlbiObservable *o=obs->primeObs();
116  // need to specify a baseline:
117  str2copyBlName = "";
118  if (session_->baselinesByName().size() > 1)
119  str2copyBlName = " " + obs->baseline()->getKey() + ",";
120  // QC(s):
121  strQCs = "";
122  for (QMap<QString, SgVlbiObservable*>::iterator it_obs=obs->observableByKey().begin();
123  it_obs!=obs->observableByKey().end(); ++it_obs)
124  strQCs += it_obs.key() + ":" + QString("").setNum(it_obs.value()->getQualityFactor()) + ",";
125  if (strQCs.size()>1)
126  strQCs = strQCs.left(strQCs.size() - 1);
127  //
128  str.sprintf("observation #%d,%s %s, %s, QC=(%s) which fits at %.2f +/- %.2f ps",
129  o->getMediaIdx()+1, qPrintable(str2copyBlName),
130  qPrintable(o->src()->getKey()), qPrintable(o->epoch().toString(SgMJD::F_HHMMSS)),
131  qPrintable(strQCs),
132  o->activeDelay()->getResidual()*1.0e12,
133  o->activeDelay()->getSigma()*1.0e12);
134 /*
135  o->measurement(config_)->getResidual()*1.0e12,
136  o->measurement(config_)->getSigma()*1.0e12);
137 */
138  listOfStrings << str;
139  };
140  // display info:
141  int length=0, maxLength=0;
142 
143  layout->addWidget(label=new QLabel("The automatic data analysis of the session " +
144  session_->getSessionCode() + " (" + session_->getName() + ") has been finished.",
145  this));
146  label->setAlignment(Qt::AlignCenter);
147  layout->addSpacing(20);
148  layout->addWidget(label=new QLabel("The summary of operations:",
149  this));
150  label->setAlignment(Qt::AlignLeft);
151  //
152  QGridLayout *grid=new QGridLayout;
153  const QString sYes("Yes"), sNo("No");
154  layout->addLayout(grid);
155  grid->addWidget(new QLabel("Ionoshpere corrections:"), 0,0);
156  grid->addWidget(new QLabel("Group delay ambiguities:"), 1,0);
157  grid->addWidget(new QLabel("Clock breaks found:"), 2,0);
158  grid->addWidget(new QLabel("Outlier processing:"), 3,0);
159  grid->addWidget(new QLabel("Weight correction:"), 4,0);
160 
161  grid->addWidget(new QLabel(session_->isAttr(SgVlbiSessionInfo::Attr_FF_ION_C_CALCULATED)?sYes:sNo),
162  0,1);
163  grid->addWidget(new QLabel(session_->isAttr(SgVlbiSessionInfo::Attr_FF_AMBIGS_RESOLVED)?sYes:sNo),
164  1,1);
165  grid->addWidget(new QLabel(sNo),
166  2,1);
167  grid->addWidget(new QLabel(session_->isAttr(SgVlbiSessionInfo::Attr_FF_OUTLIERS_PROCESSED)?sYes:sNo),
168  3,1);
169  grid->addWidget(new QLabel(session_->isAttr(SgVlbiSessionInfo::Attr_FF_WEIGHTS_CORRECTED)?sYes:sNo),
170  4,1);
171  layout->addSpacing(15);
172 
173  grid=new QGridLayout;
174  layout->addLayout(grid);
175  grid->addWidget(new QLabel("Number of used observations:"), 0,0);
176  grid->addWidget(new QLabel("Weighted root mean squares, ps:"), 1,0);
177 // grid->addWidget(new QLabel("Normalized Chi2:"), 2,0);
178  grid->addWidget(new QLabel("Normalized &chi;<sup>2</sup>:"), 2,0);
179  //
181  grid->addWidget(label=new QLabel(str.sprintf("%d", band->numProcessed(DT_DELAY))),
182  0,1);
183 // label->setAlignment(Qt::AlignRight);
184  grid->addWidget(label=new QLabel(str.sprintf("%.2f", band->wrms(DT_DELAY)*1.0e12)),
185  1,1);
186 // label->setAlignment(Qt::AlignRight);
187  grid->addWidget(label=new QLabel(str.sprintf("%.4f",
188  session->getNumOfDOF()>0.0?band->chi2(DT_DELAY)/session->getNumOfDOF():0.0)),
189  2,1);
190 // label->setAlignment(Qt::AlignRight);
191 // grid->setColumnStretch ( 2, 1);
192  layout->addSpacing(15);
193  //
194  if (listOfStrings.size())
195  {
196  layout->addWidget(label=new QLabel("The list of potentially usable but deselected observations:",
197  this));
198  QPlainTextEdit *otliersDisplay=new QPlainTextEdit(this);
199  layout->addWidget(otliersDisplay);
200  otliersDisplay->setReadOnly(true);
201 
202  // generate the list of removed observations:
203  for (int i=0; i<listOfStrings.size(); i++)
204  {
205  otliersDisplay->appendPlainText(listOfStrings.at(i));
206  length = otliersDisplay->fontMetrics().width(listOfStrings.at(i) + "W");
207  if (maxLength < length)
208  maxLength = length;
209  };
210  if (maxLength>0)
211  otliersDisplay->setMinimumWidth(maxLength);
212  }
213  else
214  layout->addWidget(new QLabel("No observations were deselected.", this));
215  }
216  else
217  {
218  layout->addSpacing(20);
219  layout->addWidget(label=new QLabel(
220  "Cannot perform automatic data analysis of the session " +
221  session_->getSessionCode() + " (" + session_->getName() + ").", this));
222  label->setAlignment(Qt::AlignCenter);
223  layout->addWidget(label=new QLabel("Make the analysis manually.", this));
224  label->setAlignment(Qt::AlignCenter);
225  layout->addSpacing(20);
226  };
227 
228  QFrame *bar=new QFrame(this);
229  bar->setFrameStyle(QFrame::HLine | QFrame::Sunken);
230  layout->addWidget(bar);
231 
232  QBoxLayout *subLayout=new QHBoxLayout();
233  layout->addLayout(subLayout);
234  subLayout->addStretch(1);
235 
236  QPushButton *button;
237  subLayout->addWidget(button=new QPushButton("Close", this));
238  button->setMinimumSize(button->sizeHint());
239  connect(button, SIGNAL(clicked()), SLOT(accept()));
240 };
241 
242 
243 
244 //
246 {
247  config_ = NULL;
248  parametersDescriptor_ = NULL;
249  session_ = NULL;
250  emit windowClosed();
251 };
252 
253 
254 
255 //
257 {
258  QDialog::accept();
259  deleteLater();
260 };
261 /*=====================================================================================================*/
@ DT_DELAY
Definition: SgWrmsable.h:44
bool isAttr(uint a) const
Definition: SgAttribute.h:226
SgVlbiSession * session_
SgParametersDescriptor * parametersDescriptor_
SgTaskConfig * config_
SgGuiPiaReport(SgTaskConfig *, SgParametersDescriptor *, SgVlbiSession *, QWidget *=NULL, Qt::WindowFlags=0)
virtual ~SgGuiPiaReport()
@ F_HHMMSS
Just time: 17:02:43.6.
Definition: SgMJD.h:96
QString toString(Format format=F_Verbose) const
Definition: SgMJD.cpp:1007
const QString & getKey() const
Definition: SgObjectInfo.h:319
int numProcessed(DataType dType) const
Definition: SgObjectInfo.h:351
double chi2(DataType) const
Definition: SgObjectInfo.h:415
double wrms(DataType) const
Definition: SgObjectInfo.h:567
@ Attr_NOT_VALID
omit the observation;
Definition: SgObservation.h:78
int getQualityCodeThreshold() const
Definition: SgTaskConfig.h:817
double getSigma() const
double getResidual() const
const SgMJD & epoch() const
SgVlbiSourceInfo *& src()
SgVlbiMeasurement * activeDelay()
int getMediaIdx() const
SgVlbiBaselineInfo * baseline()
int minQualityFactor() const
SgVlbiObservable * primeObs()
QMap< QString, SgVlbiObservable * > & observableByKey()
const QString & getName() const
@ Attr_FF_WEIGHTS_CORRECTED
weights have been corrected;
@ Attr_FF_ION_C_CALCULATED
ionospheric corrections have been calculated;
@ Attr_FF_OUTLIERS_PROCESSED
outliers have been processed;
@ Attr_FF_AMBIGS_RESOLVED
ambiguities have been resolved;
@ Attr_FF_AUTOPROCESSED
automatic data processing performed successfully;
const QString & getSessionCode() const
SgVlbiBand * primaryBand()
QList< SgVlbiObservation * > & observations()
int getNumOfDOF() const
QMap< QString, SgVlbiBaselineInfo * > & baselinesByName()
SgTaskConfig config
Definition: nuSolve.cpp:59