DEV Community

pupper emeritus
pupper emeritus

Posted on

GSoC Week 2-3 Update

Brief

These weeks I refactored the LombScargleCrossspectrum and LombScarglePowerspectrum classes to accommodate the fast algorithm which went smoothly.
However when it comes to the fast algorithm. I had tunnel vision and unconsciously made the lsft_fast function compute the power spectrum instead of the fourier transform. Right now I am working towards isolating the algorithm to compute the fourier transform using the Press and Rybicki optimizations(https://ui.adsabs.harvard.edu/abs/1989ApJ...338..277P/abstract).

Challenges Faced

Integrating the optimization to the existing slow algorithm is giving me a bit of trouble. I'm still figuring out how to add the optimizations. If this is done, I can move onto making the time lag, phase lag functions and then onto testing and documentation.

Details

Added the following parameters to both the classes in order to accommodate choice between the fast and slow algorithm.

method : str
        The method to be used by the Lomb-Scargle Fourier Transformation function. `fast`
        and `slow` are the allowed values. Default is `fast`. fast uses the optimized Press
        and Rybicki O(n*log(n))

    oversampling : float, optional, default: 5
        Interpolation Oversampling Factor (for the fast algorithm)
Enter fullscreen mode Exit fullscreen mode

For full code refer https://github.com/StingraySoftware/stingray/pull/737

Most important part of the process is the Lomb Scargle Fourier Transform.
The wrapper class is trivial, they only wrap the fast and slow lomb scargle fourier transform functions.

Results using the slow algorithm

On synthetic data

rand = np.random.default_rng(42)
    n = 100
    t = np.sort(rand.random(n)) * n
    y = np.cos(2 * np.pi * 5 * t) + 0.01 * rand.standard_normal(n)
    y -= np.min(y)
    lc1 = Lightcurve(t, y, err_dist="poisson")
    y2 = np.cos(2 * np.pi * 5.0 * (t)) + 0.01 * rand.standard_normal(n)
    y2 -= np.min(y2)
    lc2 = Lightcurve(t, y2, err_dist="poisson")
Enter fullscreen mode Exit fullscreen mode

Image description

On real data

The lightcurve

https://heasarc.gsfc.nasa.gov/FTP/nicer/data/obs/2018_03//1200120106/xti/event_cl/ni1200120106_0mpu7_cl.evt.gz

Image description

Image description

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay