Skip to content

Commit 4db0fe6

Browse files
committed
_pdf_untruncated
1 parent 5581a6e commit 4db0fe6

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

petab/v1/distributions.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,13 +140,14 @@ def pdf(self, x) -> np.ndarray | float:
140140
141141
:param x: The value at which to evaluate the PDF.
142142
:return: The value of the PDF at ``x``.
143+
NaN, if ``x`` is outside the domain of the PDF.
143144
"""
144145
if self._trunc is None:
145-
return self._pdf_transformed_untruncated(x)
146+
return self._pdf_untruncated(x)
146147

147148
return np.where(
148149
(x >= self.trunc_low) & (x <= self.trunc_high),
149-
self._pdf_transformed_untruncated(x) * self._truncation_normalizer,
150+
self._pdf_untruncated(x) * self._truncation_normalizer,
150151
0,
151152
)
152153

@@ -159,12 +160,12 @@ def _pdf_untransformed_untruncated(self, x) -> np.ndarray | float:
159160
"""
160161
...
161162

162-
def _pdf_transformed_untruncated(self, x) -> np.ndarray | float:
163-
"""Probability density function of the transformed, but untruncated
164-
distribution at x.
163+
def _pdf_untruncated(self, x) -> np.ndarray | float:
164+
"""Probability density function of the untruncated distribution at x.
165165
166166
:param x: The value at which to evaluate the PDF.
167-
:return: The value of the PDF at ``x``.
167+
:return: The value of the PDF of the maybe-log-transformed distribution
168+
at ``x``.
168169
"""
169170
if self.logbase is False:
170171
return self._pdf_untransformed_untruncated(x)

petab/v1/priors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ def neglogprior(
261261
# we want to evaluate the prior on the untruncated distribution
262262
if x_scaled:
263263
x = unscale(x, self.transformation)
264-
return -np.log(self.distribution._pdf_transformed_untruncated(x))
264+
return -np.log(self.distribution._pdf_untruncated(x))
265265

266266
@staticmethod
267267
def from_par_dict(

0 commit comments

Comments
 (0)