Skip to content

Commit

Permalink
Add an estimator for end frequency of the any custom waveform model (#…
Browse files Browse the repository at this point in the history
…4911)

* added files

* addressed codeclimate issues
  • Loading branch information
Kanchan-05 authored Oct 16, 2024
1 parent e86c213 commit 72e4224
Showing 1 changed file with 22 additions and 0 deletions.
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())

0 comments on commit 72e4224

Please sign in to comment.