Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Downsample waveform in gated gaussian model #4940

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion pycbc/inference/models/gated_gaussian_noise.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from pycbc.pnutils import hybrid_meco_frequency
from pycbc.waveform.utils import time_from_frequencyseries
from pycbc.waveform import generator
from pycbc.filter import highpass
from pycbc.filter import highpass, resample_to_delta_t
from .gaussian_noise import (BaseGaussianNoise, create_waveform_generator)
from .base_data import BaseDataModel
from .data_utils import fd_data_from_strain_dict
Expand Down Expand Up @@ -207,6 +207,12 @@ def get_waveforms(self):
h = highpass(
h.to_timeseries(),
frequency=self.highpass_waveforms).to_frequencyseries()
if 'waveform_srate' in self.static_params:
logging.warning("Resampling waveform from %f to %f Hz",
self.static_params['waveform_srate'], self.data[det].sample_rate)
h = resample_to_delta_t(h.to_timeseries(),
1. / self.data[det].sample_rate,
method='ldas').to_frequencyseries()
wfs[det] = h
self._current_wfs = wfs
return self._current_wfs
Expand Down
3 changes: 3 additions & 0 deletions pycbc/inference/models/gaussian_noise.py
Original file line number Diff line number Diff line change
Expand Up @@ -1215,6 +1215,9 @@ def create_waveform_generator(
d.start_time == start_time]):
raise ValueError("data must all have the same delta_t, "
"delta_f, and start_time")
if 'waveform_srate' in static_params:
delta_t = 1. / static_params['waveform_srate']
logging.warning("Overriding delta_t to match waveform_srate")
waveform_generator = generator_class(
generator_function, epoch=start_time,
variable_args=variable_params, detectors=list(data.keys()),
Expand Down
Loading