Skip to content

Commit

Permalink
add a test for caching with mf_min
Browse files Browse the repository at this point in the history
  • Loading branch information
mj-will committed Aug 22, 2024
1 parent 088240a commit fe75059
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ def test_cache_generator(params, cache_generator):

params["approximant"] = "BBHX_PhenomD"
params["cache_generator"] = cache_generator
params["mf_min"] = None

# Build cache if using it
get_fd_det_waveform(**params)
Expand All @@ -101,6 +102,27 @@ def test_cache_generator(params, cache_generator):
else:
assert cache_info.hits == 0

def test_cache_generator_mf_min(params):
from BBHX_Phenom import cached_get_waveform_genner

# Clear cache for these tests
cached_get_waveform_genner.cache_clear()

params["approximant"] = "BBHX_PhenomD"
params["cache_generator"] = True
params["mf_min"] = 1e-4

masses = [2e6, 3e6]

# Build cache
get_fd_det_waveform(**params)

for m in masses:
params["mass1"] = m
get_fd_det_waveform(**params)

cache_info = cached_get_waveform_genner.cache_info()
assert cache_info.hits == len(masses)


def test_length_in_time(params, approximant):
Expand Down

0 comments on commit fe75059

Please sign in to comment.