diff --git a/tupak/gw/detector.py b/tupak/gw/detector.py index 5895119eedd09fd7b0dc7cc253dd98de8a5a79b6..97a319f92538c1b8562ac2458a50fa3984c7fff3 100644 --- a/tupak/gw/detector.py +++ b/tupak/gw/detector.py @@ -408,7 +408,7 @@ class InterferometerStrainData(object): def set_from_open_data( self, name, start_time, duration=4, outdir='outdir', cache=True, **kwargs): - """ Set the strain data from a open LOSC data + """ Set the strain data from open LOSC data This sets the time_domain_strain attribute, the frequency_domain_strain is automatically calculated after a low-pass filter and Tukey window @@ -439,6 +439,19 @@ class InterferometerStrainData(object): self.set_from_gwpy_timeseries(timeseries) self._check_maximum_frequency() + def set_from_csv(self, filename): + """ Set the strain data from a csv file + + Parameters + ---------- + filename: str + The path to the file to read in + + """ + timeseries = gwpy.timeseries.TimeSeries.read(filename, format='csv') + self.set_from_gwpy_timeseries(timeseries) + self._check_maximum_frequency() + def _infer_frequency_domain_dependence( self, sampling_frequency, duration, frequency_array): """ Helper function to figure out if the frequency_array, or @@ -745,6 +758,17 @@ class Interferometer(object): duration=duration, start_time=start_time, channel_name=channel_name, buffer_time=buffer_time) + def set_strain_data_from_csv(self, filename): + """ Set the `Interferometer.strain_data` from a csv file + + Parameters + ---------- + filename: str + The path to the file to read in + + """ + self.strain_data.set_from_csv(filename) + def set_strain_data_from_zero_noise( self, sampling_frequency, duration, start_time=0): """ Set the `Interferometer.strain_data` to zero noise