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

issue when using PSD from a file #4780

Closed
wants to merge 0 commits into from

Conversation

aleynaakyuz
Copy link

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.

low_freq_cutoff5_1_40km

@WuShichao WuShichao requested a review from ahnitz June 10, 2024 08:57
@WuShichao
Copy link
Contributor

Thanks, I know this f_lower issue, I just use 5.05 Hz for CE. Any comments from @ahnitz?

@WuShichao WuShichao added the 3g-detectors Code needed to aid with third generation detector analyses label Jun 10, 2024
@ahnitz
Copy link
Member

ahnitz commented Jun 26, 2024

@aleynaakyuz Can you please rebase this PR from master and check on the code climate report afterwards?

@ahnitz
Copy link
Member

ahnitz commented Jun 26, 2024

@WuShichao Can you verify your case as well, to see that you no longer have this restriction?

@ahnitz ahnitz requested a review from WuShichao June 26, 2024 17:03
@WuShichao
Copy link
Contributor

@ahnitz I just realized that my issue was not caused by this, just because the initial frequency of CE asd file is 5.000000000000000888e+00 not 5. I have checked Aleyna's case, this PR can fix her issue.

@ahnitz
Copy link
Member

ahnitz commented Jul 12, 2024

@aleynaakyuz You'll need to rebase this PR and make sure the unittests pass along with the code climate report (found as a link towards the bottom of the checks).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3g-detectors Code needed to aid with third generation detector analyses
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants