|
7 | 7 | PREEQUILIBRATION_CONDITION_ID,
|
8 | 8 | SIMULATION,
|
9 | 9 | )
|
| 10 | +from petab.v2.C import EXPERIMENT_ID |
10 | 11 |
|
11 | 12 | __all__ = [
|
12 | 13 | "evaluate_llh",
|
@@ -84,10 +85,27 @@ def absolute_simulations_distance_for_table(
|
84 | 85 | simulations: pd.DataFrame, gt_simulations: pd.DataFrame
|
85 | 86 | ):
|
86 | 87 | """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 | + |
91 | 109 | relevant_cols = grouping_cols.copy()
|
92 | 110 | # append simulation column last for correct sorting
|
93 | 111 | relevant_cols.append(SIMULATION)
|
|
0 commit comments