Skip to content

Commit 7fc6713

Browse files
committed
evaluate -> v2
1 parent a91a055 commit 7fc6713

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

petabtests/evaluate.py

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
PREEQUILIBRATION_CONDITION_ID,
88
SIMULATION,
99
)
10+
from petab.v2.C import EXPERIMENT_ID
1011

1112
__all__ = [
1213
"evaluate_llh",
@@ -84,10 +85,27 @@ def absolute_simulations_distance_for_table(
8485
simulations: pd.DataFrame, gt_simulations: pd.DataFrame
8586
):
8687
"""Compute absolute normalized distance between simulations."""
87-
# grouping columns
88-
grouping_cols = [OBSERVABLE_ID, SIMULATION_CONDITION_ID, TIME]
89-
if PREEQUILIBRATION_CONDITION_ID in simulations:
90-
grouping_cols.append(PREEQUILIBRATION_CONDITION_ID)
88+
89+
# check if we have a petab v1 or v2 file
90+
if (
91+
SIMULATION_CONDITION_ID in simulations
92+
and EXPERIMENT_ID not in simulations
93+
):
94+
# v1
95+
# grouping columns
96+
grouping_cols = [OBSERVABLE_ID, SIMULATION_CONDITION_ID, TIME]
97+
if PREEQUILIBRATION_CONDITION_ID in simulations:
98+
grouping_cols.append(PREEQUILIBRATION_CONDITION_ID)
99+
elif (
100+
EXPERIMENT_ID in simulations
101+
and SIMULATION_CONDITION_ID not in simulations
102+
):
103+
# v2
104+
# grouping columns
105+
grouping_cols = [OBSERVABLE_ID, EXPERIMENT_ID, TIME]
106+
else:
107+
raise AssertionError("Unable to determine PEtab version.")
108+
91109
relevant_cols = grouping_cols.copy()
92110
# append simulation column last for correct sorting
93111
relevant_cols.append(SIMULATION)

0 commit comments

Comments
 (0)