Skip to content

Instantly share code, notes, and snippets.

View TomWagg's full-sized avatar

Tom Wagg TomWagg

View GitHub Profile
@TomWagg
TomWagg / create_appendix_d.py
Last active May 17, 2022 18:21
Recreate Appendix D from "Understanding Stellar Evolution" by Henry Lamers and Emily Levesque
import urllib
import pandas as pd
import numpy as np
def create_appendix_d(Zs=[0.014, 0.002], verbose=False,
masses=[0.8, 0.9, 1, 2, 4, 7, 12, 15, 20, 25, 32, 40, 60, 85, 120]):
"""Recreate Appendix D from "Understanding Stellar Evolution" by Henry Lamers and Emily Levesque.
Parameters
----------
Zs : `list`, optional
@TomWagg
TomWagg / fwhm.ipynb
Last active August 8, 2022 23:52
Megan FWHM
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@TomWagg
TomWagg / get_representative_fiducial_binaries.py
Created January 18, 2023 18:29
Quick script to get a representative population of DCOs from my LISA simulations and extract their frequencies/GW amplitudes
import h5py as h5
import numpy as np
import legwork
import astropy.units as u
import pandas as pd
# constants
dco_types = ["BHBH", "BHNS", "NSNS"]
det_rates = [74, 42, 8]
@TomWagg
TomWagg / removed_unused_bibs.py
Created June 11, 2023 18:52
bib reducer: Reduce and combine multiple .bib files to a single file with only *cited* entries
import re
import argparse
def collect_all_bibs(bib_files):
# regex for anything that matches "@[some word]{[something],"
bibtex_key_regex = r"@\w*{.*(?=\,)"
# convert strings to lists in case only one file
if isinstance(bib_files, str):
bib_files = [bib_files]
@TomWagg
TomWagg / J0526+5934_in_LISA.py
Created February 8, 2024 20:13
Calculate LISA SNR and merger time due to GW of J0256+5934
import numpy as np
import astropy.units as u
from astropy.coordinates import SkyCoord
import matplotlib.pyplot as plt
# LEGWORK is a python package that can calculate LISA SNRs - https://legwork.readthedocs.io/
# Citation info at: https://legwork.readthedocs.io/en/latest/cite.html
import legwork as lw
# take 100,000 random samples based on uncertainties