diff --git a/RTCP/Cobalt/GPUProc/share/gpu/kernels/FIR_Filter.cu b/RTCP/Cobalt/GPUProc/share/gpu/kernels/FIR_Filter.cu index 2ce0e70c538f42983c32e3be94363ef3d77a82ff..5d49d4e4ba54398339c2ec9b8a63933126bf0c50 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];