def test_p_values_from_sample(): np.random.seed(3) ns = NestedSamples(root='./tests/example_data/pc') ns._compute_insertion_indexes() nlive = len(ns.live_points()) ks_results = insertion_p_value(ns.insertion[nlive:-nlive], nlive) assert ks_results['p-value'] > 0.05 ks_results = insertion_p_value(ns.insertion[nlive:-nlive], nlive, batch=1) assert ks_results['p-value'] > 0.05
def test_compute_insertion(): np.random.seed(3) ns = NestedSamples(root='./tests/example_data/pc') assert 'insertion' not in ns ns._compute_insertion_indexes() assert 'insertion' in ns nlive = ns.nlive.mode()[0] assert_array_less(ns.insertion, nlive) u = ns.insertion.values/nlive assert kstest(u[nlive:-nlive], 'uniform').pvalue > 0.05 pvalues = [kstest(u[i:i+nlive], 'uniform').pvalue for i in range(nlive, len(ns)-2*nlive, nlive)] assert kstest(pvalues, 'uniform').pvalue > 0.05