stingray icon indicating copy to clipboard operation
stingray copied to clipboard

Handling gaps in data for Dynamical PS extraction

Open fcotizelati opened this issue 1 year ago • 2 comments

I tried extracting a DPS from a time series with gaps and observed that the "time" attribute of the DPS object overlooks the presence of these gaps. Could a warning or error message be implemented to notify users they're trying to extract a DPS from data with gaps? Alternatively, is it possible to account for the 'gti' attribute of the light curve during the DPS extraction?

fcotizelati avatar Feb 19 '24 08:02 fcotizelati

@fcotizelati thanks for the Issue! This is weird though, because DPS is based on the standard AveragedPowerSpectrum, and it does take gaps/GTIs into account. Could you provide a minimal working example showing the behavior?

matteobachetti avatar Feb 19 '24 10:02 matteobachetti

Hi @matteobachetti thank you! Of course, here are some steps:

lc.gti array([[ 0., 2270.], [5570., 7370.]])

dynspec = DynamicalPowerspectrum(lc, segment_size=128, norm='frac') 32it [00:00, 2205.50it/s]

dynspec.time array([ 64., 192., 320., 448., 576., 704., 832., 960., 1088., 1216., 1344., 1472., 1600., 1728., 1856., 1984., 2112., 5634., 5762., 5890., 6018., 6146., 6274., 6402., 6530., 6658., 6786., 6914., 7042., 7170., 7298.], dtype=float128)

In fact, I've realized that the problem is not so much in extracting the DPS, but in my plotting procedure: if I use the range min(dynspec.time), max(dynspec.time) to plot the power spectrum, I should mask the DPS portion that corresponds to the time intervals that are not covered by the GTI to ensure that the plot correctly reflects periods without data (e.g. using blank spaces?). So I can fix this easily on my own plotting code. But if I don't use the masks, the DPS is plotted also in the time periods with gaps, which can be misleading?

fcotizelati avatar Feb 19 '24 10:02 fcotizelati