- read_ascii()
- Probably already included in astropy.ascii
- ascii_template()
- Probably already included in astropy.ascii
- ntostr() (from Erin Sheldon's sdsstools)
- It looks like this is just pure Python...
- helcorr.pro
- This will be included in the coordinates subpackage (astropy.coordinates)
- glactc.pro
- This will be included in the coordinates subpackage (astropy.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 os | |
import cPickle as pickle | |
def some_function(another_function, overwrite=False, *args, **kwargs): | |
if overwrite: | |
os.remove("somefilename.pickle") | |
if not os.path.exists("somefilename.pickle"): | |
# analysis / make object | |
object = another_function(*args, **kwargs) |
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 numpy as np | |
import matplotlib.pyplot as plt | |
import scipy.optimize as so | |
def find_confidence_interval(x, pdf, confidence_level): | |
return pdf[pdf > x].sum() - confidence_level | |
def density_contour(xdata, ydata, nbins_x, nbins_y, ax=None, **contour_kwargs): | |
""" Create a density contour plot. |
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
# coding: utf-8 | |
import os | |
import random | |
__author__ = "adrn <[email protected]>" | |
def simple_data_bend(input_file, output_file, grayscale=True): | |
# Open file in binary mode | |
f = open(input_file, "rb") | |
data = f.read() |
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
from astropy.table import Table | |
from astropy.io import ascii | |
IDs = [1, 3, 6, 9, 100] | |
names = ["cat", "bat", "rat", "mat", "gnat"] | |
scores = [83, 51, 77, 81, 92] | |
t = Table([IDs, names, scores], names=["ID", "name", "score"]) | |
ascii.write(t, delimiter=",") |
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
""" | |
- Hotfoot is Columbia's shared Astronomy-Statistics supercomputing | |
cluster. | |
- Emcee is a kick-ass MCMC black-box for sampling probability | |
distributions & parameter estimation. | |
- MPI is a standardized message passing system designed for supporting | |
and running parallel code. | |
Emcee is an implementation of an affine-invariant, ensemble sampler -- | |
key words here being *ensemple sampler*. The algorithm runs an ensemble |
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
""" | |
Make a figure to visualize using MCMC (in particular, the Python package | |
emcee) to infer 4 parameters from a parametrized model of the Milky Way's | |
dark matter halo by using tracer stars from the Sagittarius Stream. | |
If you're unfamiliar with the jargon here (walkers, Sgr, etc.), check out: | |
- Law & Majewski 2010 | |
http://iopscience.iop.org/0004-637X/714/1/229/pdf/apj_714_1_229.pdf | |
- emcee | |
http://dan.iel.fm/emcee/ |
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
# coding: utf-8 | |
""" Create a scatter-plot matrix using Matplotlib. """ | |
from __future__ import division, print_function | |
__author__ = "adrn <[email protected]>" | |
# Standard library | |
import os, sys |
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 numpy as np | |
import matplotlib.pyplot as plt | |
def label_bars(rects): | |
# attach some text labels to the bars | |
for rect in rects: | |
height = rect.get_height() | |
plt.text(rect.get_x()+rect.get_width()/2., | |
height, str(int(height)), | |
ha='center', va='bottom') |
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 astropy.units as u | |
from astropy.coordinates import ICRSCoordinates | |
from streams.coordinates import SgrCoordinates, OrphanCoordinates | |
icrs = ICRSCoordinates(15.34167, 1.53412, unit=(u.hour, u.degree)) | |
sgr = icrs.transform_to(SgrCoordinates) | |
print(sgr.Lambda, sgr.Beta) | |
orp = sgr.transform_to(OrphanCoordinates) | |
print(orp.Lambda, orp.Beta) |
OlderNewer