StingraySoftware / stingray

Anything can happen in the next half hour (including spectral timing made easy)!
https://stingray.science/stingray
MIT License
174 stars 143 forks source link

Support for unevenly sampled data #347

Closed tetarenk closed 3 years ago

tetarenk commented 6 years ago

I was wondering if the stingray routines have support for analysis of unevenly sampled data.

For example, I am experimenting with using Stingray to do a timing analysis of radio frequency data, where my lightcurves are made up of multiple scans of continuous data separated by shorter gaps (kind of like NuStar lightcurves, but the timing of the gaps is not always regular).

dhuppenkothen commented 6 years ago

At the moment, many of our methods are based on Fourier analysis, so are strictly only valid for evenly sampled data (the statistics get wonky on unevenly sampled data).

This is a function of of what most of the core developers work on, but we'd very much like to support unevenly sampled data in the future. Are there any methods you're particularly interested in?

tetarenk commented 6 years ago

Thanks for the reply! I figured your routines only did the evenly sampled data, although I do see that you have support for GTIs. Could you explain to me how the code uses the GTIs, for example when the GTIs are used in the average power spectrum routine?

In terms of the methods for unevenly sampled data, I would be mainly interested in the power spectra/cross-spectra methods. I feel like I have read about algorithms for doing Fourier analysis of unevenly sampled data (although I dont pretend to know much about them), but have never really seen them implemented in a timing package like the one your building here.

dhuppenkothen commented 6 years ago

GTIs are used for example when making averaged power spectra (in class AveragedPowerspectrum) in the sense that the segments made (as defined by the keyword segment_size) will only be constructed within the limits of the GTIs. I think @matteobachetti probably has a better overview of all the methods that actually use the GTIs.

For unevenly sampled data, the situation gets much harder, because the statistical properties of the power-/crossspectrum are no longer simple. I think this is probably why you don't see many well-tested implementations. There are alternative methods (e.g. Lomb-Scargle periodograms), but what method you use depends on the properties of your data (do you have correlated stochastic noise? Are you looking for strictly periodic signals or something else?) and the problem.

I probably would avoid standard Fourier methods for unevenly sampled data. If you have a specific problem you're trying to solve, I can try to point you in the right direction. If there's something specific you'd like to see implemented in Stingray, please let us know! I by no means know all of the relevant literature out there!

tetarenk commented 6 years ago

Thanks for the info!

Essentially with this work we are trying to characterize radio flux variability from XRB jets, so we are exploring what timing methods can tell us the most about the radio variabilty signals right now. While we set up our radio observations so that we do have continuous sections of data to do a Fourier analysis on, I was just curious about the unevenly sampled methods for future work.

Although, I do have another question in regards to the cross-spectral analysis code. Are you guys planning on implementing a calculation of the intrinsic coherence taking into account the noise in the signals (like eq 8 in Vaughan & Nowak, 1997)?