Skip to content

Commit

Permalink
Add error message to flacky test_that_posterior_generalized_variance_…
Browse files Browse the repository at this point in the history
…increases_in_cutoff
  • Loading branch information
kvashchuka committed Nov 9, 2023
1 parent 0877ddd commit 595f7ff
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions tests/unit_tests/analysis/test_adaptive_localization.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,16 @@ def test_that_posterior_generalized_variance_increases_in_cutoff(copy_poly_case)
posterior_cutoff1_cov = np.cov(posterior_sample_cutoff1, rowvar=False)
posterior_cutoff2_cov = np.cov(posterior_sample_cutoff2, rowvar=False)

# Check that posterior generalized variance increases in cutoff
generalized_variance_1 = np.linalg.det(posterior_cutoff1_cov)
generalized_variance_2 = np.linalg.det(posterior_cutoff2_cov)
generalized_variance_prior = np.linalg.det(prior_cov)

# Check that posterior generalized variance in positive, increases in cutoff and
# does not exceed prior generalized variance
assert generalized_variance_1 > 0, f"Assertion failed with cutoff1={cutoff1}"
assert (
0
< np.linalg.det(posterior_cutoff1_cov)
<= np.linalg.det(posterior_cutoff2_cov)
<= np.linalg.det(prior_cov)
)
generalized_variance_1 <= generalized_variance_2
), f"Assertion failed with cutoff1={cutoff1} and cutoff2={cutoff2}"
assert (
generalized_variance_2 <= generalized_variance_prior
), f"Assertion failed with cutoff2={cutoff2}"

0 comments on commit 595f7ff

Please sign in to comment.