28 #include <QtCore/QDateTime>
29 #include <QtCore/QDir>
30 #include <QtCore/QFile>
31 #include <QtCore/QFileInfo>
32 #include <QtCore/QList>
33 #include <QtCore/QMap>
34 #include <QtCore/QTextStream>
35 #include <QtCore/QVector>
65 extern QMap<QString, QString>
stn2stn;
66 extern QMap<QString, QString>
src2src;
76 const QString& altDatabaseName,
const QString& altCorrelatorName,
77 const QString& historyFileName,
const QString& mapFileName,
bool need2correctRefClocks)
82 QStringList entryList;
83 QRegExp reKombFileName(
"B[0-9]{2,}");
85 QString correlatorComments(historyFileName);
89 QMap<QString, QString> bnd2bnd;
92 if (need2correctRefClocks)
96 files2read = dir.entryList(QDir::Files | QDir::Readable | QDir::NoDotAndDotDot, QDir::Name);
97 if (files2read.size() == 0)
100 "::getDataFromKombFiles(): nothing to read");
109 "::getDataFromKombFiles(): loaded " + QString(
"").setNum(
stn2stn.size()) +
110 " entries for station name maps");
113 "::getDataFromKombFiles(): loaded " + QString(
"").setNum(
src2src.size()) +
114 " entries for source name maps");
117 "::getDataFromKombFiles(): loaded " + QString(
"").setNum(bnd2bnd.size()) +
118 " entries for band code maps");
121 for (
int i=0; i<files2read.size(); i++)
122 if (files2read.at(i).contains(reKombFileName))
123 entryList << files2read.at(i);
125 "::getDataFromKombFiles(): filtered " + QString(
"").setNum(entryList.size()) +
126 " scan entries from " + QString(
"").setNum(files2read.size()) +
" total number of directories");
130 for (
int i=0; i<entryList.size(); i++)
132 const QString &inKombFileName=entryList.at(i);
133 QFileInfo fi(path2data +
"/" + inKombFileName);
134 int kombFileSize=QFileInfo(path2data +
"/" + inKombFileName).size();
135 if (kombFileSize%256 != 0)
137 "::getDataFromKombFiles(): unexpected size of the file " + path2data +
"/" + inKombFileName +
138 ": " + QString(
"").setNum(kombFileSize) +
", skipped");
148 "::getDataFromKombFiles(): nothing useful found");
163 if (altDatabaseName.size() == 9)
168 if (altCorrelatorName.size())
172 "::getDataFromKombFiles(): correlator name was explicitly set to " + altCorrelatorName);
177 "::getDataFromKombFiles(): the database name was explicitly set to " + altDatabaseName);
179 else if (altDatabaseName.size() && altDatabaseName.size()!=9)
181 "::getDataFromKombFiles(): the provided database name, " + altDatabaseName +
185 QMap<double, SgVlbiBand*> bandByFreq;
187 for (
int i=0; i<
bands_.size(); i++)
190 QString bandKey=band->
getKey();
204 "::getDataFromKombFiles(): cannot set up a frequency for " + bandKey +
"-band");
208 "::getDataFromKombFiles(): the frequency " + QString(
"").setNum(band->
getFrequency()) +
209 " is already registered");
218 if (correlatorComments.size()==0)
220 dir.setPath(path2data +
"/../control/");
224 "::getDataFromKombFiles(): cannot get correlator comments, the directory does not exist: " +
229 entryList = dir.entryList(QStringList() <<
"*.corr",
230 QDir::Files | QDir::NoDotAndDotDot | QDir::Readable, QDir::Name);
231 if (entryList.size() == 0)
234 "::getDataFromKombFiles(): cannot get correlator comments, no any *.corr file found: " +
237 else if (entryList.size() > 1)
240 "::getDataFromKombFiles(): found more than one file with correlator comments:");
241 for (
int j=0; j<entryList.size(); j++)
243 "::getDataFromKombFiles(): " + entryList.at(j));
244 str = entryList.at(0);
246 "::getDataFromKombFiles(): picked up this one: " + str);
249 str = entryList.at(0);
252 correlatorComments = path2data +
"/../control/" + str;
254 if (correlatorComments.size())
258 for (
int i=0; i<
bands_.size(); i++)
260 bands_.at(i)->history().addHistoryRecord(
"== The correlator report was not provided. ==",
265 "::getDataFromKombFiles(): the correlator report was not provided.");
271 QString primeBandKey;
275 "::getDataFromKombFiles(): importing typical IVS session");
281 "::getDataFromKombFiles(): importing a foreign session setup");
282 if (bandByFreq.size() > 1)
308 "::getDataFromKombFiles(): " + QString(
"").setNum(num) +
309 " second-band-only observation" + (num==1?
"":
"s") +
" were removed");
314 "::getDataFromKombFiles(): session selfcheck complete");
318 "::getDataFromKombFiles(): the selfcheck for the session failed");
325 for (QMap<QString, SgVlbiObservable*>::iterator it=obs->
observableByKey().begin();
333 "::getDataFromKombFiles(): phase cal delays were calculated");
344 const QMap<QString, QString>&
stn2stn,
const QMap<QString, QString>&
src2src,
345 const QMap<QString, QString>& bnd2bnd)
351 "::processKombFile(): reading KOMB file " + kombFileName);
352 kombReader.
readFile(path2file +
"/" + kombFileName);
353 if (!kombReader.
isOk())
356 "::processKombFile(): the KOMB file " + kombFileName +
" is not Ok; skipped");
366 QString station1Name, station2Name, sourceName, baselineName;
367 QString scanName, scanId, obsKey;
381 bool isSbdSigmaNan, isSbdSigmaInf;
382 bool isGrdSigmaNan, isGrdSigmaInf;
383 bool isPhrSigmaNan, isPhrSigmaInf;
386 double effFreq4GR=0.0, effFreq4PH=0.0, effFreq4RT=0.0;
388 double ap_0, ap_1, ap_2, ap_3, prtOffset;
389 ap_0 = ap_1 = ap_2 = ap_3 = 0.0;
399 "::processKombFile(): the KOMB file " + kombFileName +
" is belong to another session, " + str +
405 for (QMap<QString, QString>::const_iterator it=kombReader.
mapOfBands().begin();
408 bandKey = QString(it.key()).simplified();
415 "::processKombFile(): skipping the observation " + kombFileName +
416 ": the band \"" + bandKey +
"\" have to be skipped");
441 "::processKombFile(): the KOMB file " + kombFileName +
": BD01 record is NULL for the " +
442 bandKey +
"-band; skipped");
448 "::processKombFile(): the KOMB file " + kombFileName +
": BD02 record is NULL for the " +
449 bandKey +
"-band; skipped");
455 "::processKombFile(): the KOMB file " + kombFileName +
": BD03 record is NULL for the " +
456 bandKey +
"-band; skipped");
462 "::processKombFile(): the KOMB file " + kombFileName +
": BD04 record is NULL for the " +
463 bandKey +
"-band; skipped");
469 "::processKombFile(): the KOMB file " + kombFileName +
": BD05 record is NULL for the " +
470 bandKey +
"-band; skipped");
477 sourceName .sprintf(
"%-8s", ob01->
sourceName());
485 "::processKombFile(): skipping the observation " + kombFileName +
486 ": the station \"" + station1Name +
"\" have to be skipped");
492 "::processKombFile(): skipping the observation " + kombFileName +
493 ": the station \"" + station2Name +
"\" have to be skipped");
502 "::processKombFile(): skipping the observation " + kombFileName +
503 ": the source \"" + sourceName +
"\" have to be skipped");
509 baselineName = station1Name +
":" + station2Name;
512 scanName.sprintf(
"%03d-%02d%02d ",
522 if (isinf(f) != 0 || isnan(f) != 0)
525 "::processKombFile(): an observation from KOMB input file \"" + kombFileName +
526 "\" (the baseline " + baselineName +
528 ") contains wrong group delay (NaN or Inf); the observation is skipped",
true);
532 if (isinf(f) != 0 || isnan(f) != 0)
535 "::processKombFile(): an observation from KOMB input file \"" + kombFileName +
536 "\" (the baseline " + baselineName +
538 ") contains wrong delay rate (NaN or Inf); the observation is skipped",
true);
577 station1Info->
setSid(
'-',
'-');
588 station2Info->
setSid(
'-',
'-');
665 if (need2adjust4clocks)
670 dDel = ap_1*prtOffset + 1.0/2.0*ap_2*prtOffset*prtOffset +
671 1.0/6.0*ap_3*prtOffset*prtOffset*prtOffset;
675 dRat = ap_2*prtOffset + 1.0/2.0*ap_3*prtOffset*prtOffset;
692 isSbdSigmaNan = isSbdSigmaInf = isGrdSigmaNan = isGrdSigmaInf = isPhrSigmaNan =
693 isPhrSigmaInf =
false;
699 "::processKombFile(): the observation #" + QString(
"").setNum(obsIdx) +
700 " at the baseline " + baselineName +
" observing " + sourceName +
" source at " +
702 " contains wrong sigma (inf) for the single band delay",
true);
703 isSbdSigmaInf =
true;
709 "::processKombFile(): the observation #" + QString(
"").setNum(obsIdx) +
710 " at the baseline " + baselineName +
" observing " + sourceName +
" source at " +
712 " contains wrong sigma (nan) for the single band delay",
true);
713 isSbdSigmaNan =
true;
723 "::processKombFile(): the observation #" + QString(
"").setNum(obsIdx) +
724 " at the baseline " + baselineName +
" observing " + sourceName +
" source at " +
726 " contains wrong sigma (inf) for the group delay",
true);
727 isGrdSigmaInf =
true;
733 "::processKombFile(): the observation #" + QString(
"").setNum(obsIdx) +
734 " at the baseline " + baselineName +
" observing " + sourceName +
" source at " +
736 " contains wrong sigma (nan) for the group delay",
true);
737 isGrdSigmaNan =
true;
747 "::processKombFile(): the observation #" + QString(
"").setNum(obsIdx) +
748 " at the baseline " + baselineName +
" observing " + sourceName +
" source at " +
750 " contains wrong sigma (inf) for the group delay",
true);
751 isPhrSigmaInf =
true;
757 "::processKombFile(): the observation #" + QString(
"").setNum(obsIdx) +
758 " at the baseline " + baselineName +
" observing " + sourceName +
" source at " +
760 " contains wrong sigma (nan) for the group delay",
true);
761 isPhrSigmaNan =
true;
766 if (isSbdSigmaNan || isSbdSigmaInf ||
767 isGrdSigmaNan || isGrdSigmaInf ||
768 isPhrSigmaNan || isPhrSigmaInf )
770 QString s1(
""), s2(
""), s3(
"");
771 s1 = (isSbdSigmaNan || isGrdSigmaNan || isPhrSigmaNan)?
"(nan)":
"(inf)";
772 if (isSbdSigmaNan || isSbdSigmaInf)
773 s2 =
"single band delay, ";
774 if (isGrdSigmaNan || isGrdSigmaInf)
775 s2+=
"group delay, ";
776 if (isPhrSigmaNan || isPhrSigmaInf)
778 s2 = s2.left(s2.size() - 2);
782 "::processKombFile(): The observation #" + QString(
"").setNum(obsIdx) +
783 ", " + s3 +
" contains wrong sigma " + s1 +
" for " + s2 +
".");
798 nTmp = str.toInt(&isTmp);
851 "::processKombFile(): the observation #" + QString(
"").setNum(obsIdx) +
852 " extracted from the KOMB file " + kombFileName +
853 " at the baseline " + baselineName +
" observing " + sourceName +
" at " +
856 ") that differs from previous data value (" +
861 if (prtOffset != 0.0)
896 for (
int i=0; i<numOfChannels; i++)
943 for (
int i=0; i<numOfChannels; i++)
945 for (
int j=0; j<5; j++)
950 "::processKombFile(): st1 one of phase cal values is NAN " +
951 QString(
"").sprintf(
"(chan=%d:dat=%d)", i, j) +
" from the scan " + obs->
getScanName() +
952 " KOMB file " + kombFileName);
958 "::processKombFile(): st2 one of phase cal values is NAN " +
959 QString(
"").sprintf(
"(chan=%d:dat=%d)", i, j) +
" from the scan " + obs->
getScanName() +
960 " KOMB file " + kombFileName);
const SgMJD tZero(1957, 10, 4)
#define DAY2SEC
radians to mas:
#define DEG2RAD
hours to radians:
QMap< QString, QString > src2src
QMap< QString, QString > stn2stn
void evaluateEffectiveFreqs(const SgVector &numOfAccPeriodsByChan_USB, const SgVector &numOfAccPeriodsByChan_LSB, const SgVector &refFreqByChan, const SgVector &fringeAmplitudeByChan, const SgVector &numOfSamplesByChan_USB, const SgVector &numOfSamplesByChan_LSB, double sampleRate, double refFreq, int numOfChannels, double &effFreq4GR, double &effFreq4PH, double &effFreq4RT, const QString &correlatorType, const QString &oId, bool useEqualWeights=false)
bool isAttr(uint a) const
const char * tapeQualityCode() const
double rfFreqs(int i) const
short totalNumOfProcChannels() const
const SgMJD & tProcByKomb() const
double procRefFreq() const
const char * kombQualityCode() const
double obsDelayRateAtCentrlEpoch() const
float obsTotalPhaseAtReferEpoch() const
float obsTotalPhaseAtEarthCenterEpoch() const
short procPpNumTable(int i, int j) const
float searchWndCoarseDelay(int i) const
double obsDelayAtCentrlEpoch() const
float obsResidPhaseAtEarthCenterEpoch() const
float searchWndFineDelay(int i) const
float searchWndFineDelayRate(int i) const
float obsTotalPhaseAtCentrlEpoch() const
float effectiveIntegrationPeriod() const
const SgMJD & tObsCentral() const
float rejectionRate() const
float phaseCalAmpPhase1(int i, int j) const
double phaseCalRate2() const
double phaseCalRate1() const
float phaseCalAmpPhase2(int i, int j) const
float obsDelaySigma() const
double obsCoarseDelayResid() const
float fringeAmpPhase(int i, int j) const
double obsDelayResid() const
double phaseDelayAtReferEpoch() const
double phaseDelayAtReferEpochPlus_1sec() const
double phaseDelayAtReferEpochMinus_1sec() const
double obsDelayRateResid() const
float obsDelayAmbiguity() const
float falseDetectionProbability() const
double obsDelayRateAtReferEpoch() const
float fineSearchFringeAmplitude() const
double obsCoarseDelayAtReferEpoch() const
float obsCoarseDelaySigma() const
float incohFringeAmplitude() const
float coarseSearchFringeAmplitude() const
float obsDelayRateSigma() const
double obsDelayAtReferEpoch() const
const SgMJD & tStart() const
float videoBandWidth() const
const char * station1Name() const
const SgMJD & tRefer() const
double aPrioriObses(int i) const
double aPrioriClockError() const
const SgMJD & tProcByCorr() const
double aPrioriRefClockOffset() const
const char * station2Name() const
const SgMJD & tFinis() const
const char * sourceName() const
const char * baselineId() const
const char * correlatorFileName() const
float phCalFreqs(int i) const
const SgKombOb03Record & ob03() const
const SgKombBd03Record * bd03(const QString &bandKey) const
const SgKombBd04Record * bd04(const QString &bandKey) const
const SgKombBd05Record * bd05(const QString &bandKey) const
const SgKombBd01Record * bd01(const QString &bandKey) const
const SgKombBd02Record * bd02(const QString &bandKey) const
const SgKombOb01Record & ob01() const
void readFile(const QString &fileName)
const char * experimentCode() const
const QMap< QString, QString > & mapOfBands() const
virtual void write(LogLevel, quint32, const QString &, bool=false)
@ F_YYYYMMDDHHMMSSSS
Long verbose: Fri, the 2nd of Apr, 2010; 17hr 02min 43.6400sec.
@ F_INTERNAL
Digits, date and time: 20100402.71.
QString toString(Format format=F_Verbose) const
int calcDayOfYear() const
static SgMJD currentMJD()
void setElement(unsigned int i, unsigned int j, double d)
double getElement(unsigned int i, unsigned int j) const
void setKey(const QString &key)
void incNumTotal(DataType, int=1)
const QString & getKey() const
virtual int getMediaIdx() const
virtual void setMediaIdx(int idx)
virtual void setMJD(const SgMJD &)
void setElement(unsigned int i, double d)
double getRefClockOffset() const
void setRefClockOffset(double d)
void setFrequency(double f)
void setTCreation(const SgMJD &t)
QMap< QString, SgVlbiBaselineInfo * > & baselinesByName()
QMap< QString, SgVlbiStationInfo * > & stationsByName()
void setInputFileName(const QString &fileName)
void setInputFileVersion(int version)
QMap< int, SgVlbiBaselineInfo * > & baselinesByIdx()
QMap< QString, SgVlbiSourceInfo * > & sourcesByName()
QMap< int, SgVlbiSourceInfo * > & sourcesByIdx()
double getFrequency() const
QMap< int, SgVlbiStationInfo * > & stationsByIdx()
@ Attr_PRIMARY
the band is a primary band;
void setAmbiguitySpacing(double)
void setResidualFringeFitting(double r)
void setGeocenterValue(double)
void setAlternateValue(double)
void setEpochOfCorrelation(const SgMJD &)
const QString & getFourfitOutputFName() const
void setEpochCentral(const SgMJD &)
void setTstart(const SgMJD &t)
void setTotalPhase(double)
double getSampleRate() const
void setIncohSegmAddAmp(double d)
SgMatrix * phaseCalData_2ByChan()
void setAcceptedRatio(double d)
void setTstop(const SgMJD &t)
void setEpochOfFourfitting(const SgMJD &)
SgVector * numOfAccPeriodsByChan_LSB()
void setIncohChanAddAmp(double d)
void setCentrOffset(double offset)
void setEffIntegrationTime(double d)
void setFourfitOutputFName(const QString &)
SgVector * numOfAccPeriodsByChan_USB()
SgVlbiMeasurement & phDRate()
void setGeocenterResidPhase(double d)
void setProbabOfFalseDetection(double d)
void setQualityFactor(int)
void setGeocenterTotalPhase(double d)
void setDiscardRatio(double d)
SgVector * fringeAmplitudeByChan()
void setCorrCoeff(double)
void setEpochOfScan(const SgMJD &)
SgVector * numOfSamplesByChan_LSB()
void setAprioriDra(int i, double d)
void setPhaseCalRates(int i, double d)
void setStopOffset(int offset)
void setErrorCode(const QString &)
SgMatrix * phaseCalData_1ByChan()
SgVector * numOfSamplesByChan_USB()
void setReferenceFrequency(double)
double getReferenceFrequency() const
void allocateChannelsSetupStorages(int numOfChans)
SgVlbiMeasurement & phDelay()
void setTapeQualityCode(const QString &code)
SgVlbiMeasurement & grDelay()
void setStartOffset(int offset)
SgVlbiMeasurement & sbDelay()
SgVector * fringePhaseByChan()
SgVector * refFreqByChan()
void setFourfitSearchParameters(int i, double d)
void setSampleRate(double sr)
void setStation1Idx(short int idx)
void setScanId(const QString &sId)
void setSourceIdx(short int idx)
bool addObservable(const QString &, const SgVlbiObservable &)
void setScanName(const QString &sName)
void setupActiveObservable(const QString &)
void setCorrRootFileName(const QString &sName)
void setStation2Idx(short int idx)
SgVlbiObservable * observable(const QString &)
const QString & getScanName() const
QMap< QString, SgVlbiObservable * > & observableByKey()
void setBaselineIdx(short int idx)
void setKey(const QString &)
const QString & getCorrelatorType() const
void setOfficialName(const QString &name)
void setSchedulerName(const QString &name)
void setSessionCode(const QString &code)
@ OT_KOMB
observations are from KOMB output (generated by NICT, Japan);
void setName(const QString &name)
void setCorrelatorType(const QString &name)
CorrelatorPostProcSoftware cppsSoft_
@ Attr_REF_CLOCKS_ADJUSTED
@ Attr_FF_CREATED
the session has been imported from correlator;//vgosDbMake
@ CPPS_UNKNOWN
unknown (=all others);
void setNetworkSuffix(const QString &suffix)
QString sessionCode_
official session code (from Masterfile);
void setSubmitterName(const QString &name)
void setCorrelatorName(const QString &name)
void setOriginType(OriginType type)
StationsByName stationsByName_
QMap< QString, SgVlbiObservation * > observationByKey_
QList< SgVlbiBand * > bands_
bool getDataFromKombFiles(const QString &path2, const QString &altDatabaseName, const QString &altCorrelatorName, const QString &historyFileName, const QString &mapFileName, bool need2correctRefClocks)
bool selfCheck(bool guiExpected)
void processKombFile(const QString &path2file, const QString &kombFileName, const QMap< QString, QString > &stn2stn, const QMap< QString, QString > &src2src, const QMap< QString, QString > &bnd2bnd)
QMap< QString, SgVlbiBand * > bandByKey_
QList< SgVlbiObservation * > observations_
bool getCorrelatorHistory(const QString &fileName)
QMap< int, SgVlbiStationInfo * > stationsByIdx_
void importMapFile(const QString &mapFileName, QMap< QString, QString > &map4Stn, QMap< QString, QString > &map4Src, QMap< QString, QString > &map4Bnd)
BaselinesByName baselinesByName_
SgVlbiBand * primaryBand_
static QString className()
QMap< int, SgVlbiBaselineInfo * > baselinesByIdx_
SourcesByName sourcesByName_
bool check4NameMap(const QMap< QString, QString > &map, QString &name)
QMap< int, SgVlbiSourceInfo * > sourcesByIdx_
QMap< QString, SgVlbiAuxObservation * > * auxObservationByScanId()
void setSid(char c1, char c2)