candl.tests#
Tests are supplied for each released likelihood to verify that they operate correctly.
A test is comprised of a .yaml file with the following contents:
data_set_file: "path_to_the_data_set_file.yaml"
lensing: False # set True for lensing likelihoods
test_spectrum: "tests/path_to_test_spectrum.txt" # spectrum to test
param_values: {"y": 1.0} # nuisance parameter values
test_chisq: 300.00 # expected chi-squared value
The file pointed to by test_spectrum is a text file with the following columns: ell, TT, TE, EE, BB, PP, KK, starting at \(\ell = 2\).
Instead of test_chisq, you can also supply test_logl, which will test the log-likelihood value.
A test is considered to pass if the returned chi-squared or log-likelihood value is within 0.1% of the expected value.
- candl.tests.run_test(test_file)#
Runs a test based on the provided test file. Uses the relative difference between the official likelihood and the candl implementation. Relative tolerance is 1e-3. Prints results.
- Parameters:
- test_filestr
The path to the test .yaml file.
- Returns:
- None