Skip to content

Commit cb32d94

Browse files
committed
v1v2-converter: handle log10-normal
PEtab v2 does not support log10-type distributions. When upconverting PEtab v1 problems, replace log10-normal by log-normal and emit a warning.
1 parent af3e707 commit cb32d94

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

petab/v2/petab1to2.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import re
66
import shutil
7+
import warnings
78
from contextlib import suppress
89
from pathlib import Path
910
from tempfile import TemporaryDirectory
@@ -386,6 +387,16 @@ def update_noise_dist(row):
386387
else:
387388
new_dist = f"{trans}-{dist}"
388389

390+
if new_dist == "log10-normal":
391+
warnings.warn(
392+
f"Noise distribution `{new_dist}' for "
393+
f"observable `{row[v1.C.OBSERVABLE_ID]}'"
394+
f" is not supported in PEtab v2. "
395+
"Using `log-normal` instead.",
396+
stacklevel=2,
397+
)
398+
new_dist = v2.C.LOG_NORMAL
399+
389400
if new_dist not in v2.C.NOISE_DISTRIBUTIONS:
390401
raise NotImplementedError(
391402
f"Noise distribution `{new_dist}' for "

tests/v2/test_conversion.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ def test_petab1to2_remote():
3030
)
3131

3232

33+
@pytest.mark.filterwarnings(
34+
"ignore:.*Using `log-normal` instead.*:UserWarning"
35+
)
3336
@parametrize_or_skip
3437
def test_benchmark_collection(problem_id):
3538
"""Test that we can upgrade all benchmark collection models."""

0 commit comments

Comments
 (0)