Skip to content

Commit f68e095

Browse files
committed
v2: Remove redundant CheckAllObservablesDefined
There is already .
1 parent ef79523 commit f68e095

File tree

1 file changed

+3
-30
lines changed

1 file changed

+3
-30
lines changed

petab/v2/lint.py

Lines changed: 3 additions & 30 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,8 @@ 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 observable table."
266265
)
267266

268267
return None
@@ -290,7 +289,7 @@ def run(self, problem: Problem) -> ValidationIssue | None:
290289
except KeyError:
291290
messages.append(
292291
f"Observable {m.observable_id} used in measurement "
293-
f"table is not defined."
292+
f"table is not defined in the observable table."
294293
)
295294
continue
296295

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

445444

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-
471445
class CheckUniquePrimaryKeys(ValidationTask):
472446
"""Check that all primary keys are unique."""
473447

@@ -1092,7 +1066,6 @@ def get_placeholders(
10921066
# CheckVisualizationTable(),
10931067
# TODO validate mapping table
10941068
CheckValidParameterInConditionOrParameterTable(),
1095-
CheckAllObservablesDefined(),
10961069
CheckAllParametersPresentInParameterTable(),
10971070
CheckValidConditionTargets(),
10981071
CheckPriorDistribution(),

0 commit comments

Comments
 (0)