def test_evalformat(self): ex = Experiment() ex.addOutputFile(test_out) ex.collectData() for (index, indexsplit) in ((index, indexsplit) for index in eval_index for indexsplit in eval_indexsplit): for (cols, fgs) in ((cols, fgs) for cols in self.test_cols for fgs in self.test_fgs): ev = IPETEvaluation(index=index, indexsplit=indexsplit) if cols is not None: for (ind_c, ind_a) in cols: col = IPETEvaluationColumn(**columns[ind_c]) if col_filters[ind_c] is not None: colfilter = IPETFilter(**col_filters[ind_c]) col.addFilter(colfilter) if ind_a: agg = Aggregation(**aggs[ind_c]) col.addAggregation(agg) ev.addColumn(col) if fgs is not None: for ind in fgs: fg = IPETFilterGroup(**filtergroups[ind]) if filters[ind] is not None: fgfilter = IPETFilter(**filters[ind]) fg.addFilter(fgfilter) ev.addFilterGroup(fg) try: tab_long, tab_agg = ev.evaluate(ex) except AttributeError as e: self.assertTrue(( cols is None or fgs is None ), "Either the number of columns or the number of filtergroups should be 0." ) continue self.assertEqual(type(tab_long), pd.DataFrame, "Type of long table wrong.") self.assertEqual(type(tab_agg), pd.DataFrame, "Type of aggregated table wrong.") # do not allow rowindex to be empty if indexsplit == 0: indexsplit = 1 rowindex_level = len(index.split()[:indexsplit]) columns_level = len(index.split()[indexsplit:]) self.assertEqual(tab_long.columns.nlevels, columns_level + 1, "Level of columnindex of long table wrong.") self.assertEqual(tab_agg.index.nlevels, columns_level + 1, "Level of rowindex of agg table wrong.") self.assertEqual(tab_long.index.nlevels, rowindex_level, "Level of rowindex of long table wrong.")
def setUp(self): """Set up the evaluation The evaluation has only one column for the 'Data' key, but applies filtering on the 'FilterData' key """ self.ex = HelperExperiment() ev = IPETEvaluation(index="Index", indexsplit="1") ev.addColumn(IPETEvaluationColumn(origcolname="Data")) fg = IPETFilterGroup("TestGroup") fi = IPETFilter(expression1="FilterData", expression2=-1.0, operator="eq") fg.addFilter(fi) ev.addFilterGroup(fg) self.ev = ev
def setUp(self): self.ex = HelpExperiment() ev = IPETEvaluation(defaultgroup="C1", index="A C" ) ev.addColumn(IPETEvaluationColumn(origcolname="D")) fg = IPETFilterGroup("Test") fi = IPETFilter(operator="keep", datakey="A") fi.addChild(IPETValue("A1")) fg.addFilter(fi) fg2 = IPETFilterGroup("Test2") fi2 = IPETFilter(operator="keep", datakey="A") fi2.addChild(IPETValue("A2")) fg2.addFilter(fi2) ev.addFilterGroup(fg2) ev.addFilterGroup(fg) self.ev = ev self.fg = fg
def setUp(self): """ create an evaluation around a helper experiment """ self.ex = HelpExperiment() ev = IPETEvaluation(defaultgroup="C1", index="A B C", fillin=True, indexsplit=3) ev.addColumn( IPETEvaluationColumn(origcolname="D", alternative="100", maxval=15)) fg = IPETFilterGroup("Test") fi = IPETFilter(operator="keep", datakey="A") fi.addChild(IPETValue("A1")) fg.addFilter(fi) ev.addFilterGroup(fg) self.ev = ev self.fg = fg
def createAndEvaluateColumn(self, col): ev = IPETEvaluation(index="A B C", indexsplit=3) ev.addColumn(col) ev.evaluate(self.helper) return ev