Skip to content

Commit 0b4ffde

Browse files
committed
trunc
1 parent adfa220 commit 0b4ffde

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

petab/v1/distributions.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,17 +425,19 @@ class LogUniform(Distribution):
425425
426426
:param low: The lower bound of the distribution.
427427
:param high: The upper bound of the distribution.
428+
:param trunc: The truncation limits of the distribution.
428429
"""
429430

430431
def __init__(
431432
self,
432433
low: float,
433434
high: float,
435+
trunc: tuple[float, float] | None = None,
434436
):
435437
self._logbase = np.exp(1)
436438
self._low = self._log(low)
437439
self._high = self._log(high)
438-
super().__init__(log=self._logbase)
440+
super().__init__(log=self._logbase, trunc=trunc)
439441

440442
def __repr__(self):
441443
return self._repr({"low": self._low, "high": self._high})

petab/v2/core.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,10 +1065,7 @@ def prior_dist(self) -> Distribution:
10651065
if cls == LogUniform:
10661066
# Mind the different interpretation of distribution parameters for
10671067
# Uniform(..., log=True) and LogUniform!!
1068-
# `LogUniform.__init__` does not accept the `trunc` parameter
1069-
low = max(self.prior_parameters[0], self.lb)
1070-
high = min(self.prior_parameters[1], self.ub)
1071-
return cls(low, high)
1068+
return cls(*self.prior_parameters, trunc=[self.lb, self.ub])
10721069

10731070
return cls(*self.prior_parameters, log=log, trunc=[self.lb, self.ub])
10741071

0 commit comments

Comments
 (0)