question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support light curves centered around zero

See original GitHub issue

Problem 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:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:16 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
barentsencommented, Sep 24, 2019

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!)

0reactions
keatonbcommented, Sep 24, 2019

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Support light curves centered around zero · Issue #569 - GitHub
Problem description For light curves input by the user, it is not uncommon for the time series flux to be normalized and mean-subtracted...
Read more >
Light Curves - Introduction - Imagine the Universe! - NASA
Light curves are graphs that show the brightness of an object over a period of time. In the study of objects which change...
Read more >
A Data-driven Approach to Detrending TESS Full-frame Image ...
We divide each pixel light curve by its median value and then subtract 1 from the resulting light curve to center it around...
Read more >
The VARTOOLS Light Curve Analysis Program
The program is run by issuing a sequence of commands to perform actions on light curves, each command is executed in turn with...
Read more >
Global properties of the light curves of magnetic, chemically ...
This light-curve profile can be simulated by assuming one bright photometric spot centered at phase zero. The second principal component is a symmetric...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found