Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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.coordinates import ICRS, Galactic, Distance, Angle | |
from astropy import units as u | |
import math as mt | |
import numpy as np | |
from astropy.table import Table, Column | |
# inspired by | |
#http://idl-moustakas.googlecode.com/svn-history/r560/trunk/impro/hiiregions/im_hiiregion_deproject.pro | |
def correct_rgc(coord, glx_ctr=ICRS('00h42m44.33s +41d16m07.5s'), glx_PA=Angle('37d42m54s'), glx_incl=Angle('77.5d'), glx_dist=Distance(783,unit=u.kpc)): | |
'''computes deprojected galactocentric distance for an object at coord, |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 | |
from astropy.table import Table, Column | |
def transpose_table(tab_before, id_col_name='ID'): | |
'''Returns a copy of tab_before (an astropy.Table) with rows and columns interchanged | |
id_col_name: name for optional ID column corresponding to | |
the column names of tab_before''' | |
# contents of the first column of the old table provide column names for the new table | |
# TBD: check for duplicates in new_colnames & resolve | |
new_colnames=tuple(tab_before[tab_before.colnames[0]]) |
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
""" | |
show_student_pix: | |
Uses a Western University class list file (typically named .rcl | |
but really .csv) and the accompanying set of jpg student ID | |
pictures to display a few random pictures/names at a time. | |
Designed for use in IPython notebook. | |
2014-08-28, P. Barmby |
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, Column, join, vstack | |
from uncertainties import ufloat | |
import astropy.units as u | |
def uncert_str(tab_row, col_name, value_fmt): | |
''' format tab_row[col_name] single table row in LaTeX $num \pm unc$ format | |
input: tab_row: single row from an astropy table | |
col_name: name of column to be extracted and formatted | |
value_fmt: format for string output | |
output: |
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 | |
from matplotlib import cm | |
from matplotlib.ticker import NullFormatter | |
# based on http://www.astrobetter.com/blog/2014/02/10/visualization-fun-with-python-2d-histogram-with-1d-histograms-on-axes/ | |
def fancy_2d_plot(xvals, yvals): | |
'''makes a histogran with sidecars: | |
2D histogram shown as an image in center, with | |
1D histograms corresponding to the 2 axes along each side |
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 astropy.wcs as wcs | |
import astropy.io.fits as fits | |
import matplotlib.pyplot as plt | |
from matplotlib import cm | |
import scipy.stats as sps | |
from astropy.table import Table, Column, vstack | |
from astropy.coordinates import SkyCoord, Distance, Angle | |
from astropy import units as u | |
from matplotlib.ticker import NullFormatter |
OlderNewer