Skip to content

Instantly share code, notes, and snippets.

View jradavenport's full-sized avatar

James Davenport jradavenport

View GitHub Profile
def mnras_size(fig_width_pt, square=False):
inches_per_pt = 1.0/72.00 # Convert pt to inches
golden_mean = (np.sqrt(5)-1.0)/2.0 # Most aesthetic ratio
fig_width = fig_width_pt*inches_per_pt # Figure width in inches
if square:
fig_height = fig_width
else:
fig_height = fig_width*golden_mean
return [fig_width,fig_height]
@RuthAngus
RuthAngus / Teff_bv_conversion.py
Last active September 28, 2016 21:49
Converting Teff into B-V using the Sekiguchi & Fukugita (2000) relation.
import numpy as np
def teff2bv(teff, logg, feh):
"""
Relation from Sekiguchi & Fukugita (2000).
"""
t = [-813.3175, 684.4585, -189.923, 17.40875]
f = [1.2136, 0.0209]
d1, g1, e1 = -0.294, -1.166, 0.3125
return t[0] + t[1]*np.log10(teff) + t[2]*(np.log10(teff))**2 + \
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jakevdp
jakevdp / README.md
Last active February 20, 2020 22:25
A generator of random Bible-ish verses

Bibleish.py

This is a simple NLTK Python script which uses N-grams to construct phrases from a generative language model trained on the King James Bible.