Skip to content
Snippets Groups Projects
Commit 17718146 authored by Gregory Ashton's avatar Gregory Ashton
Browse files

Merge branch 'set-filter-frequency' into 'master'

Sets the filter_frequency used in frame_file based on the maximum

Closes #108

See merge request Monash/tupak!83
parents 591fa4ae d70c9215
No related branches found
No related tags found
1 merge request!83Sets the filter_frequency used in frame_file based on the maximum
Pipeline #
......@@ -249,7 +249,7 @@ class InterferometerStrainData(object):
def set_from_frame_file(self, frame_file, sampling_frequency,
duration, start_time=0, channel_name=None,
buffer_time=1, **kwargs):
buffer_time=1, filter_freq=None, alpha=0.25):
""" Set the `Interferometer.strain_data` from a frame file
Parameters
......@@ -267,12 +267,19 @@ class InterferometerStrainData(object):
buffer_time: float
Read in data with `start_time-buffer_time` and
`start_time+duration+buffer_time`
kwargs:
All other keyword arguments are passes to
`tupak.kw.utils.process_strain_data`
alpha: float
The tukey window shape parameter passed to `scipy.signal.tukey`.
filter_freq: float
Low pass filter frequency. If None, defaults to the maximum
frequency given to InterferometerStrainData.
"""
if filter_freq is None:
logging.debug(
"Setting low pass filter_freq using given maximum frequency")
filter_freq = self.maximum_frequency
self.sampling_frequency = sampling_frequency
self.duration = duration
self.start_time = start_time
......@@ -284,7 +291,8 @@ class InterferometerStrainData(object):
buffer_time=buffer_time, channel=channel_name,
resample=sampling_frequency)
frequency_domain_strain, frequencies = tupak.gw.utils.process_strain_data(strain, **kwargs)
frequency_domain_strain, frequencies = tupak.gw.utils.process_strain_data(
strain, filter_freq=filter_freq, alpha=alpha)
if np.array_equal(frequencies, self.frequency_array):
self._frequency_domain_strain = frequency_domain_strain
else:
......@@ -406,7 +414,7 @@ class Interferometer(object):
def set_strain_data_from_frame_file(
self, frame_file, sampling_frequency, duration, start_time=0,
channel_name=None, buffer_time=1, **kwargs):
channel_name=None, buffer_time=1, alpha=0.25, filter_freq=None):
""" Set the `Interferometer.strain_data` from a frame file
Parameters
......@@ -424,16 +432,18 @@ class Interferometer(object):
buffer_time: float
Read in data with `start_time-buffer_time` and
`start_time+duration+buffer_time`
kwargs:
All other keyword arguments are passes to
`tupak.kw.utils.process_strain_data`
alpha: float
The tukey window shape parameter passed to `scipy.signal.tukey`.
filter_freq: float
Low pass filter frequency. If None, defaults to the maximum
frequency given to InterferometerStrainData.
"""
self.strain_data.set_from_frame_file(
frame_file=frame_file, sampling_frequency=sampling_frequency,
duration=duration, start_time=start_time,
channel_name=channel_name, buffer_time=buffer_time,
**kwargs)
alpha=alpha, filter_freq=filter_freq)
def set_strain_data_from_zero_noise(
self, sampling_frequency, duration, start_time=0):
......
......@@ -389,7 +389,7 @@ def read_frame_file(file_name, t1, t2, channel=None, buffer_time=1, **kwargs):
return None
def process_strain_data(strain, alpha=0.25, filter_freq=1024, **kwargs):
def process_strain_data(strain, alpha=0.25, filter_freq=1024):
"""
Helper function to obtain an Interferometer instance with appropriate
PSD and data, given an center_time.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment