diff --git a/tests/test_overschrijding.py b/tests/test_overschrijding.py index e7026c9..35ee7bb 100644 --- a/tests/test_overschrijding.py +++ b/tests/test_overschrijding.py @@ -24,6 +24,25 @@ def test_calc_overschrijding(df_ext_12_2010_2014): assert np.allclose(dist['Geinterpoleerd']['values'].values, expected_values) +@pytest.mark.unittest +def test_calc_overschrijding_with_hydra(df_ext_12_2010_2014): + Tfreqs_interested = [5, 2, 1, 1/2, 1/5, 1/10, 1/20, 1/50, 1/100, 1/200] + df_hydra = pd.DataFrame({'values': np.array([2.473, 3.18 , 4.043, 4.164, 4.358, + 4.696, 5.056, 5.468, 5.865, 6.328, 7.207]), + 'values_Tfreq': np.array([1.00000000e+00, 1.00000000e-01, 2.00000000e-02, 1.00000000e-02, + 3.33333333e-03, 1.00000000e-03, 3.33333333e-04, 1.00000000e-04, + 3.33333333e-05, 1.00000000e-05, 1.00000000e-06])}) + dist_hydra = {"Hydra-NL": df_hydra} + dist = kw.calc_overschrijding(df_ext=df_ext_12_2010_2014, interp_freqs=Tfreqs_interested, dist=dist_hydra) + + expected_keys = ['Hydra-NL', 'Ongefilterd', 'Trendanalyse', 'Weibull', 'Gecombineerd', 'Geinterpoleerd'] + assert set(dist.keys()) == set(expected_keys) + assert np.allclose(dist['Geinterpoleerd']['values_Tfreq'].values, Tfreqs_interested) + expected_values = np.array([1.93 , 2.09327434, 2.26311587, 2.46299612, 2.79965222, + 3.08436295, 3.4987347 , 4.043 , 4.164 , 4.3095 ]) + assert np.allclose(dist['Geinterpoleerd']['values'].values, expected_values) + + @pytest.mark.unittest def test_calc_overschrijding_rule_type_break(df_ext_12_2010_2014): Tfreqs_interested = [5, 2, 1, 1/2, 1/5, 1/10, 1/20, 1/50, 1/100, 1/200]