Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
libhdf5-serial-dev

- name: Install Python dependencies
run: pip install -r requirements_dev.txt
run: pip install -r requirements_dev.txt -r requirements_upsetplot.txt

- name: Run tox
run: python -m tox
Expand Down
2 changes: 2 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ python:
path: .
extra_requirements:
- doc
# keep until upsetplot can be installed from pypi
- requirements: requirements_upsetplot.txt

build:
os: "ubuntu-22.04"
Expand Down
4 changes: 2 additions & 2 deletions doc/analysis.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ Model hashes are special objects in the library, that are generated from model-s

This means you can reconstruct the model given some model hash. For example, with this model hash `M1-000`, you can reconstruct the :class:`petab_select.ModelHash` from a string, then reconstruct the :class:`petab_select.Model`.

.. code-block:: language
.. code-block:: python

ModelHash.from_hash("M1-000").get_model(petab_select_problem)

You can use this to get the uncalibrated version of a calibrated model.

.. code-block:: language
.. code-block:: python

model.hash.get_model(petab_select_problem)
1 change: 0 additions & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = [
"readthedocs_ext.readthedocs",
"sphinx.ext.napoleon",
"sphinx.ext.autodoc",
"sphinx.ext.intersphinx",
Expand Down
4 changes: 2 additions & 2 deletions petab_select/analyze.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,14 @@ def get_best_by_iteration(
*args,
**kwargs,
) -> dict[int, Models]:
"""Get the best model of each iteration.
r"""Get the best model of each iteration.

See :func:``get_best`` for additional required arguments.

Args:
models:
The models.
*args, **kwargs:
*args, \**kwargs:
Forwarded to :func:``get_best``.

Returns:
Expand Down
11 changes: 10 additions & 1 deletion petab_select/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
import matplotlib.ticker
import networkx as nx
import numpy as np
import upsetplot

try:
import upsetplot
except ImportError:
upsetplot = None

from . import analyze
from .constants import Criterion
Expand Down Expand Up @@ -218,6 +222,11 @@ def upset(plot_data: PlotData) -> dict[str, matplotlib.axes.Axes | None]:
The plot axes (see documentation from the
`upsetplot <https://upsetplot.readthedocs.io/>`__ package).
"""
if upsetplot is None:
raise ImportError(
"Please install upsetplot, e.g. with the following command: "
"pip install git+https://github.com/jnothman/UpSetPlot.git@08f0648368122303075cbb2835ae7fea0f7f07df"
)
# Get delta criterion values
values = np.array(
plot_data.models.get_criterion(
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ dependencies = [
[project.optional-dependencies]
plot = [
"matplotlib>=2.2.3",
"upsetplot",
# disabled with a manual install message until https://github.com/jnothman/UpSetPlot/issues/303
# "upsetplot",
]
test = [
"pytest >= 5.4.3",
Expand All @@ -50,7 +51,6 @@ doc = [
"nbconvert>=7.16.4",
"ipykernel>= 6.23.1",
"ipython>=7.21.0",
"readthedocs-sphinx-ext>=2.2.5",
"sphinx-autodoc-typehints",
"petab_select[plot]",
]
Expand Down
1 change: 1 addition & 0 deletions requirements_upsetplot.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
git+https://github.com/jnothman/UpSetPlot.git@08f0648368122303075cbb2835ae7fea0f7f07df
Loading