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

Periodogram does not seem to converge #7

Open
icweaver opened this issue Jul 11, 2021 · 2 comments
Open

Periodogram does not seem to converge #7

icweaver opened this issue Jul 11, 2021 · 2 comments

Comments

@icweaver
Copy link

Hi @christinahedges, thanks again for the quick fix in #6! I am running into an issue now where the periodograms do not seem to be converging for me:

from tess_sip import SIP
import lightkurve as lk
import matplotlib.pyplot as plt

%config InlineBackend.print_figure_kwargs={"facecolor" : "w"}

srs_tpfs = lk.search_targetpixelfile("WASP-50", author="TESS-SPOC", sector=4)
tpfs = srs_tpfs.download_all()

display(srs_tpfs)

r = SIP(tpfs, min_period=1, max_period=30)
plt.plot(r["periods"], r["power"])
SearchResult containing 1 data products.

 #     mission     year   author  exptime target_name distance
                                     s                 arcsec 
--- -------------- ---- --------- ------- ----------- --------
  0 TESS Sector 04 2018 TESS-SPOC    1800   382391899      0.0
/home/mango/miniconda3/envs/tess_sip/lib/python3.9/site-packages/lightkurve/lightcurve.py:1031: LightkurveWarning: The light curve appears to be zero-centered (median=1.91e+04 electron / s +/- 1.05e+05 electron / s); `normalize()` will divide the light curve by a value close to zero, which is probably not what you want.
  warnings.warn(
Running pixels in aperture: 100%|█████████████████████████████████████████████████████████████████████████████████████| 80/80 [00:00<00:00, 490.13it/s]

download

For comparison, the periodogram created from the light curve file returns the following:

srs_lcs = lk.search_lightcurve("WASP-50", author="TESS-SPOC", sector=4)
lcs = srs_lcs.download_all()

display(srs_lcs)

lc = lcs[0].remove_nans().normalize()
pg = lc.to_periodogram(minimum_period=1, maximum_period=30)
plt.plot(pg.period, pg.power) # pg.plot()
SearchResult containing 1 data products.

 #     mission     year   author  exptime target_name distance
                                     s                 arcsec 
--- -------------- ---- --------- ------- ----------- --------
  0 TESS Sector 04 2018 TESS-SPOC    1800   382391899      0.0

download 2

I was wondering if there is anything that I need to tune/transform beforehand or if there are any other sort of diagnostics I should check first?

@christinahedges
Copy link
Owner

Hi @icweaver, this is definitely expected behavior here, as we go to longer periods it's easy to over fit (because we're fitting systematics at the same time as doing the periodogram). The power_bkg array is the periodogram of the background pixels, and if you compare to that you should be able to identify true signal compared to overfitting, e.g.

image

In the example here there is lots of power in the background pixels at long periods so we can discount it.

Hope this helps?

@icweaver
Copy link
Author

icweaver commented Jul 13, 2021

Oh perfect, dividing them certainly does the trick!

plt.plot(r["periods"], r["power"]/r["power_bkg"])

download

I see now that you even introduced background pixel correction in an earlier release for dealing with exactly this, sorry for the noise (no pun intended)

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