From 2adc61d23c5b54a4db593be1ed0955076860d8d6 Mon Sep 17 00:00:00 2001 From: grantbuster Date: Mon, 4 Nov 2024 09:07:21 -0700 Subject: [PATCH] added test for delta range protection --- tests/test_bc.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/test_bc.py b/tests/test_bc.py index 2e210633..12b99eed 100644 --- a/tests/test_bc.py +++ b/tests/test_bc.py @@ -159,3 +159,11 @@ def test_difficult_qdm(): delta_denom_min=0.01) arr_bc = qdm_rel_fut(arr[:, np.newaxis]) assert arr_bc.max() < 40 # fixed result + + # test that delta_range fixes this + qdm_rel_fut = QuantileDeltaMapping(params_oh, params_mh, params_mf, + dist='empirical', relative=True, + sampling='invlog', log_base=10, + delta_range=(0.5, 1.5)) + arr_bc = qdm_rel_fut(arr[:, np.newaxis]) + assert arr_bc.max() < (arr.max() * 1.5) # fixed result