Friday, October 14, 2011

CosmoloPy

Why didn't I know this package existed before?

http://roban.github.com/CosmoloPy/

Functions Include:
  • Various cosmological densities.
  • Various cosmological distance measures.
  • Galaxy luminosity functions (Schechter functions).
  • Conversion in and out of the AB magnitude system.
  • Pre-defined sets of cosmological parameters (e.g. from WMAP).
  • Perturbation theory and the power spectrum.
  • The reionization of the IGM.
Very cool!



Thursday, October 13, 2011

More python plotting tricks

I absolutely love these python plotting page with examples:
http://matplotlib.sourceforge.net/gallery.html
http://www.scipy.org/Cookbook/Matplotlib

Today I figured out how to change the fonts of the legend on my plot, and add a shadow. (Pretty exciting I know.) I've also made the lines a little bit thicker, and different styles (so that it looks pretty in black and white printing of the paper).

Below is the code/plot:

from matplotlib.font_manager import fontManager, FontProperties
font= FontProperties(size=24);

fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(chi, probsqso, 'k-', label = '$\mathrm{QSOs}$', linewidth=2.0)
ax.plot(chi, probsqsow, 'k:', label = '$\mathrm{QSOs\\ Weighted}$', linewidth=2.0)
ax.plot(chi, prob, 'k--', label = '$\mathrm{Gals}$', linewidth=2.0)

ax.set_xlabel("$\\chi$", fontsize=24)
ax.set_ylabel("$\mathrm{Normalized\ }dN/d\\chi$",fontsize=24)
pylab.legend(loc=2,shadow=True,prop=FontProperties(size=18))