MCPcopy Create free account
hub / github.com/Kitware/VTK / CompareTables

Function CompareTables

Filters/Statistics/Testing/Python/TestVisualStatistics.py:26–52  ·  view source on GitHub ↗
(result, expected)

Source from the content-addressed store, hash-verified

24 return array
25
26def CompareTables(result, expected):
27 if result.GetNumberOfColumns() != expected.GetNumberOfColumns():
28 print(' ERROR: Column count mismatch')
29 return False
30 status = True
31 for cc in range(result.GetNumberOfColumns()):
32 rc = result.GetColumn(cc)
33 ec = expected.GetColumnByName(rc.GetName())
34 if rc.IsNumeric() and ec.IsNumeric():
35 nn = rc.GetNumberOfTuples()
36 for ii in range(nn):
37 rv = np.array(rc.GetTuple(ii))
38 ev = np.array(ec.GetTuple(ii))
39 if np.any(rv != ev):
40 srv = ' '.join([str(xx) for xx in rv])
41 sev = ' '.join([str(xx) for xx in ev])
42 print(f' ERROR: {rc.GetName()} values mismatched at row {ii}: {srv}, expected {sev}')
43 status = False
44 else:
45 nn = rc.GetNumberOfValues()
46 for ii in range(nn):
47 rv = rc.GetValue(ii)
48 ev = ec.GetValue(ii)
49 if rv != ev:
50 print(f' ERROR: {rc.GetName()} values mismatched at row {ii}: {rv}, expected {ev}')
51 status = False
52 return status
53
54def TestAggregation(algo, model, summaryTab, histoTab, expected):
55 """Test that aggregating a statistical model with a copy of itself is computed properly."""

Callers 2

TestAggregationFunction · 0.70
VisualStatisticsTestFunction · 0.70

Calls 15

strFunction · 0.85
GetColumnByNameMethod · 0.80
arrayMethod · 0.80
printFunction · 0.50
rangeClass · 0.50
GetNumberOfColumnsMethod · 0.45
GetColumnMethod · 0.45
GetNameMethod · 0.45
IsNumericMethod · 0.45
GetNumberOfTuplesMethod · 0.45
GetTupleMethod · 0.45
anyMethod · 0.45

Tested by

no test coverage detected