Skip to content

`ifo.strain_data.set_from_frame_file` has extra keyword argument 'resample'

Setting strain from a frame file does not work as an extra parameter resample is provided to the gwpy.timeseries.TimeSeries.read function.

Minimal example

from bilby.gw.detector import InterferometerList

ifos = InterferometerList(['H1', 'L1'])
for ifo in ifos:
    ifo.set_strain_data_from_frame_file(
        f'./{ifo.name}_GWOSC_4KHZ_R1-1126259447-32.gwf',
        1024, 4, start_time=1126259640.4,
        channel=f'{ifo.name}:GWOSC-4KHZ_R1_STRAIN'
        )

H1_GWOSC_4KHZ_R1-1126259447-32.gwf can be any path to a frame file (in this case, GW150914)

Apparently, the root of the issue is the function set_from_frame_file providing resample as a keyword argument which will then be feeded to gwpy.timeseries.TimeSeries.read.

Suggestion

Resample strain data just like the function set_from_channel_name below it, i.e.:

[Current]
        strain = gwutils.read_frame_file(
            frame_file, start_time=start_time, end_time=start_time + duration,
            buffer_time=buffer_time, channel=channel,
            resample=sampling_frequency)
[Change to]
        strain = gwutils.read_frame_file(
            frame_file, start_time=start_time, end_time=start_time + duration,
            buffer_time=buffer_time, channel=channel)
        strain = strain.resample(sampling_frequency)