Skip to content

Commit d6fc0a8

Browse files
committed
Handle nans
1 parent f70c772 commit d6fc0a8

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

epochutils/stats/distributions.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -282,15 +282,12 @@ def cdf(self, x, _apply_transform=True):
282282
if np.isscalar(x):
283283
return self._cdf_scalar(x)
284284
else:
285-
x = np.atleast_1d(x)
286-
287-
nan_mask = np.isnan(x)
288-
result = np.full_like(x, np.nan)
289-
result[~nan_mask] = np.array([self._cdf_scalar(a) for a in x[~nan_mask]])
290-
291-
return result
285+
return np.array([self._cdf_scalar(a) for a in np.atleast_1d(x)])
292286

293287
def _cdf_scalar(self, x):
288+
if np.isnan(x):
289+
return np.nan
290+
294291
if self.lower_bound is not None and x <= self.lower_bound:
295292
return 0
296293

0 commit comments

Comments
 (0)