`LombScargle(..., method="fast")` disagrees with the exact method by more than expected on tightly clustered, non-uniform sampling · Issue #20449 · astropy/astropy · GitHub
Skip to content

LombScargle(..., method="fast") disagrees with the exact method by more than expected on tightly clustered, non-uniform sampling #20449

Open

Description

@ChenziqiAdam

Description

No response

Expected behavior

For the standard normalization (power bounded to [0, 1]), fast and slow should agree to within a small absolute budget (on the order of 1e-6) across the range of sampling patterns the method is documented to support.

How to Reproduce

import numpy as np
from astropy.timeseries import LombScargle

rng = np.random.default_rng(0)
span = 1094.6
count = 155
t = np.sort(np.r_[rng.normal(0, span * 1e-8, count - 1), span])  # 154 points
                                                                   # clustered near t=0,
                                                                   # plus one at t=span
y = rng.normal(size=count)
frequency = 0.8 + 0.0037 * np.arange(791)

ls = LombScargle(t, y)
fast_power = ls.power(frequency, method="fast",
                       assume_regular_frequency=True, normalization="standard")
slow_power = ls.power(frequency, method="slow", normalization="standard")

print(np.max(np.abs(fast_power - slow_power)))  # 7.53e-06

Versions

Latest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions