petab.v2.lint

Validation of PEtab problems

Module Attributes

default_validation_tasks

Validation tasks that should be run on any PEtab problem

Functions

get_required_parameters_for_parameter_table(problem)

Get set of parameters which need to go into 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.

CheckConditionTable()

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

CheckMeasurementTable()

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

CheckModel()

A task to validate the model of a PEtab problem.

CheckObservableTable()

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

CheckObservablesDoNotShadowModelEntities()

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

CheckParameterTable()

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

CheckTableExists(table_name)

A task to check if a table exists in the PEtab problem.

CheckValidParameterInConditionOrParameterTable()

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

CheckVisualizationTable()

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

ValidationError(message)

A validation result with level ERROR.

ValidationIssue(level, message)

The result of a validation task.

ValidationIssueSeverity(value)

The severity of a validation issue.

ValidationResultList([iterable])

A list of validation results.

ValidationTask()

A task to validate a PEtab problem.

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.CheckConditionTable[source]

Bases: ValidationTask

A task to validate the condition 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.CheckMeasurementTable[source]

Bases: ValidationTask

A task to validate the measurement 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.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.CheckObservableTable[source]

Bases: ValidationTask

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

run(problem: Problem)[source]

Run the validation task.

Parameters:

problem – PEtab problem to check.

Returns:

Validation results or None

class petab.v2.lint.CheckParameterTable[source]

Bases: ValidationTask

A task to validate the parameter 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.CheckTableExists(table_name: str)[source]

Bases: ValidationTask

A task to check if a table exists in the 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.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.CheckVisualizationTable[source]

Bases: ValidationTask

A task to validate the visualization 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.ValidationError(message: str)[source]

Bases: ValidationIssue

A validation result with level ERROR.

class petab.v2.lint.ValidationIssue(level: ValidationIssueSeverity, message: str)[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

class petab.v2.lint.ValidationIssueSeverity(value)[source]

Bases: IntEnum

The severity of a validation issue.

as_integer_ratio()

Return integer ratio.

Return a pair of integers, whose ratio is exactly equal to the original int and with a positive denominator.

>>> (10).as_integer_ratio()
(10, 1)
>>> (-10).as_integer_ratio()
(-10, 1)
>>> (0).as_integer_ratio()
(0, 1)
bit_count()

Number of ones in the binary representation of the absolute value of self.

Also known as the population count.

>>> bin(13)
'0b1101'
>>> (13).bit_count()
3
bit_length()

Number of bits necessary to represent self in binary.

>>> bin(37)
'0b100101'
>>> (37).bit_length()
6
conjugate()

Returns self, the complex conjugate of any int.

denominator

the denominator of a rational number in lowest terms

from_bytes(byteorder, *, signed=False)

Return the integer represented by the given array of bytes.

bytes

Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.

byteorder

The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value.

signed

Indicates whether two’s complement is used to represent the integer.

imag

the imaginary part of a complex number

numerator

the numerator of a rational number in lowest terms

real

the real part of a complex number

to_bytes(length, byteorder, *, signed=False)

Return an array of bytes representing an integer.

length

Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes.

byteorder

The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value.

signed

Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.

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.

append(object, /)

Append object to the end of the list.

clear()

Remove all items from list.

copy()

Return a shallow copy of the list.

count(value, /)

Return number of occurrences of value.

extend(iterable, /)

Extend list by appending elements from the iterable.

has_errors() bool[source]

Check if there are any errors in the validation results.

index(value, start=0, stop=9223372036854775807, /)

Return first index of value.

Raises ValueError if the value is not present.

insert(index, object, /)

Insert object before index.

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

Log the validation results.

pop(index=-1, /)

Remove and return item at index (default last).

Raises IndexError if list is empty or index is out of range.

remove(value, /)

Remove first occurrence of value.

Raises ValueError if the value is not present.

reverse()

Reverse IN PLACE.

sort(*, key=None, reverse=False)

Sort the list in ascending order and return None.

The sort is in-place (i.e. the list itself is modified) and stable (i.e. the order of two equal elements is maintained).

If a key function is given, apply it once to each list item and sort them, ascending or descending, according to their function values.

The reverse flag can be set to sort in descending order.

class petab.v2.lint.ValidationTask[source]

Bases: ABC

A task to validate a PEtab problem.

abstract 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.CheckTableExists object>, <petab.v2.lint.CheckTableExists object>, <petab.v2.lint.CheckTableExists object>, <petab.v2.lint.CheckModel object>, <petab.v2.lint.CheckMeasurementTable object>, <petab.v2.lint.CheckConditionTable object>, <petab.v2.lint.CheckObservableTable object>, <petab.v2.lint.CheckObservablesDoNotShadowModelEntities object>, <petab.v2.lint.CheckParameterTable object>, <petab.v2.lint.CheckAllParametersPresentInParameterTable object>, <petab.v2.lint.CheckVisualizationTable object>, <petab.v2.lint.CheckValidParameterInConditionOrParameterTable 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.