diff --git a/applications/apertif/commissioning/tests/verify_correlator_db_output.py b/applications/apertif/commissioning/tests/verify_correlator_db_output.py index 5a454efe4c4d140f6561f029ad990d0063765f1a..f6bb8e5ddec66bd12576aa0169d3e256f460d219 100644 --- a/applications/apertif/commissioning/tests/verify_correlator_db_output.py +++ b/applications/apertif/commissioning/tests/verify_correlator_db_output.py @@ -302,10 +302,11 @@ for bui in beamlets: rdVisibilities = [] even = True for data in rdPayload: + dataNtoh = cm.reverse_word(data) # change endianess if even: - visReal = cm.to_signed(data, 32) + visReal = cm.to_signed(dataNtoh, 32) else: - visImag = cm.to_signed(data, 32) + visImag = cm.to_signed(dataNtoh, 32) rdVisibilities.append(complex(visReal, visImag)) even = not even @@ -315,15 +316,31 @@ for bui in beamlets: nonZeroTp = apr.tp_pairs_to_active_tp(nonZeroTpPairs) nonZeroDishes = apr.tp_to_dish_indices(nonZeroTp) nonZeroPolarizations = apr.tp_to_pol_indices(nonZeroTp) + nonZeroAutoVisibilities = apr.get_auto_visibilities(nonZeroTp) - # Assume the BF weights have been set to select at least one ADC input per CB then the input (sky) noise at the ADC - # will contribute to all channels, so the visibilities for the TP pairs of active TP will then be none zero. + # Verify that the active TP yield non-zero visibilities + # . Assume the BF weights have been set to select at least one ADC input per CB then the input (sky) noise at the ADC + # will contribute to all channels, so the visibilities for the TP pairs of active TP will then be none zero. if activeTp == nonZeroTp: tc.append_log(tc.V_INFO_DETAILS, reportStr + 'Non zero TP = %s : polarizations = %s and dishes = %s are OK' % (nonZeroTp, nonZeroPolarizations, nonZeroDishes)) else: tc.append_log(tc.V_ERRORS, reportStr + 'Non zero TP are wrong (read %s != %s expected)' % (nonZeroTp, activeTp)) tc.set_result('FAILED') + # Verify that the auto correlation visibilities for the active TP are real and > 0 + atpFail = [] + for ai in nonZeroAutoVisibilities: + atp2 = apr.visibilities_to_tp_pairs(ai) + atp = atp2[0][0] # get tp from list with one tuple(tp, tp), both tp in tuple are the same index for auto correlation visibility + if not (rdVisibilities[ai].real>0 and rdVisibilities[ai].imag==0): + atpFail.append(atp) + #print ai, atp2, atp, rdVisibilities[ai] + if len(atpFail)==0: + tc.append_log(tc.V_INFO_DETAILS, reportStr + 'Auto correlation for TP = %s : polarizations = %s and dishes = %s are OK' % (nonZeroTp, nonZeroPolarizations, nonZeroDishes)) + else: + tc.append_log(tc.V_ERRORS, reportStr + 'Auto correlation for TP = %s : polarizations = %s and dishes = %s are wrong' % (atpFail, apr.tp_to_pol_indices(tpFail), apr.tp_to_pol_indices(tpFail))) + tc.set_result('FAILED') + ############################################################################### # End