Skip to content

Commit 98d3d73

Browse files
committed
--amend
1 parent 14ff296 commit 98d3d73

File tree

3 files changed

+23
-8
lines changed

3 files changed

+23
-8
lines changed

Diff for: tests/fit/test_fit.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -463,8 +463,8 @@ def test_ranking(mock_fit, example_spec):
463463
bestfit = np.asarray([0.9, 1.0])
464464
uncertainty = np.asarray([0.02, 0.1])
465465
labels = ["staterror", "mu"]
466-
labels = ["staterror", "normfactor"]
467-
fit_results = fit.FitResults(bestfit, uncertainty, labels, np.empty(0), 0.0)
466+
types = ["staterror", "normfactor"]
467+
fit_results = fit.FitResults(bestfit, uncertainty, labels, types, np.empty(0), 0.0)
468468
model, data = model_utils.model_and_data(example_spec)
469469
ranking_results = fit.ranking(model, data, fit_results=fit_results)
470470

Diff for: tests/fit/test_fit_results_containers.py

+16-3
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,12 @@ def test_FitResults():
99
bestfit = np.asarray([1.0])
1010
uncertainty = np.asarray([0.1])
1111
labels = ["par_a"]
12+
types = [None]
1213
corr_mat = np.asarray([[1.0]])
1314
best_twice_nll = 2.0
14-
fit_results = fit.FitResults(bestfit, uncertainty, labels, corr_mat, best_twice_nll)
15+
fit_results = fit.FitResults(
16+
bestfit, uncertainty, labels, types, corr_mat, best_twice_nll
17+
)
1518
assert np.allclose(fit_results.bestfit, bestfit)
1619
assert np.allclose(fit_results.uncertainty, uncertainty)
1720
assert fit_results.labels == labels
@@ -25,16 +28,25 @@ def test_RankingResults():
2528
bestfit = np.asarray([1.0])
2629
uncertainty = np.asarray([0.1])
2730
labels = ["par_a"]
31+
types = [None]
2832
prefit_up = np.asarray([0.3])
2933
prefit_down = np.asarray([-0.3])
3034
postfit_up = np.asarray([0.2])
3135
postfit_down = np.asarray([-0.2])
3236
ranking_results = fit.RankingResults(
33-
bestfit, uncertainty, labels, prefit_up, prefit_down, postfit_up, postfit_down
37+
bestfit,
38+
uncertainty,
39+
labels,
40+
types,
41+
prefit_up,
42+
prefit_down,
43+
postfit_up,
44+
postfit_down,
3445
)
3546
assert np.allclose(ranking_results.bestfit, bestfit)
3647
assert np.allclose(ranking_results.uncertainty, uncertainty)
3748
assert ranking_results.labels == labels
49+
assert ranking_results.types == types
3850
assert np.allclose(ranking_results.prefit_up, prefit_up)
3951
assert np.allclose(ranking_results.prefit_down, prefit_down)
4052
assert np.allclose(ranking_results.postfit_up, postfit_up)
@@ -100,7 +112,8 @@ def test_print_results(caplog):
100112
bestfit = np.asarray([1.0, 2.0])
101113
uncertainty = np.asarray([0.1, 0.3])
102114
labels = ["param_A", "param_B"]
103-
fit_results = fit.FitResults(bestfit, uncertainty, labels, np.empty(0), 0.0)
115+
types = [None, None]
116+
fit_results = fit.FitResults(bestfit, uncertainty, labels, types, np.empty(0), 0.0)
104117

105118
fit.print_results(fit_results)
106119
assert "param_A = 1.0000 +/- 0.1000" in [rec.message for rec in caplog.records]

Diff for: tests/visualize/test_visualize.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -360,10 +360,11 @@ def test_correlation_matrix(mock_draw):
360360
corr_mat = np.asarray([[1.0, 0.2, 0.1], [0.2, 1.0, 0.1], [0.1, 0.1, 1.0]])
361361
corr_mat_pruned = np.asarray([[1.0, 0.2], [0.2, 1.0]])
362362
labels = ["a", "b", "c"]
363+
types = [None, None, None]
363364
labels_pruned = ["a", "b"]
364365
folder_path = "tmp"
365366
figure_path = pathlib.Path(folder_path) / "correlation_matrix.pdf"
366-
fit_results = fit.FitResults(np.empty(0), np.empty(0), labels, corr_mat, 1.0)
367+
fit_results = fit.FitResults(np.empty(0), np.empty(0), labels, types, corr_mat, 1.0)
367368

368369
# pruning with threshold
369370
fig = visualize.correlation_matrix(
@@ -382,7 +383,7 @@ def test_correlation_matrix(mock_draw):
382383
# close figure, do not save
383384
corr_mat_fixed = np.asarray([[1.0, 0.2, 0.0], [0.2, 1.0, 0.0], [0.0, 0.0, 0.0]])
384385
fit_results_fixed = fit.FitResults(
385-
np.empty(0), np.empty(0), labels, corr_mat_fixed, 1.0
386+
np.empty(0), np.empty(0), labels, types, corr_mat_fixed, 1.0
386387
)
387388
_ = visualize.correlation_matrix(
388389
fit_results_fixed,
@@ -407,9 +408,10 @@ def test_pulls(mock_draw):
407408
bestfit = np.asarray([0.8, 1.0, 1.05, 1.1])
408409
uncertainty = np.asarray([0.9, 1.0, 0.03, 0.7])
409410
labels = ["a", "b", "staterror_region[0]", "c"]
411+
types = [None, None, None, None]
410412
exclude = ["a"]
411413
folder_path = "tmp"
412-
fit_results = fit.FitResults(bestfit, uncertainty, labels, np.empty(0), 1.0)
414+
fit_results = fit.FitResults(bestfit, uncertainty, labels, types, np.empty(0), 1.0)
413415

414416
filtered_bestfit = np.asarray([1.0, 1.1])
415417
filtered_uncertainty = np.asarray([1.0, 0.7])

0 commit comments

Comments
 (0)