def __call__(self, n, **kwargs): r""" The Watson spherical distribution model. Parameters ---------- n : array of shape(3) or array of shape(N x 3), sampled orientations of the Watson distribution. Returns ------- Bn: float or array of shape(N), Probability density at orientations n, given mu and kappa. """ odi = kwargs.get('odi', self.odi) beta_fraction = kwargs.get('beta_fraction', self.beta_fraction) mu = kwargs.get('mu', self.mu) psi = kwargs.get('psi', self.psi) kappa = odi2kappa(odi) beta = beta_fraction * kappa mu_cart = utils.unitsphere2cart_1d(mu) R = utils.rotation_matrix_100_to_theta_phi_psi(mu[0], mu[1], psi) mu_beta = R.dot(np.r_[0., 1., 0.]) numerator = _probability_bingham(kappa, beta, mu_cart, mu_beta, n) denominator = 4 * np.pi * self._get_normalization(kappa, beta) Bn = numerator / denominator return Bn
def __call__(self, n, **kwargs): r""" The Watson spherical distribution model [1, 2]. Parameters ---------- n : array of shape(3) or array of shape(N x 3), sampled orientations of the Watson distribution. Returns ------- Wn: float or array of shape(N), Probability density at orientations n, given mu and kappa. """ odi = kwargs.get('odi', self.odi) mu = kwargs.get('mu', self.mu) kappa = odi2kappa(odi) mu_cart = utils.unitsphere2cart_1d(mu) numerator = np.exp(kappa * np.dot(n, mu_cart)**2) denominator = 4 * np.pi * special.hyp1f1(0.5, 1.5, kappa) Wn = numerator / denominator return Wn