Note

This tutorial was generated from a Jupyter notebook that can be downloaded here. If you’d like to reproduce the results in the notebook, or make changes to the code, we recommend downloading this notebook and running it with Jupyter as certain cells (mostly those that change plot styles) are excluded from the tutorials.

Demo - Basic SNR Calculation

This demo shows how you can use LEGWORK to compute the SNR of a single binary system, as well as a collection of systems.

[1]:
import legwork as lw
import astropy.units as u

Single source SNR calculation

The most basic use case of LEGWORK is to calculate the signal-to-noise ratio for a single stellar-mass binary system. Let’s create a toy source and calculate its SNR (for a 4-year LISA mission by default).

[3]:
source = lw.source.Source(m_1=10 * u.Msun,
                          m_2=10 * u.Msun,
                          ecc=0.2,
                          f_orb=1e-4 * u.Hz,
                          dist=8 * u.kpc,
                          interpolate_g=False)
source.get_snr().round(2)
[3]:
array([4.49])

That’s it! Behind the scenes LEGWORK has checked whether the source is eccentric/circular and evolving/stationary and picked the fastest possible way to calculate the SNR accurately.

Population of sources SNR calculation

If we want to know the SNR of three (or any number of) sources then you can instead provide arrays for each of the arguments and execute the code in exactly the same way.

[4]:
# supply arrays that are identical to earlier example but different primary masses
sources = lw.source.Source(m_1=[5, 10, 20] * u.Msun,
                           m_2=[10, 10, 10] * u.Msun,
                           ecc=[0.2, 0.2, 0.2],
                           f_orb=[1e-4, 1e-4, 1e-4] * u.Hz,
                           dist=[8, 8, 8] * u.kpc,
                           interpolate_g=False)

sources.get_snr().round(2)
[4]:
array([2.47, 4.49, 7.85])

Change sensitivity curve parameters

If you want to know the SNR of these sources in a different type of detector you can also specify this with sc_params. Let’s repeat the same calculation but now find the SNR in the TianQin detector in a 5-year mission but excluding any confusion noise.

[9]:
# supply arrays that are identical to earlier example but different primary masses
sources = lw.source.Source(m_1=[5, 10, 20] * u.Msun,
                           m_2=[10, 10, 10] * u.Msun,
                           ecc=[0.2, 0.2, 0.2],
                           f_orb=[1e-4, 1e-4, 1e-4] * u.Hz,
                           dist=[8, 8, 8] * u.kpc,
                           interpolate_g=False,
                           sc_params={
                               "instrument": "TianQin",
                               "t_obs": 5 * u.yr,
                               "confusion_noise": None
                           })

sources.get_snr().round(2)
[9]:
array([1.07, 1.95, 3.41])