LEGWORK modules and API reference

`LEGWORK` is composed of 7 different modules, each with a different focus. The diagram below illustrates how each module is connected to the others as well as listing the general purpose of each module. In particular, note that the `source` module provides a simple interface to the functions in all other modules!

The rest of this page contains the API reference for each individual function in every module, feel free to use the table of contents on the left to easily navigate to the function you need.

legwork.evol Module

Functions using equations from Peters and Mathews (1964) to calculate inspiral times and evolve binary parameters.

Functions

 `de_dt`(e, times, beta, c_0) Compute eccentricity time derivative Wrapper that integrates `legwork.evol.de_dt()` with odeint `evol_circ`([t_evol, n_step, timesteps, beta, ...]) Evolve an array of circular binaries for `t_evol` time `evol_ecc`(ecc_i[, t_evol, n_step, timesteps, ...]) Evolve an array of eccentric binaries for `t_evol` time `get_t_merge_circ`([beta, m_1, m_2, a_i, f_orb_i]) Computes the merger time for circular binaries `get_t_merge_ecc`(ecc_i[, a_i, f_orb_i, beta, ...]) Computes the merger time for binaries `t_merge_mandel_fit`(ecc_i) A fit to the Peters 1964 merger time equation (5.14) by Ilya Mandel. `evolve_f_orb_circ`(f_orb_i, m_c, t_evol[, ...]) Evolve orbital frequency for `t_evol` time. `check_mass_freq_input`([beta, m_1, m_2, a_i, ...]) Check that mass and frequency input is valid `create_timesteps_array`(a_i, beta[, ecc_i, ...]) Create an array of timesteps `determine_stationarity`(f_orb_i, t_evol, ecc_i) Determine whether a binary is stationary

Tip

Feeling a bit spun around by all this binary evolution? Check out our tutorial on using functions in the `evol` module here!

legwork.psd Module

Functions to compute various power spectral densities for sensitivity curves

Functions

 `load_response_function`(f[, fstar]) Load in LISA response function from file `approximate_response_function`(f, fstar) Approximate LISA response function `power_spectral_density`(f[, instrument, ...]) Calculates the effective power spectral density for all instruments. `lisa_psd`(f[, t_obs, L, approximate_R, ...]) Calculates the effective LISA power spectral density sensitivity curve `tianqin_psd`(f[, L, t_obs, approximate_R, ...]) Calculates the effective TianQin power spectral density sensitivity curve `get_confusion_noise`(f, model[, t_obs]) Calculate the confusion noise for a particular model `get_confusion_noise_robson19`(f[, t_obs]) Calculate the confusion noise using the model from Robson+19 Eq. `get_confusion_noise_huang20`(f[, t_obs]) Calculate the confusion noise using the model from Huang+20 Table II. Calculate the confusion noise using the model from Thiele+20 Eq.

legwork.snr Module

Functions to calculate signal-to-noise ratio in four different cases

Functions

 `snr_circ_stationary`(m_c, f_orb, dist, t_obs) Computes SNR for circular and stationary sources `snr_ecc_stationary`(m_c, f_orb, ecc, dist, ...) Computes SNR for eccentric and stationary sources `snr_circ_evolving`(m_1, m_2, f_orb_i, dist, ...) Computes SNR for circular and stationary sources `snr_ecc_evolving`(m_1, m_2, f_orb_i, dist, ...) Computes SNR for eccentric and evolving sources.

legwork.source Module

A collection of classes for analysing gravitational wave sources

Classes

 `Source`(m_1, m_2, ecc, dist[, n_proc, f_orb, ...]) Class for generic GW sources `Stationary`(m_1, m_2, ecc, dist[, n_proc, ...]) Subclass for sources that are stationary `Evolving`(m_1, m_2, ecc, dist[, n_proc, ...]) Subclass for sources that are evolving Generate a Source class with the LISA verification binaries preloaded.

Class Inheritance Diagram

Tip

Unable to find the source of your issues? Never fear! Check out our tutorial on using the Source class here!

legwork.strain Module

Computes several types of gravitational wave strains

Functions

 `amplitude_modulation`(position, polarisation, ...) Computes the modulation of the strain due to the orbit averaged response of the detector to the position, polarisation, and inclination of the source using Cornish+03 Eq.42 and Babak+21. `h_0_n`(m_c, f_orb, ecc, n, dist[, position, ...]) Computes strain amplitude `h_c_n`(m_c, f_orb, ecc, n, dist[, position, ...]) Computes characteristic strain amplitude

Tip

Feeling a little strained trying to parse these docs? Check out our tutorial on using functions in the `strain` module here!

legwork.utils Module

A collection of miscellaneous utility functions

Functions

 `chirp_mass`(m_1, m_2) Computes chirp mass of binaries `peters_g`(n, e) Compute g(n, e) from Peters and Mathews (1963) Eq.20 f(e) from Peters and Mathews (1963) Eq.17 `get_a_from_f_orb`(f_orb, m_1, m_2) Converts orbital frequency to semi-major axis `get_f_orb_from_a`(a, m_1, m_2) Converts semi-major axis to orbital frequency `get_a_from_ecc`(ecc, c_0) Convert eccentricity to semi-major axis `beta`(m_1, m_2) Compute beta defined in Peters and Mathews (1964) Eq.5.9 `c_0`(a_i, ecc_i) Computes the c_0 factor in Peters and Mathews (1964) Eq.5.11 `fn_dot`(m_c, f_orb, e, n) Rate of change of nth frequency of a binary `ensure_array`(*args) Convert arguments to numpy arrays `D_plus_squared`(theta, phi) Required for the detector responses , , `D_cross_squared`(theta, phi) Required for the detector responses , , `D_plus_D_cross`(theta, phi) Required for the detector responses , , `F_plus_squared`(theta, phi, psi) Compute the auto-correlated detector response for the plus polarization `F_cross_squared`(theta, phi, psi) Compute the auto-correlated detector response for the cross polarization

legwork.visualisation Module

Functions

 `plot_1D_dist`(x[, weights, disttype, ...]) Plot a 1D distribution of `x`. `plot_2D_dist`(x, y[, weights, disttype, fig, ...]) Plot a 2D distribution of x and y `plot_sensitivity_curve`([frequency_range, ...]) Plot the LISA sensitivity curve `plot_sources_on_sc`(f_dom, snr[, weights, ...]) Overlay stationary sources on the LISA sensitivity curve.

Tip

Not quite sure how things are working vis-à-vis visualisation? Check out our tutorial on using functions in the `visualisation` module here!