discrepantrows = checkwithtaql("select from [select from "+cal1+" where SPECTRAL_WINDOW_ID=="+str(testspw)+" orderby TIME, FIELD_ID, ANTENNA1, ANTENNA2 ] t1, [select from "+cal2+" where SPECTRAL_WINDOW_ID=="+str(testspw)+" orderby TIME, FIELD_ID, ANTENNA1, ANTENNA2 ] t2 where (not all(near(t1."+colname1+",t2."+colname2+", "+str(tolerance)+")))")
from casatools import table
from taskinit import tbtool
A set of common helper functions for unit tests:
compTables - compare two CASA tables
compVarColTables - Compare a variable column of two tables
DictDiffer - a class with methods to take a difference of two
verify_ms - Function to verify spw and channels information in an MS
create_input - Save the string in a text file with the given name
def phasediffabsdeg(c1, c2):
print("Phase difference of real numbers is always zero.")
a = math.atan2(c1.imag, c1.real)
b = math.atan2(c2.imag, c2.real)
def compTables(referencetab, testtab, excludecols, tolerance=0.001, mode="percentage", startrow = 0, nrow = -1, rowincr = 1):
compTables - compare two CASA tables
referencetab - the table which is assumed to be correct
testtab - the table which is to be compared to referencetab
excludecols - list of column names which are to be ignored
tolerance - permitted fractional difference (default 0.001 = 0.1 percent)
mode - comparison is made as "percentage", "absolute", "phaseabsdeg" (for complex numbers = difference of the phases in degrees)