In [1]:
import ebossspec, fitsio, ebossanalysis
from scipy import stats
In [322]:
reload(ebossspec)
reload(ebossanalysis)
Out[322]:
In [84]:
x = ebossspec.save_feiimgii_composite_binoii(overwrite=True)
In [112]:
x = ebossspec.save_feiimgii_composite_binoii(overwrite=True, bootstrap=True)
In [115]:
oii_composite_bstrap = ebossspec.feiimgii_composite_readin(binoii=True, bootstrap=True)
oii_composite = ebossspec.feiimgii_composite_readin(binoii=True)
In [117]:
oii_composite_bstrap.dtype
Out[117]:
In [108]:
figsize(20,8)
for i in arange(4)+5:
plot(ddd['WAVE'], ddd['LUMFLUXMEDIAN'][:,i])
xlim(2310, 2410)
ylim(0,1.5)
Out[108]:
In [120]:
x = ebossspec.save_feiimgii_composite(overwrite=True)
y = ebossspec.save_feiimgii_composite(bootstrap=True, nbootstrap=500, overwrite=True)
In [24]:
data = ebossspec.feiimgii_composite_readin(bootstrap=True)
In [32]:
flux[:,10].shape
Out[32]:
In [15]:
data.dtype.fields
Out[15]:
In [28]:
wave = data['WAVE']
flux = data['FLUXMEDIAN']
In [30]:
figsize(24, 8)
for i in arange(500):
plot(wave, flux[:,i])
xlim(2550, 2650)
ylim(0.15, 1.8)
Out[30]:
In [201]:
wave_nofluorescent = array([2382.76, 2796.35, 2803.53])
wave_nonresonant = array([2365.55, 2396.36, 2612.65, 2626.45])
#wave_nonresonant = array([2365.55, 2396.36, 2626.45])
wave_yesfluorescent = array([2344.21, 2374.46, 2586.65, 2600.17])
# Symmetric Gaussian profile
xtmp = linspace(-800., 500, num=100)
#ytmp = 1.-stats.norm.pdf((xtmp+50)/150.)*1.3
ytmp = 1.+stats.norm.pdf((xtmp+0)/100.)*0.8
#tmp_wave = wave_yesfluorescent
#tmp_wave = wave_nofluorescent
tmp_wave = wave_nonresonant
fig = figure(figsize=(10,8))
this_ylim = [0.85, 1.6]
ax = fig.add_subplot(111)
xlimits = [-800, 500]
ax.set_ylim(this_ylim)
ax.set_xlim(xlimits)
ax.set_xlabel('Velocity [km/s]', fontsize=20)
ax.set_ylabel(r'Normalized $f(\lambda)$', fontsize=20)
for axis in ['top','bottom','left','right']:
ax.spines[axis].set_linewidth(2.0)
ax.tick_params(axis='both', which='both', length=7, width=2, labelsize=15)
colors = ['blue', 'green', 'red', 'magenta']
offset = [1.8, 1.4, 1.8, 1.0]
for i in arange(tmp_wave.size):
tmpvel = zeros(wave.size)
tmpvel[1:] = (wave[1:]-tmp_wave[i])/wave[1:]*3E5
tmpvel[0] = tmpvel[1]
tmpflux = 1.-(1.-flux)*offset[i]
#ax.plot(tmpvel+69./2., tmpflux, color=colors[i], drawstyle='steps', lw=2)
ax.plot(tmpvel, tmpflux, color=colors[i], lw=3)
ax.plot(xlimits, [1,1], ':k', lw=1)
ax.plot(xtmp, ytmp, 'k--')
ax.plot([0,0], this_ylim, 'k--')
Out[201]:
In [215]:
wave_nofluorescent = array([2382.76, 2796.35, 2803.53])
#wave_nonresonant = array([2365.55, 2396.36, 2612.65, 2626.45])
wave_nonresonant = array([2365.55, 2396.36, 2626.45])
wave_yesfluorescent = array([2344.21, 2374.46, 2586.65, 2600.17, 2382.76])
# Symmetric Gaussian profile
xtmp = linspace(-800., 500, num=100)
ytmp = 1.-stats.norm.pdf((xtmp+40)/135.)*1.4
#ytmp = 1.+stats.norm.pdf((xtmp+0)/100.)*0.85
ytmp_emission = stats.norm.pdf((xtmp+0)/100.)*0.85
tmp_wave = wave_yesfluorescent
#tmp_wave = wave_nofluorescent
#tmp_wave = wave_nonresonant
fig = figure(figsize=(10,8))
this_ylim = [0.15, 1.1]
ax = fig.add_subplot(111)
xlimits = [-1000, 500]
ax.set_ylim(this_ylim)
ax.set_xlim(xlimits)
ax.set_xlabel('Velocity [km/s]', fontsize=20)
ax.set_ylabel(r'Normalized $f(\lambda)$', fontsize=20)
for axis in ['top','bottom','left','right']:
ax.spines[axis].set_linewidth(2.0)
ax.tick_params(axis='both', which='both', length=7, width=2, labelsize=15)
colors = ['blue', 'green', 'red', 'magenta', 'yellow']
#wave_yesfluorescent = array([2344.21, 2374.46, 2586.65, 2600.17])
offset = [1.0, 1.35, 0.9, 0.7, 0.8]
fillin = [0.1, 0., 0.2, 0.4, 0.6]
for i in arange(tmp_wave.size):
tmpvel = zeros(wave.size)
tmpvel[1:] = (wave[1:]-tmp_wave[i])/wave[1:]*3E5
tmpvel[0] = tmpvel[1]
tmpemission = stats.norm.pdf((tmpvel+0)/100.)*fillin[i]
tmpflux = 1.-(1.-flux)*offset[i]
#ax.plot(tmpvel+69./2., tmpflux, color=colors[i], drawstyle='steps', lw=2)
#ax.plot(tmpvel, tmpflux, color=colors[i], lw=3)
#if i==2 or i==4: ax.plot(tmpvel, tmpflux, color=colors[i], lw=3)
ax.plot(tmpvel, tmpflux-tmpemission, color=colors[i], lw=3)
ax.plot(xlimits, [1,1], ':k', lw=1)
ax.plot(xtmp, ytmp, 'k--')
#ax.plot([-50,-50], this_ylim, 'k--')
Out[215]:
In [213]:
wave_nofluorescent = array([2382.76, 2796.35, 2803.53])
#wave_nonresonant = array([2365.55, 2396.36, 2612.65, 2626.45])
wave_nonresonant = array([2365.55, 2396.36, 2626.45])
wave_yesfluorescent = array([2344.21, 2374.46, 2586.65, 2600.17, 2382.76])
# Symmetric Gaussian profile
xtmp = linspace(-800., 500, num=100)
ytmp = 1.-stats.norm.pdf((xtmp+50)/150.)*1.3
#ytmp = 1.+stats.norm.pdf((xtmp+0)/100.)*0.8
tmp_wave = wave_yesfluorescent
#tmp_wave = wave_nofluorescent
#tmp_wave = wave_nonresonant
fig = figure(figsize=(10,8))
this_ylim = [0.4, 1.1]
ax = fig.add_subplot(111)
xlimits = [-800, 500]
ax.set_ylim(this_ylim)
ax.set_xlim(xlimits)
ax.set_xlabel('Velocity [km/s]', fontsize=20)
ax.set_ylabel(r'Normalized $f(\lambda)$', fontsize=20)
for axis in ['top','bottom','left','right']:
ax.spines[axis].set_linewidth(2.0)
ax.tick_params(axis='both', which='both', length=7, width=2, labelsize=15)
colors = ['blue', 'green', 'red', 'magenta', 'yellow']
#wave_yesfluorescent = array([2344.21, 2374.46, 2586.65, 2600.17])
offset = [1.0, 1.35, 0.9, 0.7, 0.8]
fillin = [0.1, 0., 0.2, 0.4, 0.6]
for i in arange(tmp_wave.size):
tmpvel = zeros(wave.size)
tmpvel[1:] = (wave[1:]-tmp_wave[i])/wave[1:]*3E5
tmpvel[0] = tmpvel[1]
tmpemission = stats.norm.pdf((tmpvel+0)/100.)*fillin[i]
tmpflux = 1.-(1.-flux)*offset[i]
#ax.plot(tmpvel+69./2., tmpflux, color=colors[i], drawstyle='steps', lw=2)
ax.plot(tmpvel, tmpflux, color=colors[i], lw=3)
#if i==2 or i==4: ax.plot(tmpvel, tmpflux, color=colors[i], lw=3)
#ax.plot(tmpvel, tmpflux-tmpemission, color=colors[i], lw=3)
ax.plot(xlimits, [1,1], ':k', lw=1)
#ax.plot(xtmp, ytmp, 'k--')
#ax.plot([-50,-50], this_ylim, 'k--')
Out[213]:
In [199]:
#wave_nofluorescent = array([2382.76, 2796.35, 2803.53])
wave_nofluorescent = array([2382.76, 2796.35, 2803.53])
#wave_nonresonant = array([2365.55, 2396.36, 2612.65, 2626.45])
wave_nonresonant = array([2365.55, 2396.36, 2626.45])
wave_yesfluorescent = array([2344.21, 2374.46, 2586.65, 2600.17])
# Symmetric Gaussian profile
xtmp = linspace(-800., 500, num=100)
ytmp = 1.-stats.norm.pdf((xtmp+50)/150.)*1.3
#ytmp = 1.+stats.norm.pdf((xtmp+0)/100.)*0.8
#tmp_wave = wave_yesfluorescent
tmp_wave = wave_nofluorescent
#tmp_wave = wave_nonresonant
fig = figure(figsize=(10,8))
this_ylim = [0.15, 1.1]
ax = fig.add_subplot(111)
xlimits = [-800, 500]
ax.set_ylim(this_ylim)
ax.set_xlim(xlimits)
ax.set_xlabel('Velocity [km/s]', fontsize=20)
ax.set_ylabel(r'Normalized $f(\lambda)$', fontsize=20)
for axis in ['top','bottom','left','right']:
ax.spines[axis].set_linewidth(2.0)
ax.tick_params(axis='both', which='both', length=7, width=2, labelsize=15)
colors = ['yellow', 'green', 'red', 'magenta']
#wave_nofluorescent = array([2382.76, 2796.35, 2803.53])
offset = [0.8, 0.6, 0.55, 0.9]
fillin = [0.6, 0.95, 0.85]
for i in arange(tmp_wave.size):
tmpvel = zeros(wave.size)
tmpvel[1:] = (wave[1:]-tmp_wave[i])/wave[1:]*3E5
tmpvel[0] = tmpvel[1]
tmpemission = stats.norm.pdf((tmpvel+0)/100.)*fillin[i]
tmpflux = 1.-(1.-flux)*offset[i]
#ax.plot(tmpvel+69./2., tmpflux, color=colors[i], drawstyle='steps', lw=2)
ax.plot(tmpvel, tmpflux, color=colors[i], lw=3)
ax.plot(tmpvel, tmpflux-tmpemission, '--', color=colors[i], lw=3)
ax.plot(xlimits, [1,1], ':k', lw=1)
#ax.plot(xtmp, ytmp, 'k--')
In [51]:
ebossanalysis.do_velspace_flux(overwrite=True, bootstrap=True)
Out[51]:
In [208]:
ebossanalysis.do_velspace_flux(overwrite=True, binoii=True, bootstrap=False)
Out[208]:
In [209]:
(ewvelflux, lumvelflux) = ebossanalysis.velspace_flux_readin(binoii=True)
(ewvelflux_bstrap, lumvelflux_bstrap) = ebossanalysis.velspace_flux_readin(binoii=True, bootstrap=True)
In [213]:
print ewvelflux.size
print ewvelflux_bstrap['FLUX'].shape
print ewvelflux[0]['LINES']
In [290]:
figsize(24, 8)
#for i in arange(3)+2:
# for j in arange(20):
# plot(ewvelflux['VEL'], ewvelflux_bstrap['FLUX'][i][0,:,j])
#for i in [9,10,11,12,13]:
CM = get_cmap('jet')
for i, ioii in enumerate([2,3,4]):
#for i, ioii in enumerate([5,6,7,8]):
#for i, ioii in enumerate([9,10,11,12,13]):
color = CM(i/4.+0.0)
plot(ewvelflux[ioii]['VEL'], lumvelflux[ioii]['FLUX'][0,:], color=color, lw=3)
xlim(-1400, 1000)
ylim(0.15, 1.8)
plot([-4000,4000],[1,1])
Out[290]:
In [323]:
ebossanalysis.unify_absorptionline_profile(bootstrap=True, overwrite=True)
Out[323]:
In [190]:
ebossanalysis.unify_emissionline_profile(bootstrap=True, overwrite=True)
Out[190]:
In [307]:
reload(ebossanalysis)
Out[307]:
In [302]:
ebossanalysis.unify_emissionline_profile_binoii(overwrite=True)
Out[302]:
In [325]:
ebossanalysis.unify_absorptionline_profile_binoii(bootstrap=True, overwrite=True)
Out[325]:
In [308]:
ew_emission, lum_emission = ebossanalysis.unify_emissionline_profile_readin(bootstrap=False, binoii=True)
ew_absorption, lum_absorption = ebossanalysis.unify_absorptionline_profile_readin(bootstrap=False, binoii=True)
In [314]:
lum_absorption.dtype
Out[314]:
In [313]:
figsize(24, 8)
CM = get_cmap('jet')
for i, ioii in enumerate([2,3,4]):
#for i, ioii in enumerate([6,8]):
#for i, ioii in enumerate([10,11,12,13]):
color = CM(i/4.+0.0)
#plot(ew_emission[ioii]['VEL'], ew_emission[ioii]['UNIFIEDFLUX'][:], color=color, lw=3)
plot(ew_absorption[ioii]['VEL'], ew_absorption[ioii]['UNIFIEDABSORPTION'][:], color=color, lw=3)
xlim(-1000, 1000)
ylim(0.85, 1.3)
ylim(0.65, 1.1)
plot([-1000,1000], [1,1], lw=6)
#fill_between(vel, 1.+emission['UNIFIEDDISP'], 1.-emission['UNIFIEDDISP'])
Out[313]:
In [86]:
xx = np.std(emission['UNIFIEDFLUX'], axis=1)
In [87]:
xx.shape
Out[87]:
In [194]:
print median(emission['UNIFIEDDISP'])
print median(absorption_bstrap['UNIFIEDABSORPTION_DISP'])
In [188]:
plot(vel, absorption_bstrap['UNIFIEDABSORPTION_DISP'])
Out[188]:
In [176]:
In [198]:
absorption = ebossanalysis.unify_absorptionline_profile_readin()
In [199]:
absorption.dtype
Out[199]:
In [127]:
ebossanalysis.unify_absorptionline_profile(overwrite=True, bootstrap=True)
Out[127]:
In [184]:
absorption_bstrap = ebossanalysis.unify_absorptionline_profile_readin(bootstrap=True)
In [185]:
absorption_bstrap.dtype
Out[185]:
In [187]:
figsize(24, 8)
for i in arange(100):
plot(vel, absorption_bstrap['UNIFIEDABSORPTION'][:,i])
#plot(vel, emission['FLUX'][3,:,i])
xlim(-1000, 600)
ylim(0.75, 1.1)
plot([-1000,1000], [1,1], lw=6)
fill_between(vel, 1.+absorption_bstrap['UNIFIEDABSORPTION_DISP'], 1.-absorption_bstrap['UNIFIEDABSORPTION_DISP'])
Out[187]:
In [209]:
corrected_bstrap = ebossanalysis.corrected_velspace_flux_readin(bootstrap=True)
In [210]:
corrected_bstrap.dtype
Out[210]:
In [29]:
ebossspec.value_add_elg(overwrite=True)
In [30]:
objs_ori = ebossspec.elg_readin()
oii = (ebossspec.elg_readin(vac=True))[0]
galaxytype = objs_ori['CLASS']
zgood = objs_ori['zGOOD']
oiilum = oii['OIILUM']
oii_ew = oii['OIIEW']
z = objs_ori['Z']
inuv = (where(logical_and(logical_and(logical_and(zgood,
oii['Z']>0.6), oii['Z']<1.2), galaxytype=='GALAXY')))[0]
In [31]:
nonzero(isfinite(log10(oiilum[inuv])))
Out[31]:
In [329]:
fig = figure(figsize=(9,7))
ax = fig.add_subplot(111)
n, bins, patches = ax.hist(oii_ew[inuv],
bins=arange(0, 200, 5), edgecolor='black')
this_ylim = [0, 800]
ax.set_ylim(this_ylim)
#ax.set_xscale('log')
#ax.set_xlim(3680, 3780)
ax.set_title(r'[OII] EW Distribution', fontsize=20)
ax.set_xlabel(r'$W_{\rm O\,II}^{\lambda3727}$ [$\AA$]', fontsize=20)
ax.set_ylabel(r'$\Delta$ N ($\Delta W_{\rm O\,II}^{\lambda3727}$ = 5 $\AA$)', fontsize=20)
fig.savefig('/Users/Benjamin/Dropbox/Zhu_Projects/Fine Structure Emission/Version 1/EW_distribution.eps')
# Luminosity
fig = figure(figsize=(9,7))
ax = fig.add_subplot(111)
n, bins, patches = ax.hist(log10(oiilum[inuv]),
bins=arange(40., 43.5, 0.1), edgecolor='black')
this_ylim = [0, 1100]
ax.set_ylim(this_ylim)
#ax.set_xscale('log')
#ax.set_xlim(3680, 3780)
ax.set_title(r'[OII] Luminosity Distribution', fontsize=20)
ax.set_xlabel(r'$\log_{10}\,L_{\rm O\,II}^{\lambda3727}$ [${\rm erg\,s}^{-1}$]', fontsize=20)
ax.set_ylabel(r'$\Delta$ N ($\Delta \log_{10}\,L_{\rm O\,II}^{\lambda3727}$ = 0.1 dex)', fontsize=20)
fig.savefig('/Users/Benjamin/Dropbox/Zhu_Projects/Fine Structure Emission/Version 1/Lum_distribution.eps')
In [50]:
median(log10(oiilum[inuv]))
Out[50]:
In [53]:
median(log10(oiilum[inuv[log10(oiilum[inuv])>42.]]))
Out[53]:
In [60]:
oiiewmin, oiiewmax, oiiewbin, oiilummin, oiilummax, oiilumbin = ebossspec.oiiewbins()
In [326]:
median(oii_ew[inuv])
Out[326]:
In [66]:
oiiewmin.shape
Out[66]:
In [73]:
newshape = oiiewmin.shape+(14,)+(3,)
In [74]:
newshape
Out[74]:
In [75]:
xxxx = zeros(newshape)
In [76]:
xxxx[:,0] = 3.4
In [260]:
infile = '/Users/Benjamin/AstroData/Absorbers/Absorbers_Composite_Allabs_0.8AA.fits'
outfile = infile.replace('.fits', '_REW.fits')
In [261]:
print infile, outfile
In [295]:
reload(ebossanalysis)
Out[295]:
In [281]:
ebossanalysis.absorber_measure()
In [282]:
xxx = ebossanalysis.stack_absorber_readin(rew=True)
In [283]:
xxx['TFLUX']
Out[283]:
In [273]:
xxx['LINES']
Out[273]:
In [294]:
ebossanalysis.unify_absorptionline_profile_binoii(overwrite=True)
In [ ]: