def test_vaneylen19_bounds(self, kwargs): with self._model(): vaneylen19("ecc", **kwargs) trace = self._sample() ecc = trace["ecc"].flatten() assert np.all((kwargs.get("lower", 0.0) <= ecc) & (ecc <= kwargs.get("upper", 1.0)))
def test_vaneylen19_multi(self): with self._model(): vaneylen19("ecc", fixed=True, multi=True, shape=3) trace = self._sample() ecc = trace["ecc"].flatten() assert np.all((0 <= ecc) & (ecc <= 1)) f = 0.08 cdf = lambda x: ( # NOQA (1 - f) * halfnorm.cdf(x, scale=0.049) + f * rayleigh.cdf( x, scale=0.26)) s, p = kstest(ecc, cdf) assert s < 0.05
def test_vaneylen19(self, kwargs): with self._model() as model: dist = vaneylen19("ecc", shape=(5, 2), **kwargs) if not kwargs.get("fixed", False): assert "ecc_sigma_gauss" in model.named_vars assert "ecc_sigma_rayleigh" in model.named_vars assert "ecc_frac" in model.named_vars # Test random sampling samples = dist.random(size=100) assert np.shape(samples) == (100, 5, 2) assert np.all((0 <= samples) & (samples <= 1)) trace = self._sample() ecc = trace["ecc"] assert np.all((0 <= ecc) & (ecc <= 1))