Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"flatten" deletes data points #142

Open
ttdu opened this issue Oct 1, 2024 · 3 comments
Open

"flatten" deletes data points #142

ttdu opened this issue Oct 1, 2024 · 3 comments

Comments

@ttdu
Copy link

ttdu commented Oct 1, 2024

Bug: After using flatten, some data disappears.
Expected behavior: flatten remove long-term trends but the number of data points is preserved

Steps to reproduce the bug:

  1. visit https://mast.stsci.edu/viz/ui/#/lcviz?uri=mast%3AK2%2Furl%2Fmissions%2Fk2%2Flightcurves%2Fc19%2F246400000%2F49000%2Fktwo246449092-c19_llc.fits
  2. use "flatten"
  3. All of the data from 9-14 days after start is completely obliterated
@kecnry
Copy link
Member

kecnry commented Oct 1, 2024

The original points in this case have a flux of exactly zero and it appears that lightkurve's faltten results in nans for these.

from lightkurve import search_lightcurve
lc = search_lightcurve("ktwo246449092", mission="K2", campaign=19, cadence="long").download()
print(lc[-1])
print(lc.flatten()[-1])

I suspect this isn't actually a bug, but is actually doing as expected (although it is confusing to see points that used to be plotted no longer exist - so maybe we can at least detect this in advance and warn that it will happen). @christinahedges - is this right? Would you consider this the same as lightkurve/lightkurve#674?

@ttdu
Copy link
Author

ttdu commented Oct 1, 2024

One thing that is handled by lcviz is the selected time range for plotting: if fluxes are NaNs, pressing the "home" button to zoom to all visible data is misleading. The NaNs aren't visible, so they shouldn't be in the "visible" range

@kecnry
Copy link
Member

kecnry commented Oct 1, 2024

It's a good point, but the times aren't nans, only the fluxes. So, in order to exclude those points from the zoom reset logic, we'd need to filter all x-values by whether their respective y-values are nans or not. I'm honestly not sure what is the more desired behavior in this case. Any thoughts @bmorris3?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants