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 option to skip generator caching #16

Merged
merged 3 commits into from
May 22, 2024

Conversation

mj-will
Copy link
Contributor

@mj-will mj-will commented May 21, 2024

Following some discussion with @spxiwh, I wanted to add an option to disable the generator caching. For now, I've taken the simple approach of having two functions but I'm open to suggestions for how to best do this.

I've also added a test to ensure the cache is still called correctly.

@mj-will mj-will requested review from WuShichao and spxiwh May 21, 2024 16:29
@mj-will mj-will added the enhancement New feature or request label May 21, 2024
Copy link
Collaborator

@WuShichao WuShichao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

log_mf_min = int(math.log(f_min*MTSUN_SI*(m1+m2)) * 25)

wave_gen = get_waveform_genner(log_mf_min, run_phenomd=run_phenomd)
log_mf_min = math.log(f_min*MTSUN_SI*(m1+m2)) * 25
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! Why do you remove int()? Previously, we used it to round down.

if cache_generator:
# Use int to round down
wave_gen = cached_get_waveform_genner(
int(log_mf_min),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, OK, you moved it here.

@WuShichao WuShichao merged commit 8e35f56 into gwastro:main May 22, 2024
3 checks passed
@@ -129,6 +134,7 @@ def _bbhx_fd(
direct=False,
num_interp=100,
interp_f_lower=1e-4,
cache_generator=True,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest to make the default False. Easier to avoid issues if the user has to "opt-in" to use this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants