Your homework is to create a module containing a Cosmology() class, which computes some quantities using expressions from the Hogg 1999 Distance Measures paper. We took a brief look at this problem in the boot camp at the beginning of the quarter (Lecture 8).

This will be a simple example of test-driven development, a development style in which the desired functionality is first written as a series of tests, and then code is written which passes those tests.

You'll be creating a cosmology package, adding some simple cosmological distance measures, and testing and documenting the code. In your homework git repository, create the following directory structure:

HW8/ | cosmology/ | | __init__.py | | cosmology.py | | tests/ | | | __init__.py | | | test_cosmology.py

The files should contain the following:

"""Cosmology tools <add more description here> """ # We'll import the Cosmology class using # a "relative import": from .cosmology import Cosmology

"""Cosmology Tests""" # Nothing else here

(see below -- you'll be modifying this file)

(see below)

Your task is to fill-in the class and method definitions in cosmology.py using the formulae from the Hogg paper. Once this is all set up, you should be able to run IPython from within the HW8 directory and type, e.g.

In [1]: from cosmology import Cosmology In [2]: cosmo = Cosmology() In [3]: cosmo.DC(0) Out[3]: 0.0