Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce petab.v1 package #282

Merged
merged 7 commits into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
sphinx fixes
  • Loading branch information
dweindl committed Jun 27, 2024
commit ea81206740d9a401e1b42bad059e1cc9f1bf1e80
9 changes: 9 additions & 0 deletions petab/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
By default, all operations are performed sequentially.
"""
import functools
import sys
import warnings
from warnings import warn

Expand Down Expand Up @@ -57,3 +58,11 @@ def _deprecated_import_v1(module_name: str):
obj = globals().get(name)
if callable(obj):
globals()[name] = _deprecated_v1(obj)
del name, obj

__all__ = [
x
for x in dir(sys.modules[__name__])
if not x.startswith("_")
and x not in {"sys", "warnings", "functools", "warn"}
]
9 changes: 8 additions & 1 deletion petab/v1/C.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"""
This file contains constant definitions.
"""

import math as _math
import sys

# MEASUREMENTS

Expand Down Expand Up @@ -363,3 +363,10 @@

# separator for multiple parameter values (bounds, observableParameters, ...)
PARAMETER_SEPARATOR = ";"


__all__ = [
x
for x in dir(sys.modules[__name__])
if not x.startswith("_") and x not in {"sys", "math"}
]
2 changes: 2 additions & 0 deletions petab/v1/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@
}

from .model import Model # noqa F401

__all__ = ["MODEL_TYPE_SBML", "MODEL_TYPE_PYSB", "known_model_types", "Model"]
12 changes: 8 additions & 4 deletions petab/v1/models/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
from pathlib import Path
from typing import Any

__all__ = ["Model"]


class Model(abc.ABC):
"""Base class for wrappers for any PEtab-supported model type"""
Expand Down Expand Up @@ -78,8 +80,9 @@ def has_entity_with_id(self, entity_id) -> bool:
"""Check if there is a model entity with the given ID

:param entity_id: ID to check for
:returns: ``True``, if there is an entity with the given ID,
``False`` otherwise
:returns:
``True``, if there is an entity with the given ID,
``False`` otherwise
"""
...

Expand Down Expand Up @@ -114,8 +117,9 @@ def symbol_allowed_in_observable_formula(self, id_: str) -> bool:
def is_valid(self) -> bool:
"""Validate this model

:returns: `True` if the model is valid, `False` if there are errors in
this model
:returns:
`True` if the model is valid, `False` if there are errors in
this model
"""
...

Expand Down
2 changes: 2 additions & 0 deletions petab/v1/models/pysb_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
from . import MODEL_TYPE_PYSB
from .model import Model

__all__ = ["PySBModel", "parse_species_name", "pattern_from_string"]


def _pysb_model_from_path(pysb_model_file: str | Path) -> pysb.Model:
"""Load a pysb model module and return the :class:`pysb.Model` instance
Expand Down
2 changes: 2 additions & 0 deletions petab/v1/models/sbml_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
from . import MODEL_TYPE_SBML
from .model import Model

__all__ = ["SbmlModel"]


class SbmlModel(Model):
"""PEtab wrapper for SBML models"""
Expand Down
2 changes: 1 addition & 1 deletion petab/v1/problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class Problem:

Optionally it may contain visualization tables.

Attributes:
Parameters:
condition_df: PEtab condition table
measurement_df: PEtab measurement table
parameter_df: PEtab parameter table
Expand Down
2 changes: 2 additions & 0 deletions petab/v1/visualize/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
from .. import Problem, get_simulation_df, get_visualization_df
from .plot_data_and_simulation import plot_problem

__all__ = []


def _parse_cli_args():
"""Parse command-line arguments."""
Expand Down
4 changes: 4 additions & 0 deletions petab/v1/visualize/lint.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
"""Validation of PEtab visualization files"""
from __future__ import annotations

import logging

import pandas as pd
Expand All @@ -8,6 +10,8 @@

logger = logging.getLogger(__name__)

__all__ = ["validate_visualization_df"]


def validate_visualization_df(problem: Problem) -> bool:
"""Validate visualization table
Expand Down