Skip to content

Commit

Permalink
fix: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
andrzejnovak committed Jun 9, 2022
1 parent 6a3ab96 commit fc581ca
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/cabinetry/fit/results_containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class FitResults(NamedTuple):
uncertainty (np.ndarray): uncertainties of best-fit parameter results, evaluated
with Hessian
labels (List[str]): parameter labels
types (List[str]): parameter types
types (List[Optional[str]]): parameter types
corr_mat (np.ndarray): parameter correlation matrix
best_twice_nll (float): -2 log(likelihood) at best-fit point
goodess_of_fit (float, optional): goodness-of-fit p-value, defaults to -1
Expand Down
6 changes: 4 additions & 2 deletions src/cabinetry/visualize/plot_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ def pulls(
bestfit (np.ndarray): best-fit parameter results
uncertainty (np.ndarray): parameter uncertainties
labels (Union[List[str], np.ndarray]): parameter names
numeric Optional[Union[List[bool], np.ndarray]]: which parameters are numeric,
and should only be shown directly
figure_path (Optional[pathlib.Path], optional): path where figure should be
saved, or None to not save it, defaults to None
close_figure (bool, optional): whether to close each figure immediately after
Expand All @@ -94,7 +96,7 @@ def pulls(
numeric = np.zeros(num_pars, dtype=bool) if numeric is None else np.asarray(numeric)
y_positions = np.arange(num_pars)[::-1]

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

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

0 comments on commit fc581ca

Please sign in to comment.