Skip to content

Commit b0f4c4f

Browse files
dweindldilpath
andauthored
v2: Remove redundant CheckAllObservablesDefined (#399)
There is already `CheckMeasuredObservablesDefined`. Co-authored-by: Dilan Pathirana <[email protected]>
1 parent c6d4cab commit b0f4c4f

File tree

1 file changed

+5
-31
lines changed

1 file changed

+5
-31
lines changed

petab/v2/lint.py

Lines changed: 5 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
"CheckUnusedExperiments",
4040
"CheckObservablesDoNotShadowModelEntities",
4141
"CheckUnusedConditions",
42-
"CheckAllObservablesDefined",
4342
"CheckPriorDistribution",
4443
"lint_problem",
4544
"default_validation_tasks",
@@ -261,8 +260,9 @@ def run(self, problem: Problem) -> ValidationIssue | None:
261260
}
262261
if undefined_observables := (used_observables - defined_observables):
263262
return ValidationError(
264-
f"Observables {undefined_observables} used in "
265-
"measurement table but not defined in observable table."
263+
f"Observable(s) {undefined_observables} are used in the "
264+
"measurement table but are not defined in the observable "
265+
"table."
266266
)
267267

268268
return None
@@ -289,8 +289,8 @@ def run(self, problem: Problem) -> ValidationIssue | None:
289289
expected = observable_parameters_count[m.observable_id]
290290
except KeyError:
291291
messages.append(
292-
f"Observable {m.observable_id} used in measurement "
293-
f"table is not defined."
292+
f"Observable {m.observable_id} is used in the measurement "
293+
f"table but is not defined in the observable table."
294294
)
295295
continue
296296

@@ -443,31 +443,6 @@ def run(self, problem: Problem) -> ValidationIssue | None:
443443
return None
444444

445445

446-
class CheckAllObservablesDefined(ValidationTask):
447-
"""A task to validate that all observables in the measurement table are
448-
defined in the observable table."""
449-
450-
def run(self, problem: Problem) -> ValidationIssue | None:
451-
if problem.measurement_df is None:
452-
return None
453-
454-
measurement_df = problem.measurement_df
455-
observable_df = problem.observable_df
456-
used_observables = set(measurement_df[OBSERVABLE_ID].values)
457-
defined_observables = (
458-
set(observable_df.index.values)
459-
if observable_df is not None
460-
else set()
461-
)
462-
if undefined_observables := (used_observables - defined_observables):
463-
return ValidationError(
464-
f"Observables {undefined_observables} are used in the"
465-
"measurements table but are not defined in observables table."
466-
)
467-
468-
return None
469-
470-
471446
class CheckUniquePrimaryKeys(ValidationTask):
472447
"""Check that all primary keys are unique."""
473448

@@ -1092,7 +1067,6 @@ def get_placeholders(
10921067
# CheckVisualizationTable(),
10931068
# TODO validate mapping table
10941069
CheckValidParameterInConditionOrParameterTable(),
1095-
CheckAllObservablesDefined(),
10961070
CheckAllParametersPresentInParameterTable(),
10971071
CheckValidConditionTargets(),
10981072
CheckPriorDistribution(),

0 commit comments

Comments
 (0)