From c5f103b43e46b3b0ca7d28f18e5766b2da23f8eb Mon Sep 17 00:00:00 2001 From: Sarod Yatawatta <yatawatta@astron.nl> Date: Mon, 14 Dec 2020 16:38:48 +0000 Subject: [PATCH] COB-153: simplify phi calculation --- RTCP/Cobalt/GPUProc/share/gpu/kernels/FIR_Filter.cu | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/RTCP/Cobalt/GPUProc/share/gpu/kernels/FIR_Filter.cu b/RTCP/Cobalt/GPUProc/share/gpu/kernels/FIR_Filter.cu index 2ce0e70c538..5d49d4e4ba5 100644 --- a/RTCP/Cobalt/GPUProc/share/gpu/kernels/FIR_Filter.cu +++ b/RTCP/Cobalt/GPUProc/share/gpu/kernels/FIR_Filter.cu @@ -207,18 +207,17 @@ __global__ void FIR_filter( void *filteredDataPtr, // We only need the term that changes with t, so discard the rest // and only keep : 2 pi f (tau_1 - tau_0) (t/T) for the rest of calculations // also replace f with f/f_s where f_s is sample frequency = clock/1024 - const double phiGradient = 2.0 * M_PI * (subbandFrequency / (CLOCK_MHZ*1e6/1024.0) )*( delayAfterEnd - delayAtBegin )/NR_SAMPLES_PER_CHANNEL; - + // phi = phiGradient x blockOffset // Offset of this sample between begin and end. = t/T fraction, within one FFT block of NR_CHANNELS - const double blockOffset = double(channel) / NR_CHANNELS; - // Interpolate the required phase rotation for this sample. + const double phi = 2.0 * M_PI * (subbandFrequency / (CLOCK_MHZ*1e6/1024.0) )*( delayAfterEnd - delayAtBegin )/NR_SAMPLES_PER_CHANNEL * double(channel)/NR_CHANNELS; + // // Use double precision here, when phi~=0, error in cos() is minimum // but error in sin() is highest, and will affect most baselines (whose Doppler effect ~=0) // Note: both X and Y polarizations will have same correction // so real=cos(phi), imag=sin(phi) correction factor // phi=phiGradient * blockOffset - const float FACTOR=sincos_d2f_select(phiGradient * blockOffset, ri); + const float FACTOR=sincos_d2f_select(phi, ri); #endif //# const float16 weights = (*weightsData)[channel]; -- GitLab