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

Top comments (0)