#finds kappa
def kappa(ll):
    return 0.192*((350.0E-6/ll)**2.0)

def planck(wav, T):
	#physical constants
	h = 6.626e-34
	c = 3.0e+8
	k = 1.38e-23

	aa = 2.0*h*c**2
	bb = h*c/(wav*k*T)
	return aa / ( np.expm1(bb) * (wav**5) )
   
########## control #################
"""
#find all detected galaxies
w_detected = np.where(np.nan_to_num(cat[flux_col]) != 0.0)[0]

#get cols ready
flux = cat[flux_col][w_detected]
z = np.array([redshift]*len(flux), dtype=np.float)
wav = np.array([wav]*len(flux), dtype=np.float)
dist = np.array([distance]*len(flux), dtype=np.float)
temp = np.array([T_dust]*len(flux), dtype=np.float)

#caculated dust mass
mass = flux_to_dust(flux, z, temp, dist, wav)

#create new empty column in table
cat.add_empty_column('DMASS_250', np.float, unit='Log10(Msun)', null='', description='Dust Mass caculated from 250um flux of detected galaxies')