def logcdf(self, samples):
'''
Calculates the log of the cumulative distribution function.
Parameters
----------
samples : array_like
n-by-2 matrix of samples where n is the number of samples.
Returns
-------
vals : ndarray
Log of the cumulative distribution function evaluated at `samples`.
'''
samples = np.copy(np.asarray(samples))
samples = self.__crop_input(samples)
samples = self.__rotate_input(samples)
vals = self._logcdf(samples)
# Transform according to rotation, but take `__rotate_input` into
# account.
if self.rotation == '90°':
old_settings = np.seterr(divide='ignore')
vals = np.log(np.maximum(0, samples[:, 0] - np.exp(vals)))
np.seterr(**old_settings)
elif self.rotation == '180°':
old_settings = np.seterr(divide='ignore')
vals = np.log(np.maximum(0,
(1 - samples[:, 0]) + (1 - samples[:, 1])
- 1.0 + np.exp(vals)))
np.seterr(**old_settings)
elif self.rotation == '270°':
old_settings = np.seterr(divide='ignore')
vals = np.log(np.maximum(0, samples[:, 1] - np.exp(vals)))
np.seterr(**old_settings)
return vals
评论列表
文章目录