Skip to content

Instantly share code, notes, and snippets.

View davidgardenier's full-sized avatar

David Gardenier davidgardenier

View GitHub Profile
@davidgardenier
davidgardenier / sky_frac.py
Created April 20, 2017 12:43
Calculate area/fraction on sky
def test_sky_frac(self):
frac = go.sky_frac(-90, 90, 0, 360)
self.assertTrue(frac > 0.99999999999)
frac = go.sky_frac(0, 90, 0, 360)
self.assertTrue(0.49 < frac < 0.51)
frac = go.sky_frac(0, 90, 0, 90)
self.assertTrue(0.124 < frac < 0.126)
import math
central_freq = 1400 #1374
bw = 350 #288
si = -1.4
dist = 2.682277221706293
lum_bol = 8e44
z = 0.75
f_high = 10e9
f_low = 10e6
@davidgardenier
davidgardenier / setup.py
Created January 20, 2017 13:25
Compiling fortran code
import glob
import os
import subprocess
import sys
assert sys.version_info >= (3, 0), 'Please run with Python3'
def loc(f):
"""Returns full location path to file"""
def lb_to_radec(l, b):
"""
Convert galactic coordinates to RA, Dec
Formulas from 'An Introduction to Modern Astrophysics (2nd Edition)' by
Bradley W. Carroll, Dale A. Ostlie.
Args:
l (float): Galactic longitude [fractional degrees]
b (float): Galactic latitude [fractional degrees]