Skip to content

return expected power at frequency = 0 #34

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion gatspy/periodic/lomb_scargle_fast.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,11 @@ def lomb_scargle_fast(t, y, dy=1, f0=0, df=None, Nf=None,
warnings.simplefilter("ignore")

power = (YC * YC / CC + YS * YS / SS) / YY


# fix power at zero frequency
if f0 == 0:
power[0] = np.mean(y ** 2 - (y - np.mean(y)) ** 2) / np.mean(y ** 2)

# fix NaN and INF at zero frequency
if np.isnan(power[0]) or np.isinf(power[0]):
power[0] = 0
Expand Down