Skip to content

Commit 27f4c1f

Browse files
committed
return dict of contour values with labels, including best value
1 parent 799fccb commit 27f4c1f

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

refl1d/webview/server/profile_uncertainty.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,12 +239,13 @@ def _draw_contours(
239239
col=col,
240240
secondary_y=secondary_y,
241241
)
242-
q = _plot_quantiles(
242+
named_contours = _plot_quantiles(
243243
zp, fp, contours, color, alpha=None, fig=fig, row=row, col=col, legendgroup=legendgroup, secondary_y=secondary_y
244244
)
245+
named_contours["best"] = fp[0]
245246
# Plot the best
246247
# axes.plot(zp, fp[0], '-', label=label, color=dark(color))
247-
return q
248+
return named_contours
248249

249250

250251
def _profile_labels(fig: "go.Figure", row: Optional[int] = None, col: Optional[int] = None, magnetic: bool = False):
@@ -366,9 +367,12 @@ def _plot_quantiles(
366367
"""
367368
_, q = form_quantiles(y, contours)
368369

370+
output = {}
369371
if alpha is None:
370372
alpha = 2.0 / (len(q) + 1)
371-
for lo, hi in q:
373+
for contour, (lo, hi) in zip(contours, q):
374+
output[f"{contour} percent lower"] = lo
375+
output[f"{contour} percent upper"] = hi
372376
fig.add_scattergl(
373377
x=x,
374378
y=lo,
@@ -396,4 +400,4 @@ def _plot_quantiles(
396400
legendgroup=legendgroup,
397401
secondary_y=secondary_y,
398402
)
399-
return q
403+
return output

0 commit comments

Comments
 (0)