dingo-gw / dingo

Dingo: Deep inference for gravitational-wave observations
MIT License
51 stars 16 forks source link

Issue in generate_asd_dataset when f_s is different than channel sampling frequency #205

Open hectorestelles opened 1 year ago

hectorestelles commented 1 year ago

Using dingo_generate_asd_dataset fails when the sampling frequency f_S specified in the asd_dataset_settings.yaml file does not correspond to the sampling frequency of the requested channel. I think this could be fixed adding a resampling step to https://github.com/dingo-gw/dingo/blob/8c68a7c4e3ea75e6aade9027eea4bef331fa4a1c/dingo/gw/download_strain_data.py#L54 to resample to the requested sampling frequency in the settings file.

nihargupte-ph commented 1 year ago

As hector mentioned this could be fixed by adding a resampling step to gwpy.TimeSeries. If we want to use the gwpy resampling method this would involve running t.resample(4096) and if we want to use the lal method would need to modify the following code snippet

# Resampling to 2048 Hz
lal_timeseries = {}
for ifo in ["H1", "L1"]:
    lal_timeseries[ifo] = raw_data["strain"][ifo].to_lal()
    lal.ResampleREAL8TimeSeries(lal_timeseries[ifo], float(1 / settings_raw_data["f_s"]))
    raw_data["strain"][ifo] = gwpy.timeseries.TimeSeries(
        lal_timeseries[ifo].data.data,
        epoch=lal_timeseries[ifo].epoch,
        dt=lal_timeseries[ifo].deltaT,
    )