Skip to content
Snippets Groups Projects
Commit 8f4d65c2 authored by Jan David Mol's avatar Jan David Mol
Browse files

Task #5105: Split geometric delay and clock corrections

parent 077b3012
No related branches found
No related tags found
No related merge requests found
......@@ -199,8 +199,7 @@ namespace LOFAR
d.direction[2] = 0.0;
}
// Add non-geometric delays
d.delay += baseDelay();
d.clockCorrection = clockCorrection();
return d;
}
......@@ -251,11 +250,13 @@ namespace LOFAR
(void)timestamp;
for (size_t sap = 0; sap < result.SAPs.size(); ++sap) {
result.SAPs[sap].SAP.delay = baseDelay();
result.SAPs[sap].SAP.delay = 0.0;
result.SAPs[sap].SAP.clockCorrection = clockCorrection();
if (parset.settings.beamFormer.enabled) {
for (size_t tab = 0; tab < result.SAPs[sap].TABs.size(); tab++) {
result.SAPs[sap].TABs[tab].delay = baseDelay();
result.SAPs[sap].TABs[tab].delay = 0.0;
result.SAPs[sap].TABs[tab].clockCorrection = clockCorrection();
}
}
}
......@@ -263,11 +264,11 @@ namespace LOFAR
#endif
double Delays::baseDelay() const
double Delays::clockCorrection() const
{
double clockCorrection = parset.settings.corrections.clock ? parset.settings.stations[stationIdx].clockCorrection : 0.0;
double corr = parset.settings.corrections.clock ? parset.settings.stations[stationIdx].clockCorrection : 0.0;
return clockCorrection;
return corr;
}
......@@ -359,8 +360,8 @@ namespace LOFAR
vector<ssize_t> coarseDelaysSamples(parset.settings.SAPs.size()); // [sap], in samples
vector<double> coarseDelaysSeconds(parset.settings.SAPs.size()); // [sap], in seconds
for (size_t sap = 0; sap < parset.nrBeams(); ++sap) {
double delayAtBegin = delaysAtBegin.SAPs[sap].SAP.delay;
double delayAfterEnd = delaysAfterEnd.SAPs[sap].SAP.delay;
double delayAtBegin = delaysAtBegin.SAPs[sap].SAP.totalDelay();
double delayAfterEnd = delaysAfterEnd.SAPs[sap].SAP.totalDelay();
// The coarse delay compensation is based on the average delay
// between begin and end.
......@@ -385,12 +386,12 @@ namespace LOFAR
unsigned sap = parset.settings.subbands[subband].SAP;
double coarseDelay = coarseDelaysSeconds[sap];
metaDatas[i].stationBeam.delayAtBegin = delaysAtBegin.SAPs[sap].SAP.delay - coarseDelay;
metaDatas[i].stationBeam.delayAfterEnd = delaysAfterEnd.SAPs[sap].SAP.delay - coarseDelay;
metaDatas[i].stationBeam.delayAtBegin = delaysAtBegin.SAPs[sap].SAP.totalDelay() - coarseDelay;
metaDatas[i].stationBeam.delayAfterEnd = delaysAfterEnd.SAPs[sap].SAP.totalDelay() - coarseDelay;
for (size_t tab = 0; tab < metaDatas[i].TABs.size(); ++tab) {
metaDatas[i].TABs[tab].delayAtBegin = delaysAtBegin.SAPs[sap].TABs[tab].delay - coarseDelay;
metaDatas[i].TABs[tab].delayAfterEnd = delaysAfterEnd.SAPs[sap].TABs[tab].delay - coarseDelay;
metaDatas[i].TABs[tab].delayAtBegin = delaysAtBegin.SAPs[sap].TABs[tab].totalDelay() - coarseDelay;
metaDatas[i].TABs[tab].delayAfterEnd = delaysAfterEnd.SAPs[sap].TABs[tab].totalDelay() - coarseDelay;
}
}
}
......
......@@ -97,12 +97,18 @@ namespace LOFAR
struct Delay {
double direction[3];
double delay;
double clockCorrection;
double totalDelay() const {
return delay + clockCorrection;
}
bool operator==(const Delay &other) const {
return direction[0] == other.direction[0] &&
direction[1] == other.direction[1] &&
direction[2] == other.direction[2] &&
delay == other.delay;
delay == other.delay &&
clockCorrection == other.clockCorrection;
}
};
......@@ -186,8 +192,8 @@ namespace LOFAR
// in `result'.
void calcDelays( const TimeStamp &timestamp, AllDelays &result );
// Returns the non-geometric delay to add for this station
double baseDelay() const;
// Returns the clock correction delay to add for this station
double clockCorrection() const;
#ifdef HAVE_CASACORE
casa::MVEpoch toUTC( const TimeStamp &timestamp ) const;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment