Skip to content

Commit c9342d6

Browse files
Return residuals plots if requested
1 parent a081425 commit c9342d6

File tree

1 file changed

+8
-1
lines changed
  • python/nyx_space/plots

1 file changed

+8
-1
lines changed

python/nyx_space/plots/od.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ def plot_residuals(
595595
show=True,
596596
):
597597
"""
598-
Plot of residuals, with 3-σ lines
598+
Plot of residuals, with 3-σ lines. Returns a tuple of the plots if show=False.
599599
"""
600600

601601
try:
@@ -621,6 +621,8 @@ def plot_residuals(
621621

622622
plt_any = False
623623

624+
rtn_plots = []
625+
624626
for col in df.columns:
625627
if col.startswith(kind):
626628
fig = go.Figure()
@@ -689,10 +691,15 @@ def plot_residuals(
689691

690692
if show:
691693
fig.show()
694+
else:
695+
rtn_plots += [fig]
692696

693697
if not plt_any:
694698
raise ValueError(f"No columns ending with {kind} found -- nothing plotted")
695699

700+
if not show:
701+
return rtn_plots
702+
696703

697704
def plot_residual_histogram(
698705
df, title, kind="Prefit", copyright=None, html_out=None, show=True

0 commit comments

Comments
 (0)