From c9e335daa88c932f9b09d49474ce25760a0d0884 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20J=C3=BCrges?= <jurges@astron.nl> Date: Thu, 17 Jan 2019 17:04:48 +0000 Subject: [PATCH] SW-546: Add comments describing how the offset is calculated --- RTCP/Cobalt/OutputProc/src/TBB_Dipole.cc | 29 +++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/RTCP/Cobalt/OutputProc/src/TBB_Dipole.cc b/RTCP/Cobalt/OutputProc/src/TBB_Dipole.cc index 18235a010f9..b641d35930e 100644 --- a/RTCP/Cobalt/OutputProc/src/TBB_Dipole.cc +++ b/RTCP/Cobalt/OutputProc/src/TBB_Dipole.cc @@ -316,14 +316,33 @@ namespace LOFAR * first received frame. */ uint64_t offset = frame.header.time - itsDumpInfo.itsTime0; - // Convert the offset in [s] to bytes. sampleFreq is in MHz. + /** + * Convert the offset in [s] to samples containing a complex numbers of + * two 16 bit integers. sampleFreq is in MHz. + */ offset *= (frame.header.sampleFreq * 1000000U); /** - * Divide the offset by the size of an FFT block. The result is an index - * for the current data frame. + * Divide the offset, i.e. the number of samples by the size of an FFT + * block. The result is the index of the raw voltage sampling window + * (size 1024 values) that got fed into the FFT. This not a sample within + * the window but just a rough indicator which window we are in! + * [ 1024 ][ 1024 ][ 1024 ] + * ^ + * | Start recording + * ^ + * | Window number of the 0th TBB data frame + * ^ + * | Window number of frame N + * This is also then the index of the TBB frame for this frequency because + * the begin of a voltage window is also the begin of a frequency window. */ offset /= SPECTRAL_TRANSFORM_SIZE; + /** + * Now try to figure out where in the raw voltage data window our spectral + * frame exactly begins. + */ + /** * NOTE: * untested body: when can I have enough test data from a working @@ -343,6 +362,10 @@ namespace LOFAR * second: * 1 extra slice fitted in that second */ + /** + * TODO + * Is this still needed? Sander/Thomas need to look into this. + */ offset += 1; // avoid duplicate offset compensation next time0 += 1; -- GitLab