Skip to content

Commit

Permalink
Merge pull request #107 from TomWagg/sampling
Browse files Browse the repository at this point in the history
Fix sampling of inclination and polarisation
  • Loading branch information
TomWagg committed Sep 14, 2022
2 parents 13dd273 + ec32b2d commit c39472c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
7 changes: 6 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,4 +153,9 @@ having two when we could just set `f_dom=2 f_orb`
- [Issues [#102](https://github.com/TeamLEGWORK/LEGWORK/issues/102)] Make SNR functions notice when you change confusion noise
- `Source.get_snr()` now takes all `sc_params` as arguments for re-interpolation etc
- `Source.get_snr_stationary` and `Source.get_snr_evolving` have the same parameters added as above
- All functions in `snr` now take `**kwargs` that are passed directly to `psd.power_spectral_density` for maximum flexibility
- All functions in `snr` now take `**kwargs` that are passed directly to `psd.power_spectral_density` for maximum flexibility


## 0.4.4
*TW 14/09/22*
- [Issues [#106](https://github.com/TeamLEGWORK/LEGWORK/issues/106)] Fix sampling of inclination and polarisation when they are not supplied to `Source`
2 changes: 1 addition & 1 deletion legwork/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.4.3"
__version__ = "0.4.4"
6 changes: 4 additions & 2 deletions legwork/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,12 @@ def __init__(self, m_1, m_2, ecc, dist, n_proc=1, f_orb=None, a=None, position=N
else:
if inclination is None:
print("Generating random values for source inclinations")
inclination = np.arcsin(np.random.uniform(-1, 1, len(m_1))) * u.rad
# inclination is sampled uniformly in cos(i) to get a range of [0, pi/2]
inclination = np.arccos(np.random.uniform(0, 1, len(m_1))) * u.rad
if polarisation is None:
print("Generating random values for source polarisations")
polarisation = np.random.uniform(0, 2 * np.pi, len(m_1)) * u.rad
# polarisation is sampled from 0 to pi following Flanagan & Hughes 1998 (e.g. Eq. 2.34)
polarisation = np.random.uniform(0, np.pi, len(m_1)) * u.rad

# ensure position is in the correct coordinate frame
if position is not None:
Expand Down

0 comments on commit c39472c

Please sign in to comment.