Skip to content

Commit

Permalink
tpf.interact(): replace the selected mask return with a more generic …
Browse files Browse the repository at this point in the history
…dict
  • Loading branch information
orionlee committed Feb 19, 2024
1 parent ffb4e35 commit eceadbb
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/lightkurve/interact.py
Original file line number Diff line number Diff line change
Expand Up @@ -1000,7 +1000,7 @@ def show_interact_widget(
vmax=None,
scale="log",
cmap="Viridis256",
return_selected_mask=False,
return_result=False,
):
"""Display an interactive Jupyter Notebook widget to inspect the pixel data.
Expand Down Expand Up @@ -1065,8 +1065,9 @@ def show_interact_widget(
Maximum color scale for tpf figure
cmap: str
Colormap to use for tpf plot. Default is 'Viridis256'
return_selected_mask: bool
Optional, if set to `True`, also return the pixel selection as an aperture mask.
return_result: bool
Optional, if set to `True`, also return a result dictionary,
with the key 'selection_mask' for the pixel selection as an aperture mask.
TODO: 1) document return result, 2) update for the docstring in tpf.interact(), 3) remind users to copy the result once satisfied.
"""
try:
Expand Down Expand Up @@ -1118,6 +1119,7 @@ def show_interact_widget(

# a copy of current pixel current selection for the use of caller
selected_mask_to_return = aperture_mask.copy()
interact_result = dict(selection_mask=selected_mask_to_return)

if transform_func is not None:
lc = transform_func(lc)
Expand Down Expand Up @@ -1320,8 +1322,8 @@ def jump_to_lightcurve_position(attr, old, new):

output_notebook(verbose=False, hide_banner=True)
show_result = show(create_interact_ui, notebook_url=notebook_url)
if return_selected_mask:
return show_result, selected_mask_to_return
if return_result:
return show_result, interact_result
else:
return show_result

Expand Down

0 comments on commit eceadbb

Please sign in to comment.