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

Add an estimator for end frequency of the any custom waveform model #4911

Merged
merged 2 commits into from
Oct 16, 2024
Merged
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
22 changes: 22 additions & 0 deletions pycbc/waveform/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,24 @@ def add_length_estimator(approximant, function):
td_fd_waveform_transform(approximant)


def add_end_frequency_estimator(approximant, function):
""" Add end frequency estimator for an approximant

Parameters
----------
approximant : str
Name of approximant
function : function
A function which takes kwargs and returns the waveform end frequency
"""
from pycbc.waveform.waveform import _filter_ends
if approximant in _filter_ends:
raise RuntimeError("Can't load freqeuncy estimator {}, the name is"
" already in use.".format(approximant))

_filter_ends[approximant] = function


def retrieve_waveform_plugins():
""" Process external waveform plugins
"""
Expand Down Expand Up @@ -106,3 +124,7 @@ def retrieve_waveform_plugins():
# Check for waveform length estimates
for plugin in pkg_resources.iter_entry_points('pycbc.waveform.length'):
add_length_estimator(plugin.name, plugin.resolve())

# Check for waveform end frequency estimates
for plugin in pkg_resources.iter_entry_points('pycbc.waveform.end_freq'):
add_end_frequency_estimator(plugin.name, plugin.resolve())
Loading