Redshift binning

Colour variability needs to be binned by redshift, because the variability in each colour can only be over a certain redshift. Explanation:
Take the Civ doublet at ~1550 Ang. In a quasar at z=2.5, the Civ doublet will be redshifted to ~5425 Ang. If this quasar happens to be a BAL, it will have some blueshifted trough extending out as far as 30 000 km/s. (i.e. 0.1 blueshift). If this trough is highly variable, it will be seen between either the u-g or g-r colours. The 5425Ang doublet lands in the middle of the g filter bandpass, and so variability blueward of that will show up in these two different colours.
Therefore it is useful to categorize quasars depending on where their Civ double will land (i.e. by redshift). Refer to the SDSS bandpasses below:

Using the above image I roughly split up the 5 filters:

u: 3000 – 3900
g: 3900 – 5950
r: 5950 – 6800
i: 6800 – 8300
z: 8300 – 10000
and the redshift values for Civ transition then end up being:

u: 0.93 – 1.52
g: 1.52 – 2.84
r: 2.84 – 3.39
i: 3.39 – 4.35
z: 4.35 – 5.45
and therefore the colour redshift ranges are:
u-g: 0.93 – 2.84
g-r: 1.52 – 3.39
r-i: 2.84 – 4.35
i-z: 3.39 – 5.45
It makes sense only to look at the quasars that land in the redshift range from 0.93 – 2.84 in the colour u-g when looking for variability in the Civ trough. Of course, in a different transition there will be different redshift ranges, but Civ is a very common trough. Good first start.
read in the now created BAL and nonBAL lists. (containing MacLeod IDs)
read in the MacLeod DB_QSO_S82.dat (which contains MacLeod IDs AND redshifts)
write to file MacLeod IDs and redshifts.