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 missing detection_snr argument #1615

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

dethodav
Copy link
Contributor

@dethodav dethodav commented May 3, 2023

This PR addresses #1614 to correctly pass the detection_snr argument to inspiral_range.range().

With this update, the inspired_range() function returns sensible values:

>>> from gwosc.datasets import event_gps
>>> from gwpy.timeseries import TimeSeries
>>> from gwpy.astro import sensemon_range, inspiral_range
>>>
>>> gps = event_gps("GW150914")
>>> data = TimeSeries.fetch_open_data('L1', gps-32, gps+32, cache=True)
>>>
>>> psd = data.psd(4,2)
>>>
>>> snrs = [2,8,16]
>>> fmin = 10
>>> fmax = 100
>>>
>>> for s in snrs:
...     print('SNR = %d'%s)
...     r_sensemon = sensemon_range(psd, fmin=fmin, fmax=fmax, snr=s)
...     r_astro = inspiral_range(psd, fmin=fmin, fmax=fmax, snr=s)
...     print('sensemon range: %.2f Mpc'%r_sensemon.value)
...     print('inspiral range: %.2f Mpc'%r_astro.value)
...     print('ratio, sensemon/inspiral: %.2f'%(r_sensemon.value/r_astro.value))
...     print()
...
SNR = 2
sensemon range: 175.12 Mpc
inspiral range: 168.06 Mpc
ratio, sensemon/inspiral: 1.04

SNR = 8
sensemon range: 43.78 Mpc
inspiral range: 42.72 Mpc
ratio, sensemon/inspiral: 1.02

SNR = 16
sensemon range: 21.89 Mpc
inspiral range: 21.42 Mpc
ratio, sensemon/inspiral: 1.02

Closes #1614

@codecov
Copy link

codecov bot commented May 3, 2023

Codecov Report

Merging #1615 (055e4e1) into main (eee114f) will increase coverage by 0.0%.
The diff coverage is n/a.

@@          Coverage Diff           @@
##            main   #1615    +/-   ##
======================================
  Coverage   94.2%   94.3%            
======================================
  Files        238     239     +1     
  Lines      18282   18391   +109     
======================================
+ Hits       17232   17343   +111     
+ Misses      1050    1048     -2     
Flag Coverage Δ
Conda 94.1% <ø> (+<0.1%) ⬆️
Linux 94.3% <ø> (+<0.1%) ⬆️
Windows 84.5% <ø> (+0.1%) ⬆️
macOS 93.4% <ø> (-0.1%) ⬇️
python3.10 94.0% <ø> (+<0.1%) ⬆️
python3.11 94.0% <ø> (+<0.1%) ⬆️
python3.7 82.4% <ø> (-11.6%) ⬇️
python3.8 94.0% <ø> (+<0.1%) ⬆️
python3.9 94.0% <ø> (+<0.1%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
gwpy/astro/range.py 98.3% <ø> (ø)

... and 13 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Member

@duncanmmacleod duncanmmacleod left a comment

Choose a reason for hiding this comment

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

Thanks @dethodav, good catch!

I have requested some pedantic formatting changes (unsurprisingly), but would also like to ask that you update pyproject.toml to include the minimum version requirement for inspiral-range. The detection_snr keyword was first added in 0.9.0 [ref].

@dethodav
Copy link
Contributor Author

@duncanmmacleod I just updated this PR - it should be ready for you to look over again

@duncanmmacleod
Copy link
Member

I have requested some pedantic formatting changes (unsurprisingly), but would also like to ask that you update pyproject.toml to include the minimum version requirement for inspiral-range. The detection_snr keyword was first added in 0.9.0 [ref].

@dethodav, sorry for the delay, can you update the package metadata to include the new minimum version requirement?

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.

inspiral_range function bugged when SNR!=8
2 participants