LEGWORK
LEGWORK copied to clipboard
Possible incorrect sampling for uniformly distributed sources on the sky in tutorial
Which documentation page is causing an issue?
The Using the Source Class tutorial: https://legwork.readthedocs.io/en/latest/notebooks/Source.html
What is the problem?
The Position-inclination-polarisation specfic sources section: I noticed a potential issue with how sources are sampled on the sky. In this section where you define sources_specific, you aim to place them uniformly on the sky (it seems to at least suggest so):
specific_f_orb = 10**np.random.uniform(-5, -4, len(m_1)) * u.Hz
sources_specific = source.Source(
m_1=m_1, m_2=m_2, f_orb=specific_f_orb, dist=dist,
ecc=np.repeat(0.0, len(m_1)),
position=SkyCoord(
lon=np.random.uniform(0, 2 * np.pi) * u.rad,
lat=np.random.uniform(-np.pi / 2, np.pi / 2) * u.rad,
distance=dist,
frame="heliocentrictrueecliptic"
),
inclination=np.arcsin(np.random.uniform(-1, 1, len(m_1))) * u.rad,
polarisation=np.random.uniform(0, 2 * np.pi, len(m_1)) * u.rad
)
sources_specific.get_snr()
However, I believe that the way latitude and inclination are sampled here does not produce uniform distributions on the sky or sphere.
Suggested solution
Instead, to ensure uniform sampling on a sphere, I suggest using:
lat = (np.arccos(np.random.uniform(-1, 1, len(m_1))) - np.pi / 2) * u.rad
inclination = np.arccos(np.random.uniform(-1, 1, len(m_1))) * u.rad
This correction can also impact results like the SNR ratio plots later in the tutorial.
Please let me know if I’m misunderstanding the intention here, but I thought it might be worth bringing to your attention.