petab.v2.lint

Validation of PEtab problems

Module Attributes

default_validation_tasks

Validation tasks that should be run on any PEtab problem

Functions

get_placeholders(problem[, observable, noise])

Get all placeholder parameters from observable table observableFormulas and noiseFormulas.

get_required_parameters_for_parameter_table(problem)

Get the set of parameters that need to go into the parameter table

get_valid_parameters_for_parameter_table(problem)

Get the set of parameters which may be present inside the parameter table

lint_problem(problem)

Validate a PEtab problem.

Classes

CheckAllParametersPresentInParameterTable()

Ensure all required parameters are contained in the parameter table with no additional ones.

CheckExperimentConditionsExist()

A task to validate that all conditions in the experiment table exist in the condition table.

CheckExperimentTable()

A task to validate the experiment table of a PEtab problem.

CheckInitialChangeSymbols()

Check that changes of any first period of any experiment only refers to allowed symbols.

CheckMeasuredExperimentsDefined()

A task to check that all experiments referenced by measurements are defined.

CheckMeasuredObservablesDefined()

A task to check that all observables referenced by the measurements are defined.

CheckMeasurementModelId()

Validate model IDs of measurements.

CheckModel()

A task to validate the model of a PEtab problem.

CheckObservablesDoNotShadowModelEntities()

A task to check that observable IDs do not shadow model entities.

CheckOverridesMatchPlaceholders()

A task to check that the number of observable/noise parameters in the measurements matches the number of placeholders in the observables.

CheckPosLogMeasurements()

Check that measurements for observables with log-transformation are positive.

CheckPriorDistribution()

A task to validate the prior distribution of a PEtab problem.

CheckProblemConfig()

A task to validate the configuration of a PEtab problem.

CheckUndefinedExperiments()

A task to check for experiments that are used in the measurement table but not defined in the experiment table.

CheckUniquePrimaryKeys()

Check that all primary keys are unique.

CheckUnusedConditions()

A task to check for conditions that are not used in the experiment table.

CheckUnusedExperiments()

A task to check for experiments that are not used in the measurement table.

CheckValidConditionTargets()

Check that all condition table targets are valid.

CheckValidParameterInConditionOrParameterTable()

A task to check that all required and only allowed model parameters are present in the condition or parameter table.

ValidationError(message[, task])

A validation result with level ERROR.

ValidationIssue(level, message[, task])

The result of a validation task.

ValidationIssueSeverity(*values)

The severity of a validation issue.

ValidationResultList([iterable])

A list of validation results.

ValidationTask()

A task to validate a PEtab problem.

ValidationWarning(message[, task])

A validation result with level WARNING.

class petab.v2.lint.CheckAllParametersPresentInParameterTable[source]

Bases: ValidationTask

Ensure all required parameters are contained in the parameter table with no additional ones.

run(problem: Problem) ValidationIssue | None[source]

Run the validation task.

Parameters:

problem – PEtab problem to check.

Returns:

Validation results or None

class petab.v2.lint.CheckExperimentConditionsExist[source]

Bases: ValidationTask

A task to validate that all conditions in the experiment table exist in the condition table.

run(problem: Problem) ValidationIssue | None[source]

Run the validation task.

Parameters:

problem – PEtab problem to check.

Returns:

Validation results or None

class petab.v2.lint.CheckExperimentTable[source]

Bases: ValidationTask

A task to validate the experiment table of a PEtab problem.

run(problem: Problem) ValidationIssue | None[source]

Run the validation task.

Parameters:

problem – PEtab problem to check.

Returns:

Validation results or None

class petab.v2.lint.CheckInitialChangeSymbols[source]

Bases: ValidationTask

Check that changes of any first period of any experiment only refers to allowed symbols.

The only allowed symbols are those that are present in the parameter table.

run(problem: Problem) ValidationIssue | None[source]

Run the validation task.

Parameters:

problem – PEtab problem to check.

Returns:

Validation results or None

class petab.v2.lint.CheckMeasuredExperimentsDefined[source]

Bases: ValidationTask

A task to check that all experiments referenced by measurements are defined.

run(problem: Problem) ValidationIssue | None[source]

Run the validation task.

Parameters:

problem – PEtab problem to check.

Returns:

Validation results or None

class petab.v2.lint.CheckMeasuredObservablesDefined[source]

Bases: ValidationTask

A task to check that all observables referenced by the measurements are defined.

run(problem: Problem) ValidationIssue | None[source]

Run the validation task.

Parameters:

problem – PEtab problem to check.

Returns:

Validation results or None

class petab.v2.lint.CheckMeasurementModelId[source]

Bases: ValidationTask

Validate model IDs of measurements.

run(problem: Problem) ValidationIssue | None[source]

Run the validation task.

Parameters:

problem – PEtab problem to check.

Returns:

Validation results or None

class petab.v2.lint.CheckModel[source]

Bases: ValidationTask

A task to validate the model of a PEtab problem.

run(problem: Problem) ValidationIssue | None[source]

Run the validation task.

Parameters:

problem – PEtab problem to check.

Returns:

Validation results or None

class petab.v2.lint.CheckObservablesDoNotShadowModelEntities[source]

Bases: ValidationTask

A task to check that observable IDs do not shadow model entities.

run(problem: Problem) ValidationIssue | None[source]

Run the validation task.

Parameters:

problem – PEtab problem to check.

Returns:

Validation results or None

class petab.v2.lint.CheckOverridesMatchPlaceholders[source]

Bases: ValidationTask

A task to check that the number of observable/noise parameters in the measurements matches the number of placeholders in the observables.

run(problem: Problem) ValidationIssue | None[source]

Run the validation task.

Parameters:

problem – PEtab problem to check.

Returns:

Validation results or None

class petab.v2.lint.CheckPosLogMeasurements[source]

Bases: ValidationTask

Check that measurements for observables with log-transformation are positive.

run(problem: Problem) ValidationIssue | None[source]

Run the validation task.

Parameters:

problem – PEtab problem to check.

Returns:

Validation results or None

class petab.v2.lint.CheckPriorDistribution[source]

Bases: ValidationTask

A task to validate the prior distribution of a PEtab problem.

run(problem: Problem) ValidationIssue | None[source]

Run the validation task.

Parameters:

problem – PEtab problem to check.

Returns:

Validation results or None

class petab.v2.lint.CheckProblemConfig[source]

Bases: ValidationTask

A task to validate the configuration of a PEtab problem.

This corresponds to checking the problem YAML file semantics.

run(problem: Problem) ValidationIssue | None[source]

Run the validation task.

Parameters:

problem – PEtab problem to check.

Returns:

Validation results or None

class petab.v2.lint.CheckUndefinedExperiments[source]

Bases: ValidationTask

A task to check for experiments that are used in the measurement table but not defined in the experiment table.

run(problem: Problem) ValidationIssue | None[source]

Run the validation task.

Parameters:

problem – PEtab problem to check.

Returns:

Validation results or None

class petab.v2.lint.CheckUniquePrimaryKeys[source]

Bases: ValidationTask

Check that all primary keys are unique.

run(problem: Problem) ValidationIssue | None[source]

Run the validation task.

Parameters:

problem – PEtab problem to check.

Returns:

Validation results or None

class petab.v2.lint.CheckUnusedConditions[source]

Bases: ValidationTask

A task to check for conditions that are not used in the experiment table.

run(problem: Problem) ValidationIssue | None[source]

Run the validation task.

Parameters:

problem – PEtab problem to check.

Returns:

Validation results or None

class petab.v2.lint.CheckUnusedExperiments[source]

Bases: ValidationTask

A task to check for experiments that are not used in the measurement table.

run(problem: Problem) ValidationIssue | None[source]

Run the validation task.

Parameters:

problem – PEtab problem to check.

Returns:

Validation results or None

class petab.v2.lint.CheckValidConditionTargets[source]

Bases: ValidationTask

Check that all condition table targets are valid.

run(problem: Problem) ValidationIssue | None[source]

Run the validation task.

Parameters:

problem – PEtab problem to check.

Returns:

Validation results or None

class petab.v2.lint.CheckValidParameterInConditionOrParameterTable[source]

Bases: ValidationTask

A task to check that all required and only allowed model parameters are present in the condition or parameter table.

run(problem: Problem) ValidationIssue | None[source]

Run the validation task.

Parameters:

problem – PEtab problem to check.

Returns:

Validation results or None

class petab.v2.lint.ValidationError(message: str, task: str | None = None)[source]

Bases: ValidationIssue

A validation result with level ERROR.

level: ValidationIssueSeverity = 30
class petab.v2.lint.ValidationIssue(level: ValidationIssueSeverity, message: str, task: str | None = None)[source]

Bases: object

The result of a validation task.

level

The level of the validation event.

Type:

petab.v2.lint.ValidationIssueSeverity

message

The message of the validation event.

Type:

str

level: ValidationIssueSeverity
message: str
task: str | None = None
class petab.v2.lint.ValidationIssueSeverity(*values)[source]

Bases: IntEnum

The severity of a validation issue.

CRITICAL = 40
ERROR = 30
INFO = 10
WARNING = 20
class petab.v2.lint.ValidationResultList(iterable=(), /)[source]

Bases: list[ValidationIssue]

A list of validation results.

Contains all issues found during the validation of a PEtab problem.

has_errors() bool[source]

Check if there are any errors in the validation results.

log(*, logger: Logger = <Logger petab.v2.lint (WARNING)>, min_level: ValidationIssueSeverity = ValidationIssueSeverity.INFO, max_level: ValidationIssueSeverity = ValidationIssueSeverity.CRITICAL)[source]

Log the validation results.

Parameters:
  • logger – The logger to use for logging. Defaults to the module logger.

  • min_level – The minimum severity level to log.

  • max_level – The maximum severity level to log.

class petab.v2.lint.ValidationTask[source]

Bases: ABC

A task to validate a PEtab problem.

abstractmethod run(problem: Problem) ValidationIssue | None[source]

Run the validation task.

Parameters:

problem – PEtab problem to check.

Returns:

Validation results or None

petab.v2.lint.default_validation_tasks = [<petab.v2.lint.CheckProblemConfig object>, <petab.v2.lint.CheckModel object>, <petab.v2.lint.CheckUniquePrimaryKeys object>, <petab.v2.lint.CheckMeasurementModelId object>, <petab.v2.lint.CheckMeasuredObservablesDefined object>, <petab.v2.lint.CheckPosLogMeasurements object>, <petab.v2.lint.CheckOverridesMatchPlaceholders object>, <petab.v2.lint.CheckValidConditionTargets object>, <petab.v2.lint.CheckExperimentTable object>, <petab.v2.lint.CheckExperimentConditionsExist object>, <petab.v2.lint.CheckUndefinedExperiments object>, <petab.v2.lint.CheckObservablesDoNotShadowModelEntities object>, <petab.v2.lint.CheckAllParametersPresentInParameterTable object>, <petab.v2.lint.CheckValidParameterInConditionOrParameterTable object>, <petab.v2.lint.CheckUnusedExperiments object>, <petab.v2.lint.CheckUnusedConditions object>, <petab.v2.lint.CheckPriorDistribution object>, <petab.v2.lint.CheckInitialChangeSymbols object>]

Validation tasks that should be run on any PEtab problem

petab.v2.lint.lint_problem(problem: Problem | str | Path) ValidationResultList[source]

Validate a PEtab problem.

Parameters:

problem – PEtab problem to check. Instance of Problem or path to a PEtab problem YAML file.

Returns:

A list of validation results. Empty if no issues were found.