In [129]:
import numpy as np
from pylab import *
%matplotlib inline
import warnings
warnings.filterwarnings('ignore')
from astropy.cosmology import WMAP9 as cosmo

import sys
sys.path.append("/Users/rfinn/Dropbox/pythonCode/")

In [2]:
%run ~/Dropbox/pythonCode/LCSanalyzeblue.py


Running on Rose's mac pro
Running on Rose's mac pro or laptop
Running on Rose's mac pro or laptop
--------------------------------------------------
Date: Tue Aug  1 16:32:05 2006
User: elbaz
Host: 251-198.ipac.caltech.edu
--------------------------------------------------
Format: 9
Architecture: ppc
Operating System: darwin
IDL Version: 6.1
--------------------------------------------------
Successfully read 14 records of which:
 - 10 are of type VARIABLE
 - 1 are of type TIMESTAMP
 - 1 are of type NOTICE
 - 1 are of type VERSION
--------------------------------------------------
Available variables:
 - nulnu_iras25 [<type 'numpy.ndarray'>]
 - nulnuinlsun [<type 'numpy.ndarray'>]
 - nulnu_iras100 [<type 'numpy.ndarray'>]
 - nulnu_iras12 [<type 'numpy.ndarray'>]
 - lir_sanders [<type 'numpy.ndarray'>]
 - nulnu_iras60 [<type 'numpy.ndarray'>]
 - lir [<type 'numpy.ndarray'>]
 - nulnu_lw3 [<type 'numpy.ndarray'>]
 - nulnu_lw2 [<type 'numpy.ndarray'>]
 - lambda [<type 'numpy.ndarray'>]
--------------------------------------------------
%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%

 prefix = 
all
%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%
PREFIX =  all

In [4]:
s.plotsizeBTblue()


Spearman Rank Test:
rho =  -0.41
p-vale = 0.00117 (prob that samples are uncorrelated)
best-fit coefficients for cluster =  [-1.2479106   0.71596978]
Spearman Rank Test:
rho =  -0.48
p-vale = 0.00011 (prob that samples are uncorrelated)
best-fit coefficients for field =  [-1.32943533  0.86664915]

Make plot of WISE flux limits with IR SED

  • flux limits are here

http://wise2.ipac.caltech.edu/docs/release/allwise/expsup/sec2_3a.html

  • using All-Sky 5-$\sigma$ flux limits
  • fluxes are in microJy

  • bandwidth from here

http://wise2.ipac.caltech.edu/docs/release/prelim/expsup/figures/sec4_3gt4.gif


In [417]:
# central wavelengths of W1-W4
w1_wave = 3.4
w2_wave = 4.6
w3_wave = 12.
w4_wave = 22.

# 5sigma flux limits in micro-Jy
w1_5sigma = 68.
w2_5sigma = 111.
w3_5sigma = 860.
w4_5sigma = 5700.

# bandwidth in Hz
w1_bw = 1.7506e13
w2_bw = 1.4653e13
w3_bw = 1.1327e13
w4_bw = 2.4961e12

# nuFnu
w1_nuFnu = w1_5sigma*w1_bw*1.e-6
w2_nuFnu = w2_5sigma*w2_bw*1.e-6
w3_nuFnu = w3_5sigma*w3_bw*1.e-6
w4_nuFnu = w4_5sigma*w4_bw*1.e-6

z= 0.043
lum_w1 = w1_5sigma*1.e-6*1.e-23*3.e8/(w1_wave*1.e-6)*4*pi*(cosmo.luminosity_distance(z).value*3.08e24)**2
lum_w2 = w2_5sigma*1.e-6*1.e-23*3.e8/(w2_wave*1.e-6)*4*pi*(cosmo.luminosity_distance(z).value*3.08e24)**2
lum_w3 = w3_5sigma*1.e-6*1.e-23*3.e8/(w3_wave*1.e-6)*4*pi*(cosmo.luminosity_distance(z).value*3.08e24)**2
lum_w4 = w4_5sigma*1.e-6*1.e-23*3.e8/(w4_wave*1.e-6)*4*pi*(cosmo.luminosity_distance(z).value*3.08e24)**2
lum_wise = np.array([lum_w1,lum_w2,lum_w3,lum_w4],'d')

# create arrays
wise_wave = np.array([w1_wave,w2_wave,w3_wave,w4_wave],'f')
wise_nuFnu_JyHz = np.array([w1_nuFnu,w2_nuFnu,w3_nuFnu,w4_nuFnu],'f')
wise_flux_Jy = np.array([w1_5sigma,w2_5sigma,w3_5sigma,w4_5sigma],'d')*1.e-6

In [418]:
#import daleTemplates as dale
reload(dale)


Out[418]:
<module 'daleTemplates' from '/Users/rfinn/Dropbox/pythonCode/daleTemplates.pyc'>

In [419]:
mod = dale.models()
mod.readDaleSED()
mod.findIndexWavelength(12.,0)
print mod.lam[mod.iwave]


model SED templates
12.0

In [422]:
plt.figure(figsize=(6,4))
plt.subplots_adjust(bottom=.15,left=.15)
#plt.plot(wise_wave,(wise_nuFnu),'kv',markersize=12)
plt.hold('on')
#Luminosity = w4_nuFnu*1.e-23*4*np.pi*(cosmo.luminosity_distance(.01).value*3.08e24)**2
flux_to_lum = 4*np.pi*(cosmo.luminosity_distance(.01).value*3.08e24)**2#*1.e-23

mod.scale_models(lum_w3)
plt.gca().set_yscale('log')
#plt.axis([1,100,6,12])
plt.xlim(1,30)
plt.ylim(1.e40,6.e42)
plt.plot(wise_wave,(lum_wise),'kv',markersize=12)
plt.ylabel(r'$\rm Luminosity \ (erg/s) $')
plt.xlabel(r'$\rm Wavelength \ (\mu m)$')
#plt.legend()
plt.hold('off')
plt.savefig('/Users/rfinn/proposals/NASA2016/WISE_sensitivity.eps')
plt.savefig('/Users/rfinn/proposals/NASA2016/WISE_sensitivity.png')


0 70.6780347292 -28.702
1 71.3516347292 -29.3756
2 71.8725347292 -29.8965
3 72.3867347292 -30.4107
4 72.7595347292 -30.7835

In [299]:
# reality check
# chary & elbaz say that a source with 
# f_nu (24) = 5700 micro-Jy at z=.01
# Lir = 4e8
# SFR = 0.069
f_nu_reference = 5700.
# can we recover something similar with dale models?
print mod.iwave,mod.lam[mod.iwave]
print 'log(fnu) of model at wavelength = ',mod.flux[15][mod.iwave]
print 'sfr = ',mod.sfr[15]
print 'L_TIR = ',mod.Ltir[15]

L_reference = f_nu_reference*w4_bw*1.e-6*1.e-23*4*np.pi*(cosmo.luminosity_distance(.01).value*3.08e24)**2
scale = L_reference / 10.**mod.flux[15][mod.iwave]
print 'scale = ',scale
print 'scaled sfr = ',mod.sfr[15]*scale
print 'scaled L_TIR = ',mod.Ltir[15]*scale/1.e8


121 12.0
log(fnu) of model at wavelength =  -29.3756
sfr =  2.733980642e-69
L_TIR =  1.7251417851e-59
scale =  7.65141304367e+69
scaled sfr =  20.9188151454
scaled L_TIR =  1319.97723567

Comparison with Gabriella and Lizhi's models


In [415]:
%run /Users/rfinn/Dropbox/pythonCode/LCSanalyzeblue.py


%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%

 prefix = 
all
%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%
PREFIX =  all

In [416]:
plt.figure(figsize=(4.5,8))
plt.subplots_adjust(left = 0.2,hspace=0.01)
flag = s.sampleflag & ~s.agnflag #& s.membflag
plt.subplot(2,1,2)
y = s.s.SERSIC_TH50*s.DA
plt.plot(s.logstellarmass[flag],np.log10(y[flag]),'ko')
c1 = np.polyfit(s.logstellarmass[flag],np.log10(y[flag]),1)
xl=np.linspace(8.6,12,100)
plt.hold('on')
plt.plot(xl,np.polyval(c1,xl),'r--')
plt.ylabel(r'$\rm \log_{10} (r_{50}/kpc) \ stars $',fontsize=18)
plt.axis([8.2,12.2,-.6,1.8])
plt.xticks(np.arange(9,13))
plt.xlabel(r'$\rm \log_{10} (M/M_\odot) $',fontsize=18)

plt.subplot(2,1,1)

plt.plot(s.logstellarmass[flag],np.log10(s.Re24_kpc[flag]),'ko')
#flag = s.sampleflag & ~s.agnflag & ~s.membflag
#plt.plot(s.logstellarmass[flag],np.log10(s.Re24_kpc[flag]),'go')
plt.hold('on')
plt.plot(xl,np.polyval(c1,xl),'r--')
plt.ylabel(r'$\rm \log_{10} (r_{50}/kpc) \ SFR({24}) $',fontsize=18)
plt.xticks(np.arange(9,13),[])
plt.axis([8.2,12.2,-.6,1.8])
#plt.show()
#plt.savefig('/Users/rfinn/proposals/NASA2016/size_stellarmass.pdf')
plt.savefig('/Users/rfinn/proposals/NASA2016/size_stellarmass.pdf')



In [375]:
s.s.columns


Out[375]:
ColDefs(
    name = 'NSAID'; format = 'J'
    name = 'IAUNAME'; format = '19A'
    name = 'SUBDIR'; format = '27A'
    name = 'RA'; format = 'E'
    name = 'DEC'; format = 'E'
    name = 'ZDIST'; format = 'E'
    name = 'SERSIC_TH50'; format = 'E'
    name = 'SERSIC_N'; format = 'E'
    name = 'SERSIC_BA'; format = 'E'
    name = 'SERSIC_PHI'; format = 'E'
    name = 'PETROTH50'; format = 'E'
    name = 'PETROTH90'; format = 'E'
    name = 'D4000'; format = 'E'
    name = 'HAEW'; format = 'E'
    name = 'VDISP'; format = 'E'
    name = 'FA'; format = 'E'
    name = 'HAFLUX'; format = 'E'
    name = 'N2FLUX'; format = 'E'
    name = 'HBFLUX'; format = 'E'
    name = 'O3FLUX'; format = 'E'
    name = 'AHDEW'; format = 'E'
    name = 'AV'; format = 'E'
    name = 'ISDSS'; format = 'J'
    name = 'IALFALFA'; format = 'J'
    name = 'NMGY'; format = '7D'
    name = 'NMGY_IVAR'; format = '7D'
    name = 'ABSMAG'; format = '7D'
    name = 'SERSICFLUX'; format = '7D'
    name = 'CLUMPY'; format = '7D'
    name = 'ASYMMETRY'; format = '7D'
    name = 'HIMASS'; format = 'E'
    name = 'AGNKAUFF'; format = 'L'
    name = 'AGNKEWLEY'; format = 'L'
    name = 'AGNSTASIN'; format = 'L'
    name = 'AGCNUMBER'; format = 'E'
    name = 'fmag1'; format = 'E'
    name = 'fmag1err'; format = 'E'
    name = 'fnsersic1'; format = 'E'
    name = 'fnsersic1err'; format = 'E'
    name = 'fre1'; format = 'E'
    name = 'fre1err'; format = 'E'
    name = 'faxisratio1'; format = 'E'
    name = 'faxisratio1err'; format = 'E'
    name = 'fpa1'; format = 'E'
    name = 'fpa1err'; format = 'E'
    name = 'fxc1'; format = 'E'
    name = 'fyc1'; format = 'E'
    name = 'fnumerical_error_flag24'; format = 'L'
    name = 'fchi2nu'; format = 'E'
    name = 'fcmag1'; format = 'E'
    name = 'fcmag1err'; format = 'E'
    name = 'fcnsersic1'; format = 'E'
    name = 'fcnsersic1err'; format = 'E'
    name = 'fcre1'; format = 'E'
    name = 'fcre1err'; format = 'E'
    name = 'fcaxisratio1'; format = 'E'
    name = 'fcaxisratio1err'; format = 'E'
    name = 'fcpa1'; format = 'E'
    name = 'fcpa1err'; format = 'E'
    name = 'fcxc1'; format = 'E'
    name = 'fcyc1'; format = 'E'
    name = 'fcnumerical_error_flag24'; format = 'L'
    name = 'fcchi2nu'; format = 'E'
    name = 'matchflag'; format = 'L'
    name = 'B_T_r'; format = 'E'
    name = 'S2g_1'; format = 'E'
    name = 'p_elliptical'; format = 'E'
    name = 'p_spiral'; format = 'E'
    name = 'p_el'; format = 'E'
    name = 'p_cs'; format = 'E'
    name = 'p_uncertain'; format = 'E'
    name = 'p_mg'; format = 'E'
    name = 'p_edge'; format = 'E'
    name = 'p_dk'; format = 'E'
    name = 'match_flag'; format = 'L'
    name = 'LIR_ZDIST'; format = 'E'
    name = 'SFR_ZDIST'; format = 'E'
    name = 'FLUX24'; format = 'E'
    name = 'FLUX24ERR'; format = 'E'
    name = 'SE_FLUX_AUTO'; format = 'E'
    name = 'LIR_ZCLUST'; format = 'E'
    name = 'SFR_ZCLUST'; format = 'E'
    name = 'MATCHFLAG24'; format = 'E'
    name = 'MIPS_WEIGHT'; format = 'E'
    name = 'SIGMA_NN'; format = 'E'
    name = 'SIGMA_5'; format = 'E'
    name = 'SIGMA_10'; format = 'E'
    name = 'RHOMASS'; format = 'E'
    name = 'STELLARMASS'; format = 'E'
    name = 'SNR_SE'; format = 'E'
    name = 'RMAG'; format = 'E'
    name = 'DELTA_DEC'; format = 'E'
    name = 'DELTA_RA'; format = 'E'
    name = 'DELTA_V'; format = 'E'
    name = 'DR_R200'; format = 'E'
    name = 'CLUSTER_PHI'; format = 'E'
    name = 'HIflag'; format = 'L'
    name = 'HIDef'; format = 'E'
    name = 'NUVr_color'; format = 'E'
    name = 'agnflag'; format = 'L'
    name = 'galfitflag'; format = 'L'
    name = 'CLUSTER_SIGMA'; format = 'E'
    name = 'CLUSTER_REDSHIFT'; format = 'E'
    name = 'CLUSTER_LX'; format = 'E'
    name = 'CLUSTER'; format = '8A'
    name = 'APEXFLUX'; format = 'E'
    name = 'APEXFLUXERR'; format = 'E'
    name = 'APEX_SNR'; format = 'E'
    name = 'W1MAG_3'; format = 'E'
    name = 'W1FLG_3'; format = 'E'
    name = 'W2MAG_3'; format = 'E'
    name = 'W2FLG_3'; format = 'E'
    name = 'W3MAG_3'; format = 'E'
    name = 'W3FLG_3'; format = 'E'
    name = 'W4MAG_3'; format = 'E'
    name = 'W4FLG_3'; format = 'E'
    name = 'FLUX_BEST'; format = 'E'
    name = 'FLUX_AUTO'; format = 'E'
    name = 'PETRO_RADIUS'; format = 'E'
    name = 'FLAGS'; format = 'J'
    name = 'FLUX_RADIUS1'; format = 'E'
    name = 'FLUX_RADIUS2'; format = 'E'
    name = 'MSTAR_AVG'; format = 'E'
    name = 'MSTAR_50'; format = 'E'
    name = 'SFR_AVG'; format = 'E'
    name = 'SFR100_AVG'; format = 'E'
    name = 'SFRAGE'; format = 'E'
    name = 'TAU'; format = 'E'
    name = 'POINTSOURCE'; format = 'L'
    name = 'RE_UPPERLIMIT'; format = 'L'
    name = 'SUPER_RE1'; format = 'E'
    name = 'SUPER_RE1ERR'; format = 'E'
    name = 'SIZE_RATIO'; format = 'E'
    name = 'SIZE_RATIOERR'; format = 'E'
)

In [376]:
s.DA


Out[376]:
array([ 0.45426183,  0.44403655,  0.48135734, ...,  0.46905656,
        0.46905656,  0.46905656])

In [ ]: