Skip to content

Commit

Permalink
Remove additional complication that isn't needed
Browse files Browse the repository at this point in the history
  • Loading branch information
spxiwh committed Aug 3, 2022
1 parent a35cd98 commit f8bb770
Showing 1 changed file with 7 additions and 21 deletions.
28 changes: 7 additions & 21 deletions pycbc/strain/strain.py
Original file line number Diff line number Diff line change
Expand Up @@ -1445,7 +1445,6 @@ def __init__(self, frame_src, channel_name, start_time,

# Caches for FFTs to use class based API
self.fft_cache = {}
self.fft_pad_cache = {}

@property
def start_time(self):
Expand Down Expand Up @@ -1525,29 +1524,19 @@ def create_memory_for_overwhitened_data(self, npoints_time):
delta_t=self.strain.delta_t,
ifft=True
)
self.fft_cache[npoints_time] = (
data_fft_outs,
whitened_data_ifft_outs
)


def create_memory_for_padded_data_fft(self, npoints_time):
""" Create memory for FFTing overwhitened data after removing padding
Parameters
----------
npoints_time: int
The length (in samples) of the time domain data to create memory
for carrying out the necessary FFT.
"""
trimmed_data_fft_outs = create_memory_and_engine_for_class_based_fft(
npoints_time,
npoints_time - (2 * self.reduced_pad),
self.strain.dtype,
delta_t=self.strain.delta_t,
ifft=False
)

self.fft_pad_cache[npoints_time] = trimmed_data_fft_outs
self.fft_cache[npoints_time] = (
data_fft_outs,
whitened_data_ifft_outs,
trimmed_data_fft_outs
)

def overwhitened_data(self, delta_f):
""" Return overwhitened data
Expand Down Expand Up @@ -1610,11 +1599,8 @@ def overwhitened_data(self, delta_f):
gate_params = [(overwhite2.start_time, 0., taper_window),
(overwhite2.end_time, 0., taper_window)]
gate_data(overwhite2, gate_params)
npoints_time = len(overwhite2)
if npoints_time not in self.fft_pad_cache:
self.create_memory_for_padded_data_fft(npoints_time)

vec, fseries_trimmed, fft_class = self.fft_pad_cache[npoints_time]
vec, fseries_trimmed, fft_class = self.fft_cache[npoints_time][2]
vec._data[:] = overwhite2._data[:]
fft_class.execute() # vec -> FFT -> fseries_trimmed
fseries_trimmed._data *= vec._delta_t
Expand Down

0 comments on commit f8bb770

Please sign in to comment.