Skip to content

Commit 7ae0f40

Browse files
committed
tuncation/transformation
1 parent 2529bf9 commit 7ae0f40

File tree

1 file changed

+22
-15
lines changed

1 file changed

+22
-15
lines changed

petab/v1/distributions.py

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,12 @@ def __init__(
7575
@property
7676
def trunc_low(self) -> float:
7777
"""The lower truncation limit of the transformed distribution."""
78-
return self._trunc[0] if self._trunc else -np.inf
78+
return self._exp(self._trunc[0]) if self._trunc else -np.inf
7979

8080
@property
8181
def trunc_high(self) -> float:
8282
"""The upper truncation limit of the transformed distribution."""
83-
return self._trunc[1] if self._trunc else np.inf
83+
return self._exp(self._trunc[1]) if self._trunc else np.inf
8484

8585
def _exp(self, x: np.ndarray | float) -> np.ndarray | float:
8686
"""Exponentiate / undo the log transformation if applicable.
@@ -274,15 +274,17 @@ class Normal(Distribution):
274274
:param loc: The location parameter of the distribution.
275275
:param scale: The scale parameter of the distribution.
276276
:param trunc: The truncation limits of the distribution.
277-
``None`` if the distribution is not truncated. The truncation limits
278-
are the truncation limits of the transformed distribution.
277+
``None`` if the distribution is not truncated.
279278
:param log: If ``True``, the distribution is transformed to a log-normal
280279
distribution. If a float, the distribution is transformed to a
281-
log-normal distribution with the given base.
280+
log-normal distribution with the given log-base.
282281
If ``False``, no transformation is applied.
283-
If a transformation is applied, the location and scale parameters
284-
and the truncation limits are the location, scale and truncation limits
285-
of the underlying normal distribution.
282+
283+
.. note::
284+
285+
If a transformation is applied, the location and scale parameters
286+
and the truncation limits are the location, scale and truncation
287+
limits of the underlying normal distribution.
286288
"""
287289

288290
def __init__(
@@ -333,8 +335,11 @@ class Uniform(Distribution):
333335
distribution. If a float, the distribution is transformed to a
334336
log-uniform distribution with the given base.
335337
If ``False``, no transformation is applied.
336-
If a transformation is applied, the lower and upper bounds are the
337-
lower and upper bounds of the underlying uniform distribution.
338+
339+
.. note::
340+
341+
If a transformation is applied, the lower and upper bounds are the
342+
lower and upper bounds of the underlying uniform distribution.
338343
"""
339344

340345
def __init__(
@@ -371,15 +376,17 @@ class Laplace(Distribution):
371376
:param loc: The location parameter of the distribution.
372377
:param scale: The scale parameter of the distribution.
373378
:param trunc: The truncation limits of the distribution.
374-
``None`` if the distribution is not truncated. The truncation limits
375-
are the truncation limits of the transformed distribution.
379+
``None`` if the distribution is not truncated.
376380
:param log: If ``True``, the distribution is transformed to a log-Laplace
377381
distribution. If a float, the distribution is transformed to a
378382
log-Laplace distribution with the given base.
379383
If ``False``, no transformation is applied.
380-
If a transformation is applied, the location and scale parameters
381-
and the truncation limits are the location, scale and truncation limits
382-
of the underlying Laplace distribution.
384+
385+
.. note::
386+
387+
If a transformation is applied, the location and scale parameters
388+
and the truncation limits are the location, scale and truncation
389+
limits of the underlying Laplace distribution.
383390
"""
384391

385392
def __init__(

0 commit comments

Comments
 (0)