You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, when an user selects custom pixels via tpf.interact(), the user cannot use the selected pixels (as an aperture mask) in subsequent work outside of interact()
The user can only indirectly access it by exporting the lightcurve and read it back.
Proposal: make tpf.interact() to optionally return the the selected pixels as an aperture mask, if users specify a new return_selection_mask parameter.
Example
# return_selection_mask is the new parameterinteract_mask=tpf.interact(return_selection_mask=True);
Here an user selects custom pixels to highlight a background spike due to SSO.
Users can then access the mask in subsequent cells in the notebook, creating a lightcurve, highlight the pixels in plot(), interact_sky(), plot_pixels(), etc.
# make a copy of the selection to avoid accidental pixel selection changes in the interact.
sso_mask = interact_mask.copy()
...
lc_sso = tpf.to_lightcurve(aperture_mask=sso_mask)
lc_sso.scatter();
tpf.plot_pixels(aperture_mask=sso_mask)
The returned result is a dict that contains the selected pixels mask in the key selection_mask .
It is a dict so as to accommodate possible future additions, e.g., returning x / y limits, etc. (Update: return the mask array directly upon feedback.)
Environment
lightkurve version (e.g. 1.0b6): v2.4.2
The text was updated successfully, but these errors were encountered:
orionlee
changed the title
Enhance TargetPixelFile.interact() to return the selected pixels programmaticaly
Enhance TargetPixelFile.interact() to let user access the selected pixels mask directly in Jupyter notebooks
Nov 11, 2023
Problem description
Currently, when an user selects custom pixels via
tpf.interact()
, the user cannot use the selected pixels (as an aperture mask) in subsequent work outside ofinteract()
The user can only indirectly access it by exporting the lightcurve and read it back.
Proposal: make
tpf.interact()
to optionally return the the selected pixels as an aperture mask, if users specify a newreturn_selection_mask
parameter.Example
Here an user selects custom pixels to highlight a background spike due to SSO.
Users can then access the mask in subsequent cells in the notebook, creating a lightcurve, highlight the pixels in
plot()
,interact_sky()
,plot_pixels(),
etc.The returned result is a(Update: return the mask array directly upon feedback.)dict
that contains the selected pixels mask in the keyselection_mask
.It is a
dict
so as to accommodate possible future additions, e.g., returning x / y limits, etc.Environment
The text was updated successfully, but these errors were encountered: