Skip to content

Commit

Permalink
added testcase for hydra-nl (#91)
Browse files Browse the repository at this point in the history
  • Loading branch information
veenstrajelmer authored Jun 20, 2024
1 parent 5de2ea0 commit 7fc30e4
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/test_overschrijding.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit 7fc30e4

Please sign in to comment.