Skip to content

Commit

Permalink
add bootstrap additive test
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-springer committed Apr 29, 2024
1 parent 05b0af3 commit dd06d29
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions rdtools/test/bootstrap_test.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
'''Bootstrap module tests.'''

import pytest

from rdtools.bootstrap import _construct_confidence_intervals, \
_make_time_series_bootstrap_samples
from rdtools.degradation import degradation_year_on_year


def test_bootstrap_module(cods_normalized_daily, cods_normalized_daily_wo_noise):
@pytest.mark.parametrize("decomposition_type", ["multiplicative", "additive"])
def test_bootstrap_module(cods_normalized_daily, cods_normalized_daily_wo_noise, decomposition_type):
''' Test make time serie bootstrap samples and construct of confidence intervals. '''
# Test make bootstrap samples
bootstrap_samples = _make_time_series_bootstrap_samples(cods_normalized_daily,
cods_normalized_daily_wo_noise,
sample_nr=10,
block_length=90,
decomposition_type='multiplicative')
decomposition_type=decomposition_type)
# Check if results are as expected
assert (bootstrap_samples.index == cods_normalized_daily.index).all(), \
"Index of bootstrapped signals is not as expected"
Expand All @@ -30,3 +33,4 @@ def test_bootstrap_module(cods_normalized_daily, cods_normalized_daily_wo_noise)
assert len(metrics) == 10, "Length of metrics is not as expected"
for m in metrics:
assert isinstance(m, float), "Not all metrics are float"

0 comments on commit dd06d29

Please sign in to comment.