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

Move buffer time to the utils function

Also adds documentation for buffer_time
parent 922a757d
No related branches found
No related tags found
1 merge request!72Clean up of detectors
Pipeline #
......@@ -233,6 +233,9 @@ class InterferometerStrainData(object):
The data duration (in s)
start_time: float
The GPS start-time of the data
buffer_time: float
Read in data with `start_time-buffer_time` and
`start_time+duration+buffer_time`
"""
......@@ -243,8 +246,8 @@ class InterferometerStrainData(object):
logging.info('Reading data from frame')
strain = tupak.gw.utils.read_frame_file(
frame_file, t1=start_time-buffer_time,
t2=start_time+duration+buffer_time, channel=channel_name,
frame_file, t1=start_time, t2=start_time+duration,
buffer_time=buffer_time, channel=channel_name,
resample=sampling_frequency)
frequency_domain_strain, frequencies = tupak.gw.utils.process_strain_data(strain, **kwargs)
......
......@@ -336,7 +336,7 @@ def get_open_strain_data(
return strain
def read_frame_file(file_name, t1, t2, channel=None, **kwargs):
def read_frame_file(file_name, t1, t2, channel=None, buffer_time=1, **kwargs):
""" A function which accesses the open strain data
This uses `gwpy` to download the open data and then saves a cached copy for
......@@ -348,6 +348,8 @@ def read_frame_file(file_name, t1, t2, channel=None, **kwargs):
The name of the frame to read
t1, t2: float
The GPS time of the start and end of the data
buffer_time: float
Read in data with `t1-buffer_time` and `t2+buffer_time`
channel: str
The name of the channel being searched for, some standard channel names are attempted
if channel is not specified or if specified channel is not found.
......@@ -374,7 +376,7 @@ def read_frame_file(file_name, t1, t2, channel=None, **kwargs):
if loaded:
continue
try:
strain = TimeSeries.read(source=file_name, channel=channel, start=t1, end=t2, **kwargs)
strain = TimeSeries.read(source=file_name, channel=channel, start=t1-buffer_time, end=t2+buffer_time, **kwargs)
loaded = True
logging.info('Successfully loaded {}.'.format(channel))
except RuntimeError:
......
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