def test_spin_orientation_normalised(self): norms = list() for ii in range(self.n_test): parameters = self.prior.sample() temp = spin.iid_spin_orientation_gaussian_isotropic( self.test_data, **parameters) norms.append(trapz(trapz(temp, self.costilts), self.costilts)) self.assertAlmostEqual(float(xp.max(xp.abs(1 - xp.asarray(norms)))), 0, 5)
def test_iid_matches_independent_tilts(self): iid_params = dict(xi_spin=0.5, sigma_spin=0.5) ind_params = dict(xi_spin=0.5, sigma_1=0.5, sigma_2=0.5) self.assertEquals(0.0, xp.max( spin.iid_spin_orientation_gaussian_isotropic( self.test_data, **iid_params) - spin.independent_spin_orientation_gaussian_isotropic( self.test_data, **ind_params)))
def test_iid_matches_independent(self): params = self.prior.sample() mag_params = {key: params[key] for key in ['amax', 'alpha_chi', 'beta_chi']} tilt_params = {key: params[key] for key in ['xi_spin', 'sigma_spin']} self.assertEquals(0.0, xp.max( spin.iid_spin(self.test_data, **params) - spin.iid_spin_magnitude_beta(self.test_data, **mag_params) * spin.iid_spin_orientation_gaussian_isotropic( self.test_data, **tilt_params)))