Skip to content

Commit

Permalink
Bug fix in test
Browse files Browse the repository at this point in the history
  • Loading branch information
HKaras committed Nov 27, 2024
1 parent 744baf8 commit 80a3b86
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions test/test_model_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ def mock_x():

@pytest.fixture(scope='module')
def mock_data(mock_x):
data = bigauss(mock_x,mean1=3,mean2=4,std1=0.5,std2=0.2,amp1=0.5,amp2=0.6)
return data

@pytest.fixture(scope='module')
def mock_data_noise(mock_x):
data = bigauss(mock_x,mean1=3,mean2=4,std1=0.5,std2=0.2,amp1=0.5,amp2=0.6)
data += whitegaussnoise(mock_x,0.01,seed=1)
return data
Expand Down Expand Up @@ -552,14 +557,14 @@ def test_fit_evaluate_model(mock_data,mock_x,model_type):
# ================================================================
@pytest.mark.parametrize('method', ['bootstrap','moment'])
@pytest.mark.parametrize('model_type', model_types)
def test_fit_modelUncert(mock_data,mock_x,model_type,method):
def test_fit_modelUncert(mock_data_noise,mock_x,model_type,method):
"Check that the uncertainty of fit results can be calculated and is the uncertainty of the model is non zero for all but nonparametric models"
model = _generate_model(model_type, fixed_axis=False)

if method=='bootstrap':
results = fit(model,mock_data,mock_x, bootstrap=3)
results = fit(model,mock_data_noise,mock_x, bootstrap=3)
else:
results = fit(model,mock_data,mock_x)
results = fit(model,mock_data_noise,mock_x)

assert hasattr(results,'modelUncert')
ci_lower = results.modelUncert.ci(95)[:,0]
Expand Down

0 comments on commit 80a3b86

Please sign in to comment.