This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def sky_frac(beam_size): | |
""" | |
Calculate which fraction of the sky a beam covers | |
Args: | |
beam_size (float): In square degrees | |
Returns: | |
frac (float): Fraction of the sky that the beam covers | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
import logging.config | |
import os | |
import sys | |
class Log(object): | |
"""Setting default logging styles. Only really helpful when invoking as | |
>>> logger = Log().logger() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def load_T_sky(): | |
""" | |
Read the Haslam sky temperature map into a list from which temperatures can | |
be retrieved. The temperature sky map is given in the weird units of | |
HealPix, and despite looking up info on this coordinate system, I don't | |
have the foggiest idea of how to transform these to galactic coordinates. I | |
have therefore directly copied the following code from psrpoppy in the | |
assumption Sam Bates managed to figure it out. | |
Returns: | |
t_sky_list (list): List of sky temperatures in HealPix? coordinates? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import subprocess | |
template = 'python script.py {} {} {} {}' | |
args = [[1, 2, 3, 4], [5, 6, 7, 8]] | |
# Run commands in parallel | |
processes = [] | |
for arg in args: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import subprocess | |
template = 'python script.py {0} {1} {2} {3} > file_{0}_{1}_{2}_{3}.txt' | |
args = [[1, 2, 3, 4], [5, 6, 7, 8]] | |
# Run commands in parallel | |
processes = [] | |
for arg in args: |
OlderNewer