Skip to content

Commit fc581ca

Browse files
committed
fix: cleanup
1 parent 6a3ab96 commit fc581ca

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

Diff for: src/cabinetry/fit/results_containers.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class FitResults(NamedTuple):
1313
uncertainty (np.ndarray): uncertainties of best-fit parameter results, evaluated
1414
with Hessian
1515
labels (List[str]): parameter labels
16-
types (List[str]): parameter types
16+
types (List[Optional[str]]): parameter types
1717
corr_mat (np.ndarray): parameter correlation matrix
1818
best_twice_nll (float): -2 log(likelihood) at best-fit point
1919
goodess_of_fit (float, optional): goodness-of-fit p-value, defaults to -1

Diff for: src/cabinetry/visualize/plot_result.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ def pulls(
8181
bestfit (np.ndarray): best-fit parameter results
8282
uncertainty (np.ndarray): parameter uncertainties
8383
labels (Union[List[str], np.ndarray]): parameter names
84+
numeric Optional[Union[List[bool], np.ndarray]]: which parameters are numeric,
85+
and should only be shown directly
8486
figure_path (Optional[pathlib.Path], optional): path where figure should be
8587
saved, or None to not save it, defaults to None
8688
close_figure (bool, optional): whether to close each figure immediately after
@@ -94,7 +96,7 @@ def pulls(
9496
numeric = np.zeros(num_pars, dtype=bool) if numeric is None else np.asarray(numeric)
9597
y_positions = np.arange(num_pars)[::-1]
9698

97-
fig, ax = plt.subplots(figsize=(6, 1 + num_pars / 4), dpi=100)
99+
fig, ax = plt.subplots()
98100
if num_pars > np.sum(numeric): # Actual pulls
99101
ax.errorbar(
100102
np.ma.masked_array(bestfit, mask=numeric),
@@ -120,7 +122,7 @@ def pulls(
120122
zip(numeric[::-1], bestfit[::-1], uncertainty[::-1])
121123
):
122124
if show:
123-
ax.text(0, i, f"{par:.2f} +- {unc:.2f}", ha="center", va="center")
125+
ax.text(0, i, rf"{par:.2f} $\pm$ {unc:.2f}", ha="center", va="center")
124126

125127
ax.set_xlim([-3, 3])
126128
ax.set_xlabel(r"$\left(\hat{\theta} - \theta_0\right) / \Delta \theta$")

0 commit comments

Comments
 (0)