Support light curves centered around zero
See original GitHub issueProblem description
For light curves input by the user, it is not uncommon for the time series flux to be normalized and mean-subtracted so that the relative flux is centered around zero.
This causes problems when lightkurve attempts to re-normalize (often unnecessarily) the flux by dividing the median which is very close or equal to zero.
The minimum thing to add is a warning of possible bad behavior when normalize
is called on a light curve that contains negative values.
We should also remove unnecessary calls to lc.normalize(), such as the one in periodogram.from_lightcurve
that has no practical effect. I will submit a pull request for this soon. Perhaps auto-renormalization could also not be the default where it’s an option, like in lightcurve.plot
(change default to normalize=False
).
Has zero-centered flux been previously considered for the lightkurve internal default?
Example
import numpy as np
import lightkurve as lk
time = np.arange(100)
amp = 0.1 #What we want to measure
freq = 0.08412
flux = amp*np.cos(2*np.pi*np.arange(100)*freq)
lc = lk.LightCurve(time,flux)
ls = lc.to_periodogram(normalization='amplitude')
print(ls.max_power)
Gives… 23627464 ppm
Expected behavior
Expect to measure close to the input amplitude of 1e5 ppm. Renormalization under the hood (division by small number) causes the variability to blow up.
Environment
- platform (e.g. Linux, OSX, Windows): OSX
- lightkurve version (e.g. 1.0b6): 1.0.1
- installation method (e.g. pip, conda, source): conda
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:16 (7 by maintainers)
Top GitHub Comments
Thanks Keaton!! Please do keep thinking about this and feel free to open new issues with examples. I love that you are making us think about this!!
(I’m going to close this issue for clarity, because I think the original problem has been resolved!)
That was basically my suggestion. Let’s table it for now and see if anyone else has need for this. You’re right that this can be done manually as is.