Skip to content

Commit df7107f

Browse files
committed
v2: Remove log10-normal distribution
Remove LOG10_NORMAL from `petab.v2.{PriorDistribution,NoiseDistribution}` which has been removed from PEtab v2 (PEtab-dev/PEtab#644). Also update v1->v2 conversion accordingly.
1 parent 2ec51e8 commit df7107f

File tree

5 files changed

+11
-14
lines changed

5 files changed

+11
-14
lines changed

petab/v2/C.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,6 @@
199199
GAMMA = "gamma"
200200
#: Laplace distribution
201201
LAPLACE = "laplace"
202-
#: Log10-normal distribution.
203-
LOG10_NORMAL = "log10-normal"
204202
#: Log-Laplace distribution
205203
LOG_LAPLACE = "log-laplace"
206204
#: Log-normal distribution
@@ -221,7 +219,6 @@
221219
EXPONENTIAL,
222220
GAMMA,
223221
LAPLACE,
224-
LOG10_NORMAL,
225222
LOG_LAPLACE,
226223
LOG_NORMAL,
227224
LOG_UNIFORM,

petab/v2/calculate.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -447,10 +447,7 @@ def calculate_single_llh(
447447
The computed likelihood for the given values.
448448
"""
449449
# PEtab v2:
450-
if noise_distribution == LOG10_NORMAL and scale == LIN:
451-
noise_distribution = NORMAL
452-
scale = LOG10
453-
elif noise_distribution == LOG_NORMAL and scale == LIN:
450+
if noise_distribution == LOG_NORMAL and scale == LIN:
454451
noise_distribution = NORMAL
455452
scale = LOG
456453

petab/v2/core.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,6 @@ class NoiseDistribution(str, Enum):
148148
LOG_NORMAL = C.LOG_NORMAL
149149
#: Log-Laplace distribution
150150
LOG_LAPLACE = C.LOG_LAPLACE
151-
#: Log10-Normal
152-
LOG10_NORMAL = C.LOG10_NORMAL
153151

154152

155153
class PriorDistribution(str, Enum):
@@ -168,8 +166,6 @@ class PriorDistribution(str, Enum):
168166
GAMMA = C.GAMMA
169167
#: Laplace distribution.
170168
LAPLACE = C.LAPLACE
171-
#: Log10-normal distribution.
172-
LOG10_NORMAL = C.LOG10_NORMAL
173169
#: Log-Laplace distribution
174170
LOG_LAPLACE = C.LOG_LAPLACE
175171
#: Log-normal distribution.
@@ -195,7 +191,6 @@ class PriorDistribution(str, Enum):
195191
PriorDistribution.EXPONENTIAL: Exponential,
196192
PriorDistribution.GAMMA: Gamma,
197193
PriorDistribution.LAPLACE: Laplace,
198-
PriorDistribution.LOG10_NORMAL: Normal,
199194
PriorDistribution.LOG_LAPLACE: Laplace,
200195
PriorDistribution.LOG_NORMAL: Normal,
201196
PriorDistribution.LOG_UNIFORM: Uniform,

petab/v2/lint.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,6 @@ class CheckPriorDistribution(ValidationTask):
802802
PriorDistribution.EXPONENTIAL: 1,
803803
PriorDistribution.GAMMA: 2,
804804
PriorDistribution.LAPLACE: 2,
805-
PriorDistribution.LOG10_NORMAL: 2,
806805
PriorDistribution.LOG_LAPLACE: 2,
807806
PriorDistribution.LOG_NORMAL: 2,
808807
PriorDistribution.LOG_UNIFORM: 2,

petab/v2/petab1to2.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,10 +490,19 @@ def update_prior(row):
490490
if pscale != v1.C.LIN:
491491
new_prior_type = f"{pscale}-{new_prior_type}"
492492

493+
if new_prior_type == "log10-normal":
494+
warnings.warn(
495+
f"Prior distribution `{new_prior_type}' for parameter "
496+
f"`{row.name}' is not supported in PEtab v2. "
497+
"Using `log-normal` instead.",
498+
stacklevel=2,
499+
)
500+
new_prior_type = v2.C.LOG_NORMAL
501+
493502
if new_prior_type not in v2.C.PRIOR_DISTRIBUTIONS:
494503
raise NotImplementedError(
495504
f"PEtab v2 does not support prior type `{new_prior_type}' "
496-
f"required for parameter `{row.index}'."
505+
f"required for parameter `{row.name}'."
497506
)
498507

499508
return new_prior_type

0 commit comments

Comments
 (0)