def test_gaussian_chi_p(self): self.assertTrue( xp.all( spin.gaussian_chi_p( dict(chi_p=xp.linspace(-2, 2, 1001)), mu_chi_p=0.4, sigma_chi_p=0.1 ) == truncnorm(xp.linspace(-2, 2, 1001), mu=0.4, sigma=0.1, low=0, high=1) ) )
def test_truncnorm_zero_below_low(self): equal_zero = True for ii in range(self.n_test): xx = self.lows[ii] - 1 vals = utils.truncnorm(xx=xx, mu=self.mus[ii], sigma=self.sigmas[ii], low=self.lows[ii], high=self.highs[ii]) equal_zero = equal_zero & (vals == 0.0) self.assertTrue(equal_zero)
def test_truncnorm_sigma_below_zero_raises_value_error(self): with self.assertRaises(ValueError): utils.truncnorm(xx=0, mu=0, sigma=-1, high=10, low=-10)