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

Task #5443: Remove 1e-6 scale-down of visibilities -- accepts new output!

parent bc1e817e
No related branches found
No related tags found
No related merge requests found
Showing
with 11 additions and 12 deletions
......@@ -316,7 +316,7 @@ namespace LOFAR
// If all samples flagged, weights is zero.
// TODO: make a lookup table for the expensive division; measure first
float weight = nrValidSamples ? 1e-6f / nrValidSamples : 0;
float weight = nrValidSamples ? 1.0f / nrValidSamples : 0;
applyWeight(bl, ch, weight, output);
}
......
......@@ -90,7 +90,7 @@ TEST(propagateFlags)
CHECK_EQUAL(std::complex<float>(0,0), output.visibilities[idx_baseline][idx_channel][idx_pol1][idx_pol2]);
// 2. station zero and one have no flags, the baselines for these station should be default
float weight_of_unflagged_sample = 1e-6f/1024; // default weighting / number of samples
float weight_of_unflagged_sample = 1.0f/1024; // default weighting / number of samples
for(unsigned idx_baseline = 0; idx_baseline < 3; ++idx_baseline) //bl 0-3 are 0.0 1.0 and 1.1
for(unsigned idx_channel = 1; idx_channel < 4; ++idx_channel) //validate channel ONE and higher
for(unsigned idx_pol1 = 0; idx_pol1 < NR_POLARIZATIONS; ++idx_pol1)
......@@ -101,7 +101,7 @@ TEST(propagateFlags)
// 3. Now check the weights for bl 4 to 6: flagging should be a single flagged sample on the input
// only a single point in time is flagged should result in weight_of_single_sample
float weight_of_single_sample = 1e-6f/(1024 - 1 * NR_TAPS); // 1 * filter width
float weight_of_single_sample = 1.0f/(1024 - 1 * NR_TAPS); // 1 * filter width
for(unsigned idx_baseline = 3; idx_baseline < 6; ++idx_baseline)
for(unsigned idx_channel = 1; idx_channel < 4; ++idx_channel) //validate channel ONE and higher
for(unsigned idx_pol1 = 0; idx_pol1 < NR_POLARIZATIONS; ++idx_pol1)
......@@ -121,7 +121,7 @@ TEST(propagateFlags)
1e-18f); // float compare with this delta
// station 2 and 3: two samples
float weight_of_two_sample = 1e-6f/(1024 - 2 * NR_TAPS); // 1 * filter width
float weight_of_two_sample = 1.0f/(1024 - 2 * NR_TAPS); // 1 * filter width
for(unsigned idx_baseline = 8; idx_baseline < 9; ++idx_baseline)
for(unsigned idx_channel = 1; idx_channel < 4; ++idx_channel) //validate channel ONE and higher
for(unsigned idx_pol1 = 0; idx_pol1 < NR_POLARIZATIONS; ++idx_pol1)
......@@ -269,14 +269,13 @@ TEST(applyWeights)
CHECK_EQUAL(std::complex<float>(0,0), output.visibilities[0][0][0][0]);
CHECK_EQUAL(std::complex<float>(0,0), output.visibilities[2][0][1][1]); // check origin and far corner
// the weighted values should be multiplied with 1e-6 divided
// by the number of samples
CHECK_EQUAL(std::complex<float>(1e-6/n_valid_samples,0), output.visibilities[0][1][0][0]);
CHECK_EQUAL(std::complex<float>(1e-6/n_valid_samples,0), output.visibilities[0][1][1][1]);
// the weighted values should be divided by the number of samples
CHECK_EQUAL(std::complex<float>(1.0/n_valid_samples,0), output.visibilities[0][1][0][0]);
CHECK_EQUAL(std::complex<float>(1.0/n_valid_samples,0), output.visibilities[0][1][1][1]);
// baselines 1
CHECK_EQUAL(std::complex<float>(1e-6/256,0), output.visibilities[1][1][0][0]);
CHECK_EQUAL(std::complex<float>(1e-6/256,0), output.visibilities[1][1][1][1]);
CHECK_EQUAL(std::complex<float>(1.0/256,0), output.visibilities[1][1][0][0]);
CHECK_EQUAL(std::complex<float>(1.0/256,0), output.visibilities[1][1][1][1]);
//baseline 2 no samples so should be zero
CHECK_EQUAL(std::complex<float>(0,0), output.visibilities[2][1][0][0]);
......
......@@ -73,10 +73,10 @@ int main() {
const size_t scaleFactor = nrBitsPerSample == 16 ? 1 : 16;
// The output is the correlation-product of two inputs (with identical
// `inputValue`) and the number of integration blocks, scaled by 1e-6.
// `inputValue`) and the number of integration blocks.
const fcomplex outputValue =
norm(inputValue) * scaleFactor * scaleFactor *
nrBlocksPerIntegration * 1e-6;
nrBlocksPerIntegration;
// Create very simple kernel programs, with predictable output. Skip as much
// as possible. Nr of channels/sb from the parset is 1, so the PPF will not
......
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
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