Skip to content

Commit

Permalink
Merge pull request #201 from PEtab-dev/release_0.2.0
Browse files Browse the repository at this point in the history
Release 0.2.0
  • Loading branch information
dweindl authored May 8, 2023
2 parents 2ba5c52 + 9fbf14c commit 3c29fa1
Show file tree
Hide file tree
Showing 45 changed files with 1,883 additions and 196 deletions.
17 changes: 9 additions & 8 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ extend-ignore =
F403
F405
exclude =
build
dist
doc
env
venv
example
tmp
_*
build,
dist,
doc,
env,
venv,
example,
tmp,
_*,
.tox,
12 changes: 12 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# see https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners

# default owners
* @PEtab-dev/libpetab-python-maintainers

/petab/visualize/ @plakrisenko
/tests/test_vis* @plakrisenko
/petab/simulate.py @dilpath
/tests/test_simulate.py @dilpath
/petab/calculate.py @yannikschaelte
/tests/test_calculate.py @yannikschaelte
/doc/ @dweindl
13 changes: 7 additions & 6 deletions .github/workflows/ci_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,26 @@ jobs:
strategy:
matrix:
platform: [windows-latest, macos-latest, ubuntu-latest]
python-version: ["3.8", "3.10"]
python-version: ["3.9", "3.11"]
runs-on: ${{ matrix.platform }}

steps:
- name: Check out repository
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Prepare python ${{ matrix.python-version }}
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Get pip cache directory
id: pip_cache_dir
run: |
echo "::set-output name=dir::$(pip cache dir)"
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
shell: bash

- name: Cache
uses: actions/cache@v1
uses: actions/cache@v3
with:
path: ${{ steps.pip_cache_dir.outputs.dir }}
key: ${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/.ci_pip_reqs.txt') }}-${{ hashFiles('**/setup.py') }}
Expand All @@ -49,7 +50,7 @@ jobs:
run: tox -e unit

- name: Coverage
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ jobs:

steps:
- name: Check out repository
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Set up python
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: 3.11
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
6 changes: 5 additions & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@ sphinx:
configuration: doc/conf.py
fail_on_warning: true

build:
os: "ubuntu-22.04"
tools:
python: "3.9"

python:
version: 3.8
install:
- method: pip
path: .
extra_requirements:
- doc
- vis
36 changes: 36 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,41 @@
# PEtab changelog

## 0.2 series

### 0.2.0

Note: petab 0.2.0 requires Python>=3.9

Features:
* Plot measurements for t = 'inf'
by @plakrisenko in https://github.com/PEtab-dev/libpetab-python/pull/149
* Added validation for visualization files
by @dweindl in https://github.com/PEtab-dev/libpetab-python/pull/184
https://github.com/PEtab-dev/libpetab-python/pull/189
* Startpoints as dict
by @dweindl in https://github.com/PEtab-dev/libpetab-python/pull/188
* Residuals plot
by @plakrisenko in https://github.com/PEtab-dev/libpetab-python/pull/187
https://github.com/PEtab-dev/libpetab-python/pull/191
* add goodness of fit plot
by @plakrisenko in https://github.com/PEtab-dev/libpetab-python/pull/192
* Add PySBModel for handling of PySB models
by @dweindl in https://github.com/PEtab-dev/libpetab-python/pull/145

Fixes
* Vis: Don't fail on missing simulations
by @dweindl in https://github.com/PEtab-dev/libpetab-python/pull/185
* prevent strings being parsed as nan in get_visualization_df
by @plakrisenko in https://github.com/PEtab-dev/libpetab-python/pull/193
* Fix get_model_for_condition
by @dweindl in https://github.com/PEtab-dev/libpetab-python/pull/194
* Simulator: rename measurement column to simulation
by @dilpath in https://github.com/PEtab-dev/libpetab-python/pull/199
* Fix sympy symbol name clashes
by @dweindl in https://github.com/PEtab-dev/libpetab-python/pull/202

**Full Changelog**: https://github.com/PEtab-dev/libpetab-python/compare/v0.1.30...v0.2.0

## 0.1 series

### 0.1.30
Expand Down
57 changes: 57 additions & 0 deletions doc/example/example_Fujita/Fujita_measurementData_t_inf.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
observableId preequilibrationConditionId simulationConditionId measurement time observableParameters noiseParameters datasetId
pS6_tot model1_data1 0 0 scaling_pS6_tot 0.01 model1_data1_pS6_tot
pS6_tot model1_data1 0.0018563 60 scaling_pS6_tot 0.01 model1_data1_pS6_tot
pS6_tot model1_data1 0.0033416 120 scaling_pS6_tot 0.01 model1_data1_pS6_tot
pS6_tot model1_data1 0.012632 300 scaling_pS6_tot 0.01 model1_data1_pS6_tot
pS6_tot model1_data1 0.078914 600 scaling_pS6_tot 0.02 model1_data1_pS6_tot
pS6_tot model1_data1 0.25521 900 scaling_pS6_tot 0.02 model1_data1_pS6_tot
pS6_tot model1_data1 0.44745 1800 scaling_pS6_tot 0.035 model1_data1_pS6_tot
pS6_tot model1_data1 0.29547 inf scaling_pS6_tot 0.035 model1_data1_pS6_tot
pS6_tot model1_data2 0 0 scaling_pS6_tot 0.01 model1_data2_pS6_tot
pS6_tot model1_data2 0.0019654 60 scaling_pS6_tot 0.01 model1_data2_pS6_tot
pS6_tot model1_data2 0.0021975 120 scaling_pS6_tot 0.01 model1_data2_pS6_tot
pS6_tot model1_data2 0.020119 300 scaling_pS6_tot 0.01 model1_data2_pS6_tot
pS6_tot model1_data2 0.22158 600 scaling_pS6_tot 0.02 model1_data2_pS6_tot
pS6_tot model1_data2 0.52331 900 scaling_pS6_tot 0.03 model1_data2_pS6_tot
pS6_tot model1_data2 0.85846 1800 scaling_pS6_tot 0.1 model1_data2_pS6_tot
pS6_tot model1_data2 0.6598 inf scaling_pS6_tot 0.025 model1_data2_pS6_tot
pS6_tot model1_data3 0 0 scaling_pS6_tot 0.01 model1_data3_pS6_tot
pS6_tot model1_data3 0.0020839 60 scaling_pS6_tot 0.01 model1_data3_pS6_tot
pS6_tot model1_data3 0.0047955 120 scaling_pS6_tot 0.01 model1_data3_pS6_tot
pS6_tot model1_data3 0.047495 300 scaling_pS6_tot 0.01 model1_data3_pS6_tot
pS6_tot model1_data3 0.39197 600 scaling_pS6_tot 0.01 model1_data3_pS6_tot
pS6_tot model1_data3 0.68142 900 scaling_pS6_tot 0.025 model1_data3_pS6_tot
pS6_tot model1_data3 1.0001 1800 scaling_pS6_tot 0.07 model1_data3_pS6_tot
pS6_tot model1_data3 0.75108 inf scaling_pS6_tot 0.075 model1_data3_pS6_tot
pS6_tot model1_data4 0 0 scaling_pS6_tot 0.01 model1_data4_pS6_tot
pS6_tot model1_data4 0.0057189 60 scaling_pS6_tot 0.01 model1_data4_pS6_tot
pS6_tot model1_data4 0.013126 120 scaling_pS6_tot 0.01 model1_data4_pS6_tot
pS6_tot model1_data4 0.062408 300 scaling_pS6_tot 0.01 model1_data4_pS6_tot
pS6_tot model1_data4 0.41154 600 scaling_pS6_tot 0.01 model1_data4_pS6_tot
pS6_tot model1_data4 0.71428 900 scaling_pS6_tot 0.035 model1_data4_pS6_tot
pS6_tot model1_data4 0.92784 1800 scaling_pS6_tot 0.08 model1_data4_pS6_tot
pS6_tot model1_data4 0.55064 inf scaling_pS6_tot 0.08 model1_data4_pS6_tot
pS6_tot model1_data5 0 0 scaling_pS6_tot 0.01 model1_data5_pS6_tot
pS6_tot model1_data5 0.0073292 60 scaling_pS6_tot 0.01 model1_data5_pS6_tot
pS6_tot model1_data5 0.014418 120 scaling_pS6_tot 0.01 model1_data5_pS6_tot
pS6_tot model1_data5 0.079732 300 scaling_pS6_tot 0.01 model1_data5_pS6_tot
pS6_tot model1_data5 0.4562 600 scaling_pS6_tot 0.01 model1_data5_pS6_tot
pS6_tot model1_data5 0.65294 900 scaling_pS6_tot 0.02 model1_data5_pS6_tot
pS6_tot model1_data5 0.75189 1800 scaling_pS6_tot 0.04 model1_data5_pS6_tot
pS6_tot model1_data5 0.37446 inf scaling_pS6_tot 0.08 model1_data5_pS6_tot
pS6_tot model1_data6 0 0 scaling_pS6_tot 0.01 model1_data6_pS6_tot
pS6_tot model1_data6 0.0086144 60 scaling_pS6_tot 0.01 model1_data6_pS6_tot
pS6_tot model1_data6 0.013062 120 scaling_pS6_tot 0.01 model1_data6_pS6_tot
pS6_tot model1_data6 0.07993 300 scaling_pS6_tot 0.01 model1_data6_pS6_tot
pS6_tot model1_data6 0.42868 600 scaling_pS6_tot 0.02 model1_data6_pS6_tot
pS6_tot model1_data6 0.60508 900 scaling_pS6_tot 0.03 model1_data6_pS6_tot
pS6_tot model1_data6 0.62088 1800 scaling_pS6_tot 0.035 model1_data6_pS6_tot
pS6_tot model1_data6 0.32084 inf scaling_pS6_tot 0.07 model1_data6_pS6_tot
pS6_tot model1_data6 0 0 scaling_pS6_tot 0.01 model1_data6_pS6_tot
pS6_tot model1_data6 0.009 60 scaling_pS6_tot 0.01 model1_data6_pS6_tot
pS6_tot model1_data6 0.01 120 scaling_pS6_tot 0.01 model1_data6_pS6_tot
pS6_tot model1_data6 0.05 300 scaling_pS6_tot 0.01 model1_data6_pS6_tot
pS6_tot model1_data6 0.6 600 scaling_pS6_tot 0.02 model1_data6_pS6_tot
pS6_tot model1_data6 0.4 900 scaling_pS6_tot 0.03 model1_data6_pS6_tot
pS6_tot model1_data6 0.83 1800 scaling_pS6_tot 0.035 model1_data6_pS6_tot
pS6_tot model1_data6 0.2 inf scaling_pS6_tot 0.07 model1_data6_pS6_tot
49 changes: 49 additions & 0 deletions doc/example/example_Fujita/Fujita_simulatedData_t_inf.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
observableId preequilibrationConditionId simulationConditionId simulation time observableParameters noiseParameters
pS6_tot model1_data1 0 0 scaling_pS6_tot 0.01
pS6_tot model1_data1 5.78895984805857E-05 60 scaling_pS6_tot 0.01
pS6_tot model1_data1 0.0009531255 120 scaling_pS6_tot 0.01
pS6_tot model1_data1 0.0185497283 300 scaling_pS6_tot 0.01
pS6_tot model1_data1 0.0927501675 600 scaling_pS6_tot 0.02
pS6_tot model1_data1 0.1859892615 900 scaling_pS6_tot 0.02
pS6_tot model1_data1 0.3842285889 1800 scaling_pS6_tot 0.035
pS6_tot model1_data1 0.3671651134 inf scaling_pS6_tot 0.035
pS6_tot model1_data2 0 0 scaling_pS6_tot 0.01
pS6_tot model1_data2 0.0001694707 60 scaling_pS6_tot 0.01
pS6_tot model1_data2 0.0026563935 120 scaling_pS6_tot 0.01
pS6_tot model1_data2 0.045833771 300 scaling_pS6_tot 0.01
pS6_tot model1_data2 0.209607514 600 scaling_pS6_tot 0.02
pS6_tot model1_data2 0.4007484657 900 scaling_pS6_tot 0.03
pS6_tot model1_data2 0.7556316274 1800 scaling_pS6_tot 0.1
pS6_tot model1_data2 0.6612775029 inf scaling_pS6_tot 0.025
pS6_tot model1_data3 0 0 scaling_pS6_tot 0.01
pS6_tot model1_data3 0.0005211244 60 scaling_pS6_tot 0.01
pS6_tot model1_data3 0.007106942 120 scaling_pS6_tot 0.01
pS6_tot model1_data3 0.0945320284 300 scaling_pS6_tot 0.01
pS6_tot model1_data3 0.366852041 600 scaling_pS6_tot 0.01
pS6_tot model1_data3 0.6350909024 900 scaling_pS6_tot 0.025
pS6_tot model1_data3 0.9989387811 1800 scaling_pS6_tot 0.07
pS6_tot model1_data3 0.7818807584 inf scaling_pS6_tot 0.075
pS6_tot model1_data4 0 0 scaling_pS6_tot 0.01
pS6_tot model1_data4 0.001284326 60 scaling_pS6_tot 0.01
pS6_tot model1_data4 0.0137701475 120 scaling_pS6_tot 0.01
pS6_tot model1_data4 0.1357831768 300 scaling_pS6_tot 0.01
pS6_tot model1_data4 0.4317319675 600 scaling_pS6_tot 0.01
pS6_tot model1_data4 0.6581119566 900 scaling_pS6_tot 0.035
pS6_tot model1_data4 0.8936164338 1800 scaling_pS6_tot 0.08
pS6_tot model1_data4 0.6665565723 inf scaling_pS6_tot 0.08
pS6_tot model1_data5 0 0 scaling_pS6_tot 0.01
pS6_tot model1_data5 0.0026774961 60 scaling_pS6_tot 0.01
pS6_tot model1_data5 0.0210783997 120 scaling_pS6_tot 0.01
pS6_tot model1_data5 0.1570157565 300 scaling_pS6_tot 0.01
pS6_tot model1_data5 0.4117751573 600 scaling_pS6_tot 0.01
pS6_tot model1_data5 0.5823970015 900 scaling_pS6_tot 0.02
pS6_tot model1_data5 0.7468131737 1800 scaling_pS6_tot 0.04
pS6_tot model1_data5 0.5504628923 inf scaling_pS6_tot 0.08
pS6_tot model1_data6 0 0 scaling_pS6_tot 0.01
pS6_tot model1_data6 0.0039799398 60 scaling_pS6_tot 0.01
pS6_tot model1_data6 0.0254606658 120 scaling_pS6_tot 0.01
pS6_tot model1_data6 0.1631478226 300 scaling_pS6_tot 0.01
pS6_tot model1_data6 0.4009703836 600 scaling_pS6_tot 0.02
pS6_tot model1_data6 0.5574326493 900 scaling_pS6_tot 0.03
pS6_tot model1_data6 0.7058108511 1800 scaling_pS6_tot 0.035
pS6_tot model1_data6 0.5194180219 inf scaling_pS6_tot 0.07
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
plotId xValues yValues yOffset yScale plotName plotTypeSimulation plotTypeData
plot1 time pS6_tot 0 lin pS6 total LinePlot replicate
22 changes: 22 additions & 0 deletions petab/C.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,12 @@
#: Supported plot types
PLOT_TYPES_SIMULATION = [LINE_PLOT, BAR_PLOT, SCATTER_PLOT]

#: Supported xScales
X_SCALES = [LIN, LOG, LOG10]

#: Supported yScales
Y_SCALES = [LIN, LOG, LOG10]


#:
MEAN_AND_SD = 'MeanAndSD'
Expand All @@ -257,6 +263,12 @@
#:
SBML_FILES = 'sbml_files'
#:
MODEL_FILES = 'model_files'
#:
MODEL_LOCATION = 'location'
#:
MODEL_LANGUAGE = 'language'
#:
CONDITION_FILES = 'condition_files'
#:
MEASUREMENT_FILES = 'measurement_files'
Expand All @@ -265,9 +277,19 @@
#:
VISUALIZATION_FILES = 'visualization_files'
#:
MAPPING_FILES = 'mapping_files'
#:
EXTENSIONS = 'extensions'


# MAPPING
#:
PETAB_ENTITY_ID = 'petabEntityId'
#:
MODEL_ENTITY_ID = 'modelEntityId'
#:
MAPPING_DF_REQUIRED_COLS = [PETAB_ENTITY_ID, MODEL_ENTITY_ID]

# MORE

#:
Expand Down
1 change: 1 addition & 0 deletions petab/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@
from .yaml import * # noqa: F403, F401, E402
from .version import __version__ # noqa: F401, E402
from .format_version import __format_version__ # noqa: F401, E402
from .mapping import * # noqa: F403, F401, E402
5 changes: 3 additions & 2 deletions petab/calculate.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@

import numpy as np
import pandas as pd
import petab
import sympy
from sympy.abc import _clash

import petab
from .C import *

__all__ = ['calculate_residuals', 'calculate_residuals_for_table',
Expand Down Expand Up @@ -138,7 +139,7 @@ def get_symbolic_noise_formulas(observable_df) -> Dict[str, sympy.Expr]:
if NOISE_FORMULA not in observable_df.columns:
noise_formula = None
else:
noise_formula = sympy.sympify(row.noiseFormula)
noise_formula = sympy.sympify(row.noiseFormula, locals=_clash)
noise_formulas[observable_id] = noise_formula
return noise_formulas

Expand Down
2 changes: 2 additions & 0 deletions petab/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ def get_visualization_df(visualization_file: Union[str, Path]) -> pd.DataFrame:
Visualization DataFrame
"""
try:
types = {PLOT_NAME: str}
vis_spec = pd.read_csv(visualization_file, sep="\t", index_col=None,
converters=types,
float_precision='round_trip')
except pd.errors.EmptyDataError:
warn("Visualization table is empty. Defaults will be used. "
Expand Down
Loading

0 comments on commit 3c29fa1

Please sign in to comment.