#program that reads in results from Matt's SED fitter and 
# then creates a unfied dust mass cloumn

import numpy as np  
from os.path import join as pj
from atpy import Table
import matplotlib.pyplot as plt
import pylab as pl

cat = Table("/Users/chrisfuller/Dropbox/phd/herchel/coma/sed-fits/sed-all.fits")

bands = ["F500","F350","F250","F160","F100"]
""" Create detected column """
cat.remove_columns(['DETECTED']) 

""" Loop through cat bands and add number to detected col """

for i in range(len(bands)):
	band = bands[i]

	cat.add_column('D' + band[-3:], [0]*len(cat))

	flux = np.nan_to_num(cat[band])

	w = np.where(flux != 0.0)[0]

	cat['D' + band[-3:]][w] = 1

total = cat.D500 + cat.D350 + cat.D250 + cat.D160 + cat.D100