Skip to content

Commit

Permalink
remove visualization df if invalid (#316)
Browse files Browse the repository at this point in the history
* Remove the visualization table if it has observables that are not in the flattened observable table.

Co-authored-by: Dilan Pathirana <[email protected]>
  • Loading branch information
m-philipps and dilpath authored Nov 8, 2024
1 parent 09661eb commit 51db0dd
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions petab/v1/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,20 @@ def flatten_timepoint_specific_output_overrides(
petab_problem.observable_df.index.name = OBSERVABLE_ID
petab_problem.measurement_df = pd.concat(new_measurement_dfs)

# remove visualization df if it uses observables that are not in the
# flattened PEtab problem
if petab_problem.visualization_df is not None:
assert petab_problem.observable_df.index.name == OBSERVABLE_ID
if not all(
petab_problem.observable_df.index.isin(
petab_problem.visualization_df[Y_VALUES]
)
):
petab_problem.visualization_df = None
logger.warning(
"Removing visualization table from flattened PEtab problem."
)


def unflatten_simulation_df(
simulation_df: pd.DataFrame,
Expand Down

0 comments on commit 51db0dd

Please sign in to comment.