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

Psd fix #4869

Closed
wants to merge 9 commits into from
Closed

Psd fix #4869

wants to merge 9 commits into from

Conversation

aleynaakyuz
Copy link
Contributor

@aleynaakyuz aleynaakyuz commented Sep 9, 2024

This is a reopened version of an accidentally closed pull request.

I am working with the strain sensitivity curves for Cosmic Explorer, which are available here. When I read the data files using the pycbc.psd.read.from_txt function with df=0.1, low_freq_cutoff=5.1, and length=4000, I observed that the resulting curves appear flat, as shown in the attached plot.

After examining the issue, I found that this issue does not occur with different values for low_freq_cutoff. The problem arises due to floating point arithmetic. Specifically, the value of low_freq_cutoff is 5.1 and delta_f is 0.1, so kmin should ideally be 51. However, in Python, the calculation 5.1 / 0.1 yields 50.99999999999999, and since the code uses the int function, kmin is set to 50. This causes flow to be 5 and data_start to be -1 because the first value of freq_data is slightly above 50 for Cosmic Explorer.

I would suggest that you resolve this issue by replacing the int function with the round function in the relevant part of the code. This change will ensure that kmin is correctly calculated as 51 when low_freq_cutoff is 5.1 and delta_f is 0.1.

338024600-a06b661d-47a0-4e24-b20a-86838f20dc78

@ahnitz
Copy link
Member

ahnitz commented Sep 9, 2024

@aleynaakyuz Please rebase from master as you've seemed to mix in your changes to the conversions module.

@aleynaakyuz aleynaakyuz deleted the psd_fix branch September 11, 2024 00:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants