Commit 33bc0398 authored by Gregory Ashton's avatar Gregory Ashton

Move low pass and window to be called by default when generating td data

Also adds logging messages
parent 1fe13b4c
Pipeline #23891 failed with stages
in 3 minutes and 18 seconds
......@@ -228,6 +228,10 @@ class InterferometerStrainData(object):
if self._frequency_domain_strain is not None:
return self._frequency_domain_strain * self.frequency_mask
elif self._time_domain_strain is not None:"Generating frequency domain strain from given time "
"domain strain.")
frequency_domain_strain, _ = utils.nfft(
self._time_domain_strain, self.sampling_frequency)
self._frequency_domain_strain = frequency_domain_strain
......@@ -324,6 +328,15 @@ class InterferometerStrainData(object):
"Setting low pass filter_freq using given maximum frequency")
filter_freq = self.maximum_frequency
if 2 * filter_freq >= self.sampling_frequency:
"Low pass filter frequency of {}Hz requested, this is equal"
" or greater than the Nyquist frequency so no filter applied"
logging.debug("Applying low pass filter with filter frequency {}"
bp = gwpy.signal.filter_design.lowpass(
filter_freq, self.sampling_frequency)
strain = gwpy.timeseries.TimeSeries(
......@@ -334,9 +347,12 @@ class InterferometerStrainData(object):
def get_tukey_window(self, N, duration):
alpha = 2 * self.roll_off / duration
window =, alpha=alpha)
logging.debug("Generated Tukey window with alpha = {}".format(alpha))
return window
def apply_tukey_window(self):
logging.debug("Applying Tukey window with roll_off {}"
N = len(self.time_domain_strain)
window = self.get_tukey_window(N, duration=self.duration)
self._time_domain_strain *= window
......@@ -1438,7 +1454,7 @@ def load_interferometer(filename):
def get_interferometer_with_open_data(
name, trigger_time, time_duration=4, start_time=None, roll_off=0.4, psd_offset=-1024,
psd_duration=100, cache=True, outdir='outdir', label=None, plot=True, filter_freq=1024,
psd_duration=100, cache=True, outdir='outdir', label=None, plot=True, filter_freq=None,
raw_data_file=None, **kwargs):
Helper function to obtain an Interferometer instance with appropriate
......@@ -1502,18 +1518,13 @@ def get_interferometer_with_open_data(
name=name, start_time=start_time + time_duration + psd_offset,
duration=psd_duration, outdir=outdir, cache=cache, **kwargs)
# Low pass filter
# Create and save PSDs
psd_file = strain_psd.create_power_spectral_density(
name=name, outdir=outdir,
interferometer = get_empty_interferometer(name)
interferometer.power_spectral_density = PowerSpectralDensity(
......@@ -1607,7 +1618,7 @@ def get_interferometer_with_fake_noise_and_injection(
def get_event_data(
event, interferometer_names=None, time_duration=4, roll_off=0.4,
psd_offset=-1024, psd_duration=100, cache=True, outdir='outdir',
label=None, plot=True, filter_freq=1024, raw_data_file=None, **kwargs):
label=None, plot=True, filter_freq=None, raw_data_file=None, **kwargs):
Get open data for a specified event.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment