In [1]:
import numpy as np
import matplotlib.pyplot as plt

In [2]:
from scipy import stats
import speclines
import ebossspec, ebossanalysis

In [3]:
data = ebossanalysis.unify_emissionline_profile_readin()
emission_bstrap = ebossanalysis.unify_emissionline_profile_readin(bootstrap=True)
absorption = ebossanalysis.unify_absorptionline_profile_readin()
absorption_bstrap = ebossanalysis.unify_absorptionline_profile_readin(bootstrap=True)
corrected = ebossanalysis.corrected_velspace_flux_readin()
corrected_bstrap = ebossanalysis.corrected_velspace_flux_readin(bootstrap=True)
velmeasure = ebossanalysis.do_velocity_nonparametric()
velmeasure_bstrap = ebossanalysis.do_velocity_nonparametric(bootstrap=True)

In [4]:
rew_absorber = ebossanalysis.stack_absorber_readin(rew=True)
rew_absorber_weakest = ebossanalysis.stack_absorber_readin(rew=True, mgiirewmin=0.4, mgiirewmax=0.8)
rew_absorber_weaker = ebossanalysis.stack_absorber_readin(rew=True, mgiirewmin=0.8, mgiirewmax=1.2)
rew_absorber_stronger = ebossanalysis.stack_absorber_readin(rew=True, mgiirewmin=3.0, mgiirewmax=8.0)
rew_absorber_strongest = ebossanalysis.stack_absorber_readin(rew=True, mgiirewmin=4.0, mgiirewmax=8.0)
(ewvelflux, lumvelflux) = ebossanalysis.velspace_flux_readin(binoii=True)
(ewvelflux_bstrap, lumvelflux_bstrap) = ebossanalysis.velspace_flux_readin(binoii=True, bootstrap=True)
(ew_corrected, lum_correcte) = ebossanalysis.corrected_velspace_flux_readin(binoii=True)
(ew_corrected_bstrap, lum_corrected_bstrap) = ebossanalysis.corrected_velspace_flux_readin(bootstrap=True, binoii=True)
(ew_velmeasure, lum_velmeasure) = ebossanalysis.do_velocity_nonparametric_binoii()
(ew_velmeasure_bstrap, lum_velmeasure_bstrap) = ebossanalysis.do_velocity_nonparametric_binoii(bootstrap=True)
rew_starburst = ebossanalysis.starburst_measure_readin()
oiii_vel = ebossanalysis.oiii_velspace_flux_readin()


This interpolation has some issues... Set to -9999.
This interpolation has some issues... Set to -9999.
This interpolation has some issues... Set to -9999.
This interpolation has some issues... Set to -9999.
This interpolation has some issues... Set to -9999.
This interpolation has some issues... Set to -9999.
This interpolation has some issues... Set to -9999.
This interpolation has some issues... Set to -9999.
This interpolation has some issues... Set to -9999.
This interpolation has some issues... Set to -9999.
This interpolation has some issues... Set to -9999.
This interpolation has some issues... Set to -9999.
This interpolation has some issues... Set to -9999.
This interpolation has some issues... Set to -9999.
This interpolation has some issues... Set to -9999.
This interpolation has some issues... Set to -9999.
This interpolation has some issues... Set to -9999.
This interpolation has some issues... Set to -9999.
This interpolation has some issues... Set to -9999.
This interpolation has some issues... Set to -9999.
This interpolation has some issues... Set to -9999.
This interpolation has some issues... Set to -9999.
This interpolation has some issues... Set to -9999.
This interpolation has some issues... Set to -9999.
This interpolation has some issues... Set to -9999.
This interpolation has some issues... Set to -9999.
This interpolation has some issues... Set to -9999.
This interpolation has some issues... Set to -9999.
This interpolation has some issues... Set to -9999.
This interpolation has some issues... Set to -9999.
This interpolation has some issues... Set to -9999.
This interpolation has some issues... Set to -9999.
This interpolation has some issues... Set to -9999.
This interpolation has some issues... Set to -9999.
This interpolation has some issues... Set to -9999.
This interpolation has some issues... Set to -9999.
This interpolation has some issues... Set to -9999.
This interpolation has some issues... Set to -9999.
This interpolation has some issues... Set to -9999.
This interpolation has some issues... Set to -9999.
This interpolation has some issues... Set to -9999.
This interpolation has some issues... Set to -9999.
This interpolation has some issues... Set to -9999.
This interpolation has some issues... Set to -9999.
This interpolation has some issues... Set to -9999.
This interpolation has some issues... Set to -9999.
This interpolation has some issues... Set to -9999.
This interpolation has some issues... Set to -9999.
This interpolation has some issues... Set to -9999.
This interpolation has some issues... Set to -9999.
This interpolation has some issues... Set to -9999.
This interpolation has some issues... Set to -9999.
This interpolation has some issues... Set to -9999.

In [7]:
velmeasure.dtype


Out[7]:
dtype([('LINES', '<f8', (8,)), ('PERCENT', '<f8', (17,)), ('FLUX_PERCENT', '<f8', (17, 8)), ('FABS_PERCENT', '<f8', (17, 8)), ('UNIFIEDPERCENT', '<f8', (17,)), ('TFLUX', '<f8', (8,)), ('TFABS', '<f8', (8,))])

In [8]:
#bootstrap errors
#emission_error = np.std(emission_bstrap['UNIFIEDFLUX'], axis=1)
#absorption_error = np.std(absorption_bstrap['UNIFIEDABSORPTION'], axis=1)
#bootstrap errors
emission_error = emission_bstrap['UNIFIEDDISP']
absorption_error = absorption_bstrap['UNIFIEDABSORPTION_DISP']
vpercent_lines_error = np.std(velmeasure_bstrap['FLUX_PERCENT'], axis=2)
vpercent_error = np.std(velmeasure_bstrap['UNIFIEDPERCENT'], axis=1)

In [9]:
fig, axes = plt.subplots(figsize=(12,12), ncols=1, nrows=3)
axesall = axes.ravel()
fig.subplots_adjust(hspace=0, top=0.90, bottom=0.10)
xlimits = [-800,600]
ylimits = [0.9, 1.45]
ylimits1 = [0.9, 1.35]

#use_indices = data['INDEX']
use_indices = ([0,2,1,3])[::-1]
lines = data['LINES']
vel = data['VEL']
line_names = ['2366', '2396', '2613', '2626']
CM = plt.get_cmap('jet')
line_colors = [CM(fcolor) for fcolor in ((np.arange(4)+0.)/6.)]

for i, ax in enumerate(axesall):
    ax.tick_params(axis='x', which='major', length=8, width=2, labelsize=22, pad=8)
    ax.tick_params(axis='x', which='minor', length=4, width=2, labelsize=22, pad=8)
    ax.tick_params(axis='y', which='major', length=6, width=2, labelsize=20, pad=8)
    ax.tick_params(axis='y', which='minor', length=3, width=2, labelsize=20, pad=8)
    ax.set_xlim(xlimits) 
    ax.plot(xlimits, [1,1], ':', color='gray', lw=2)
    for axis in ['top','bottom','left','right']:
        ax.spines[axis].set_linewidth(2.2)

# Top panel:
ax = axesall[0]
for i,index in enumerate(use_indices):
    ax.plot(vel, data['FLUX'][index, :], color=line_colors[i], lw=4)
    ax.text(-580, 1.35-i*0.05, line_names[index], color=line_colors[i], fontsize=25)
ax.text(-755, 1.35, r'Fe II*$\,\lambda$', color=line_colors[0], fontsize=25)
#ax.text(-750, 1.35, 'Fe II', color=line_colors[0], fontsize=22)
ax.plot([0,0], ylimits, ':', color='gray', lw=2)
plt.setp(ax.get_xticklabels(), visible=False)
#ax.xaxis.tick_top()
#ax.set_xlabel('Velocity (km/s)', fontsize=22)
#ax.set_ylabel('Flux (normalized)', fontsize=22)
ax.text(200, 1.35, 'Observed Profile', fontsize=22)
ax.set_ylim(ylimits)
    
# Middle panel
ax = axesall[1]
for i, index in enumerate(use_indices):
    ax.plot(vel, data['NORMFLUX'][index, :], color=line_colors[i], lw=4)
#ax.plot(vel, data['UNIFIEDFLUX'], color='black', lw=4)
ax.plot([0,0], ylimits, ':', color='gray', lw=2)
plt.setp(ax.get_xticklabels(), visible=False)
ax.set_ylabel(r'Normalized flux $\left<R(\lambda)\right>$', fontsize=24)
ax.text(200, 1.25, 'Normalized Profile', fontsize=22)
ax.set_ylim(ylimits1)
    
# Bottom panel
ax = axesall[2]
#ax.fill_between(vel, data['UNIFIEDFLUX']-emission_error*2., data['UNIFIEDFLUX']+emission_error*2., color='SkyBlue')
#ax.fill_between(vel, data['UNIFIEDFLUX']-0.02, data['UNIFIEDFLUX']+0.02, color='RoyalBlue')
ax.fill_between(vel, data['UNIFIEDFLUX']-emission_error, data['UNIFIEDFLUX']+emission_error, color='DeepSkyBlue')
ax.plot(vel, data['UNIFIEDFLUX'], color='Blue', lw=4)
ax.plot([0,0], ylimits1, ':', color='gray', lw=2)
ax.text(200, 1.25, 'Unified Profile', fontsize=22)
ax.set_xlabel(r'Velocity [km$\,$s$^{-1}$]', fontsize=24)
#ax.set_ylabel('Flux (normalized)', fontsize=22)
ax.set_ylim(ylimits1)
#fig.savefig('/Users/Benjamin/Dropbox/Zhu_Projects/Fine Structure Emission/Version 1/Unified_Emission_Profile.eps')


Out[9]:
(0.9, 1.35)

In [10]:
noffset = 100
fig, axes = plt.subplots(figsize=(10,9), ncols=1, nrows=2)
axesall = axes.ravel()
fig.subplots_adjust(hspace=0, top=0.90, bottom=0.11)
xlimits = [-800,600]
ylimits = [0.9, 1.45]
ylimits1 = [0.88, 1.35]
ylimits2 = [0.95, 1.11]

for i, ax in enumerate(axesall):
    ax.tick_params(axis='x', which='major', length=8, width=2, labelsize=22, pad=8)
    ax.tick_params(axis='x', which='minor', length=4, width=2, labelsize=22, pad=8)
    ax.tick_params(axis='y', which='major', length=6, width=2, labelsize=20, pad=8)
    ax.tick_params(axis='y', which='minor', length=3, width=2, labelsize=20, pad=8)
    ax.set_xlim(xlimits) 
    ax.plot(xlimits, [1,1], ':', color='gray', lw=2)
    if i == 0: ax.plot([0,0],ylimits1,':', color='black', lw=2)
    if i == 1: ax.plot([0,0],ylimits2,':', color='black', lw=2)
    for axis in ['top','bottom','left','right']:
        ax.spines[axis].set_linewidth(2.2)
    
# Top panel
ax = axesall[0]
#ax.fill_between(vel, data['UNIFIEDFLUX']-emission_error*2., data['UNIFIEDFLUX']+emission_error*2., color='SkyBlue')
ax.fill_between(vel, data['UNIFIEDFLUX']-emission_error, data['UNIFIEDFLUX']+emission_error, color='DeepSkyBlue')
ax.plot(vel, data['UNIFIEDFLUX'], color='Blue', lw=4)
# Blue side
#ax.fill_between(vel[:noffset+1], data['UNIFIEDFLUX'][:noffset+1]-0.04, data['UNIFIEDFLUX'][:noffset+1]+0.04, color='SkyBlue')
#ax.fill_between(vel[:noffset+1], data['UNIFIEDFLUX'][:noffset+1]-0.02, data['UNIFIEDFLUX'][:noffset+1]+0.02, color='RoyalBlue')
#ax.plot(vel[:noffset+1], data['UNIFIEDFLUX'][:noffset+1], color='DarkBlue', lw=4)
# Red side
#ax.fill_between(vel[noffset:], data['UNIFIEDFLUX'][noffset:]-0.04, data['UNIFIEDFLUX'][noffset:]+0.04, color='LightSalmon')
#ax.fill_between(vel[noffset:], data['UNIFIEDFLUX'][noffset:]-0.02, data['UNIFIEDFLUX'][noffset:]+0.02, color='LightCoral')
#ax.plot(vel[noffset:], data['UNIFIEDFLUX'][noffset:], color='Maroon', lw=4)
# Red side flipped
#ax.fill_between(vel[noffset-20:noffset+1], data['UNIFIEDFLUX'][noffset+20:noffset-1:-1]-0.04, 
#                data['UNIFIEDFLUX'][noffset+20:noffset-1:-1]+0.04, color='LightSalmon')
#ax.fill_between(vel[noffset-20:noffset+1], data['UNIFIEDFLUX'][noffset+20:noffset-1:-1]-0.02, 
#                data['UNIFIEDFLUX'][noffset+20:noffset-1:-1]+0.02, color='LightCoral')
ax.plot(vel[noffset-20:noffset+1], data['UNIFIEDFLUX'][noffset+20:noffset-1:-1], '--', color='Red', lw=4)
ax.plot(vel[noffset:], data['UNIFIEDFLUX'][noffset:], '--', color='Red', lw=4)

ax.text(-750, 1.28, 'Unified Profile', color='Blue', fontsize=22)
ax.text(-750, 1.22, 'Symmetric Profile', color='red', fontsize=22)
ax.text(-750, 1.18, r'assuming $f(v<0)=f(|v|)$', color='red', fontsize=22)
#ax.set_xlabel('Velocity (km/s)', fontsize=22)
#ax.xaxis.tick_top()
plt.setp(ax.get_xticklabels(), visible=False)
ax.set_ylim(ylimits1)

ax = axesall[1]
xx = vel[noffset-20:noffset+1]
yy = data['UNIFIEDFLUX'][noffset-20:noffset+1]-data['UNIFIEDFLUX'][noffset+20:noffset-1:-1]+1.
xx1 = vel[noffset:noffset+20]
yy1 = np.ones(xx1.shape)
ax.plot(xx, yy, color='Blue', lw=4)
ax.fill_between(xx, yy, np.ones(yy.size), color='DeepSkyBlue')
ax.plot(xx1, yy1, color='Blue', lw=4)
yerr = np.median(emission_error[noffset-6:noffset+7])*np.sqrt(2.)
ax.errorbar([420],[1.07],yerr=yerr,fmt='o',ms=10,lw=3,capsize=5,capthick=2)

#ax.fill_between(xx, yy-0.05, yresidual+0.05, color='SkyBlue')
#ax.fill_between(xx, yy-0.025, yresidual+0.025, color='RoyalBlue')
ax.text(-750, 1.08, 'Emission Excess', color='Blue', fontsize=22)
ax.text(-750, 1.065, r'at $v<0$', color='Blue', fontsize=22)
ax.set_xlabel(r'Velocity [km$\,$s$^{-1}$]', fontsize=24)
#ax.set_ylabel('Flux (normalized)', fontsize=22)
ax.set_ylim(ylimits2)
ax.text(-980, 1.090, r'$\left<R(\lambda)\right>$', rotation='vertical', va='bottom', fontsize=24)
#fig.savefig('/Users/Benjamin/Dropbox/Zhu_Projects/Fine Structure Emission/Version 1/Unified_Emission_Profile_BlueExcess.eps')


Out[10]:
<matplotlib.text.Text at 0x1259cbe90>

In [100]:
vel[noffset-20:noffset+1].shape, data['UNIFIEDFLUX'][noffset+20:noffset-1:-1].shape


Out[100]:
((21,), (21,))

In [161]:
print(speclines.FeII2366)


 Name = FeII* 2366
 Vacuum Wavelength = 2365.55 Ang
 Einstein A = 59000000.0 
 Einstein B (u->l) = 0.0 
 Einstein B (l->u) = 0.0 
 Strength = 3.08 
 Oscillator Strength = 0.0495
 Reference 1 = NIST 
 Reference 2 = NIST 


In [288]:
f2626_m = 2.39E-1*2600.**2#*3.52E7#/(3.52E7+2.35E8)
f2612_m = 7.17E-2*2586.**2#*1.20E8#/(8.94E7+1.20E8+6.29E7)
f2396_m = 3.59E-2*2374.**2#*2.59E8/(4.25E7+2.59E8)
f2366_m = 1.14E-1*2344.**2#*5.90E7#/(1.73E8+5.90E7+3.10E7)
f2626_s = 2.39E-1*2600.**2*3.52E7/(3.52E7+2.35E8)
f2612_s = 7.17E-2*2586.**2*1.20E8/(8.94E7+1.20E8)#+6.29E7)
f2396_s = 3.59E-2*2374.**2*2.59E8/(4.25E7+2.59E8)
f2366_s = 1.14E-1*2344.**2*5.90E7/(1.73E8+5.90E7)#+3.10E7)

In [289]:
print(f2366_s/f2626_s, f2396_s/f2626_s, f2612_s/f2626_s)
print(f2366_m/f2626_m, f2396_m/f2626_m, f2612_m/f2626_m)


(0.7568018361833609, 0.8257838969474178, 1.3055059327657133)
(0.38768184991706073, 0.12523083632492388, 0.29677792899408284)

In [301]:
data['FNORM']/data['FNORM'][1]


Out[301]:
array([ 0.68766044,  1.        ,  0.74631255,  1.4503818 ])

In [188]:
print(f2366_s/f2366_m, f2396_s/f2396_m, f2612_s/f2612_m, f2626_s/f2626_m)


(0.22433460076045625, 0.8590381426202321, 0.4406904149834741, 0.1302738712065137)

In [190]:
print(f2366_s/f2396_s, f2396_s/f2396_s, f2612_s/f2396_s, f2626_s/f2396_s)
print(f2366_m/f2396_m, f2396_m/f2396_m, f2612_m/f2396_m, f2626_m/f2396_m)


(0.8084403915858491, 1.0, 1.2157421556464412, 1.210970574379795)
(3.095737929204446, 1.0, 2.3698470576692707, 7.985253707045447)

In [410]:
data['FNORM']/data['FNORM'][3]


Out[410]:
array([ 0.47412374,  0.68947362,  0.51456282,  1.        ])

In [411]:
figsize(8,7)
#indices = [2,0,3]
indices = [1,0,3]
#names = array(['Fe II 2613', '2366', '2626'])
#y0 = data['FNORM'][indices]/data['FNORM'][1]
#f_s = array([f2612_s/f2396_s, f2366_s/f2396_s, f2626_s/f2396_s])
#f_m = array([f2612_m/f2396_m, f2366_m/f2396_m, f2626_m/f2396_m])
#y_s = f_s/y0
#y_m = f_m/y0
y0 = data['FNORM']/data['FNORM'][2]
#f_s = array([f2366_s/f2396_s, f2396_s/f2396_s, f2612_s/f2396_s, f2626_s/f2396_s])
#f_m = array([f2366_m/f2396_m, f2396_m/f2396_m, f2612_m/f2396_m, f2626_m/f2396_m])
f_s = array([f2366_s/f2612_s, f2396_s/f2612_s, f2612_s/f2612_s, f2626_s/f2612_s])
f_m = array([f2366_m/f2612_m, f2396_m/f2612_m, f2612_m/f2612_m, f2626_m/f2612_m])
y_s = f_s/y0
y_m = f_m/y0
x = arange(3)+1
plot([0.5,3.5],[1,1],color='Black',lw=9, alpha=0.7)


    #ax.text(-600, 1.35-i*0.05, line_names[index], color=line_colors[index], fontsize=22)
    
#plot(x, y_s, u'bs', ms=20)
#errorbar(x,y_s,yerr=0.85, color='blue', mec='blue', fmt='s', capsize=10, capthick=3, lw=3)
#plot(x, y_m, u'go', ms=20)
#errorbar(x,y_m,yerr=0.85, color='green', mec='green', fmt='o', capsize=10, capthick=3, lw=3)
xlim(0.5, 3.5)
ylim(-1,9)
for i, index in enumerate(indices):
    plot(x[i], y_s[index], u's', color=line_colors[index], ms=20)
    errorbar(x[i], y_s[index], yerr=0.85, color=line_colors[index], mec=line_colors[index], capsize=10, capthick=3, lw=3)
    plot(x[i], y_m[index], u'o', color=line_colors[index], ms=20)
    errorbar(x[i], y_m[index], yerr=0.85, color=line_colors[index], mec=line_colors[index], capsize=10, capthick=3, lw=3)

text(0.7, 7.85, r'Circle: Multiple Scattering ($\tau\gg1$)', color='black', fontsize=22)
text(0.7, 7.2, r'Square: Single Scattering ($\tau\ll1$)', color='black', fontsize=22)
ylabel(r'($\frac{W_{\rm FeII}^{\lambda}}{W_{\rm FeII}^{\lambda2396}})^{\rm e}/\frac{W_{\rm FeII}^{\lambda}}{W_{\rm FeII}^{\lambda2396}})^{\rm o}$', fontsize=22)
xticks(x, names, rotation=0, fontsize=22)
plot(x[0], y_s[2], color=line_colors[2], ms=20)


Out[411]:
[<matplotlib.lines.Line2D at 0x13366eb10>]

In [315]:
x[0], y_s[2], line_colors[2]


Out[315]:
(1, 2.11832063305962, 'red')

In [378]:
t2626 = 2.39E-1*2600.#*3.52E7#/(3.52E7+2.35E8)
t2612 = 7.17E-2*2586.#*1.20E8#/(8.94E7+1.20E8+6.29E7)
t2396 = 3.59E-2*2374.#*2.59E8/(4.25E7+2.59E8)
t2366 = 1.14E-1*2344.#*5.90E7#/(1.73E8+5.90E7+3.10E7)
pf2626 = 3.52E7/(3.52E7+2.35E8)
pf2612 = 1.20E8/(8.94E7+1.20E8+6.29E7)
pf2396 = 2.59E8/(4.25E7+2.59E8)
pf2366 = 5.90E7/(1.73E8+5.90E7+3.10E7)
pr2626 = 2.35E8/(3.52E7+2.35E8)
pr2612 = 8.94E7/(8.94E7+1.20E8+6.29E7)
pr2396 = 4.25E7/(4.25E7+2.59E8)
pr2366 = 1.73E8/(1.73E8+5.90E7+3.10E7)

In [384]:
tt2396 = logspace(-3,3,1000)
tt2626 = tt2396/t2396*t2626
tt2612 = tt2396/t2396*t2612
tt2366 = tt2396/t2396*t2366

beta2396 = (1.-exp(-tt2396))/tt2396
beta2626 = (1.-exp(-tt2626))/tt2626
beta2612 = (1.-exp(-tt2612))/tt2612
beta2366 = (1.-exp(-tt2366))/tt2366

PF_2396 = pf2396/(1.-pr2396*(1.-beta2396))
PF_2626 = pf2626/(1.-pr2626*(1.-beta2626))
PF_2612 = pf2612/(1.-pr2612*(1.-beta2612))
PF_2366 = pf2366/(1.-pr2366*(1.-beta2366))

In [402]:
figsize(8,7)
plot(tt2396, PF_2396, 'black', lw=3)
xscale('log')
xlim(5E-3, 1E2)
plot(tt2396, PF_2612, 'green', lw=3)
plot(tt2396, PF_2366, 'olive', lw=3)
plot(tt2396, PF_2626, 'magenta', lw=3)


Out[402]:
[<matplotlib.lines.Line2D at 0x132387fd0>]

In [409]:
figsize(8,7)
#plot(tt2396, PF_2396/PF_2396, 'black', lw=3)
xlim(5E-3, 1E2)
xscale('log')

plot(tt2396, PF_2612*t2612*2600./(PF_2396*t2396*2374.), 'olive', lw=3)
#plot([1E-2,1E2], [y0[2],y0[2]], color='Olive', lw=10, alpha=0.7)
plot(2.5E-2, y0[2], u's', color='olive', ms=15)
errorbar(2.5E-2, y0[2], yerr=0.5, color='olive', mec='olive', capsize=10, capthick=3, lw=3)
text(3.1E-2, 6.5, '2613', color='olive', fontsize=22)

plot(tt2396, PF_2366*t2366*2344./(PF_2396*t2396*2374.), 'blue', lw=3)
#fill_between([1E-2, 1E2], [y0[0]-0.3, y0[0]-0.3], [y0[0]+0.3, y0[0]+0.3], color='Blue', alpha=0.2)
#plot([1E-2,1E2], [y0[0],y0[0]], color='Blue', lw=6, alpha=0.7)
plot(4E-2, y0[0], u's', color='blue', ms=15)
errorbar(4E-2, y0[0], yerr=0.5, color='blue', mec='blue', capsize=10, capthick=3, lw=3)
text(3.1E-2, 7, '2366', color='blue', fontsize=22)

plot(tt2396, PF_2626*t2626*2600./(PF_2396*t2396*2374.), 'magenta', lw=3)
#fill_between([1E-2, 1E2], [y0[3]-0.3, y0[3]-0.3], [y0[3]+0.3, y0[3]+0.3], color='Magenta', alpha=0.2)
#plot([1E-2,1E2], [y0[3],y0[3]], color='Magenta', lw=6, alpha=0.7)
plot(5.4E-2, y0[3], u's', color='magenta', ms=15)
errorbar(5.4E-2, y0[3], yerr=0.5, color='magenta', mec='magenta', capsize=10, capthick=3, lw=3)
text(3.1E-2, 6, '2626', color='magenta', fontsize=22)

text(1E-2, 7, 'Fe II', color='blue', fontsize=22)
#text(1E-2, 5.5, 'Square: Observed Line Ratios', color='blue', fontsize=22)

xlabel(r'Optical Depth $\tau_{\rm Fe II}^{\lambda2396}$', fontsize=22)
#ylabel(r'$W^{\lambda2396}$', fontsize=22)
ylabel(r'Line Ratio $\frac{W_{\rm FeII}^{\lambda}}{W_{\rm FeII}^{\lambda2396}}$', fontsize=22)
tick_params(axis='x', which='major', length=8, width=2, labelsize=20)
tick_params(axis='y', which='major', length=8, width=2, labelsize=20)



In [ ]:


In [336]:
y0


Out[336]:
array([ 0.68766044,  1.        ,  0.74631255,  1.4503818 ])

In [354]:
1.20E8/(1.20E8+8.94E7+6.29E7), 1.20E8/(1.20E8+8.94E7)


Out[354]:
(0.4406904149834741, 0.5730659025787965)

In [383]:
6.29E7/1.20E8


Out[383]:
0.5241666666666667

In [404]:
data.dtype


Out[404]:
dtype([('LINES', '>f8', (4,)), ('VEL', '>f8', (200,)), ('FLUX', '>f8', (4, 200)), ('NORMFLUX', '>f8', (4, 200)), ('FNORM', '>f8', (4,)), ('INDEX', '>i4', (3,)), ('UNIFIEDFLUX', '>f8', (200,))])

In [427]:
absorption['LINES']


Out[427]:
array([ 2382.764,  2796.352,  2803.531,  2852.964,  2344.213,  2374.46 ,
        2586.649,  2600.172])

In [189]:
figsize(16,6)
xlimits = [-2400, 1800]
ylimits = [-0.2, 1.25]
flux_2344 = absorption['FLUX'][2]
fabs_2344 = corrected['FLUX'][2]
vel = absorption['VEL']
plot(vel+69./2., fabs_2344, '-', color='red', lw=4, drawstyle='steps', alpha=0.7)
plot(vel+69./2., flux_2344, '-', color='blue', lw=4, drawstyle='steps', alpha=1.0)
plot([500, 850], [0.135, 0.135], '-', color='blue', lw=3)
text(1000, 0.11, 'Observed', color='blue', fontsize=20)
plot([500, 850], [0.035, 0.035], '-', color='red', lw=3, alpha=0.7)
text(1000, 0.01, 'Emission Corrected', color='red', fontsize=20)
xlim(xlimits)
ylim(ylimits)
plot(xlimits, [1,1], ':', color='gray', lw=3)
plot([0,0], ylimits, '--', lw=2, color='gray')
xlabel('Velocity (km/s)', fontsize=22)
ylabel(r'Normalized $f(\lambda)$', fontsize=22)
tick_params(axis='x', which='major', length=8, width=2, labelsize=20)
tick_params(axis='y', which='major', length=8, width=2, labelsize=20)
text(-2200, 0.05, r'Mg II $\lambda\lambda$2796,2804', color='black', fontsize=22)


Out[189]:
<matplotlib.text.Text at 0x134ac79d0>

In [90]:
fig, axes = plt.subplots(figsize=(12,12), ncols=1, nrows=3)
axesall = axes.ravel()
fig.subplots_adjust(hspace=0, top=0.90, bottom=0.10)
xlimits = [-2400, 1800]
#ylimits = [-0.2, 1.29]
ylimits = [-0.2, 1.99]

for i, ax in enumerate(axesall):
    ax.tick_params(axis='x', which='major', length=8, width=2, labelsize=22, pad=8)
    ax.tick_params(axis='x', which='minor', length=4, width=2, labelsize=22, pad=8)
    ax.tick_params(axis='y', which='major', length=6, width=2, labelsize=20, pad=8)
    ax.tick_params(axis='y', which='minor', length=3, width=2, labelsize=20, pad=8)
    ax.set_xlim(xlimits) 
    ax.plot(xlimits, [1,1], ':', color='gray', lw=2)
    for axis in ['top','bottom','left','right']:
        ax.spines[axis].set_linewidth(2.2)

indices = [0,7,2]
vel = absorption['VEL']
for i, index in enumerate(indices):
    ax = axesall[i]
    this_flux = absorption['FLUX'][index]
    this_fabs = corrected['FLUX'][index]
    ax.plot(vel+69./2., this_fabs, '-', color='red', lw=4, drawstyle='steps')
    ax.plot(vel+69./2., this_flux, '-', color='blue', lw=4, drawstyle='steps')
    ax.plot(vel+69./2., this_flux-this_fabs+1., '--', color='green', lw=2, drawstyle='steps')
    if (i == 0):
        #ax.plot([500, 850], [0.135, 0.135], '-', color='blue', lw=3)
        ax.text(-2210, 0.38, 'Blue: Observed', color='blue', fontsize=22)
        #ax.plot([500, 850], [0.035, 0.035], '-', color='red', lw=3)
        ax.text(-2210, 0.20, 'Red: Emission-corrected', color='red', fontsize=22)
        ax.text(-2210, 0.02, 'Green: Emission infill', color='green', fontsize=22)

    ax.set_xlim(xlimits)
    ax.set_ylim(ylimits)
    ax.plot(xlimits, [1,1], ':', color='gray', lw=2)
    ax.plot([0,0], ylimits, ':', lw=2, color='gray')
    if (i == 0):
        ax.text(550, 0.00, r'Fe II $\lambda$2374 & $\lambda$2383', color='black', fontsize=22)
        tmpvel = (speclines.FeII2374.wave - speclines.FeII2383.wave)/speclines.FeII2383.wave*3E5
        ax.plot([tmpvel, tmpvel], ylimits, ':', lw=2, color='gray')
    if (i == 1):
        ax.text(550, 0.00, r'Fe II $\lambda$2587 & $\lambda$2600', color='black', fontsize=22)
        ax.set_ylabel(r'Normalized flux $\left<R(\lambda)\right>$', fontsize=24)
        tmpvel = (speclines.FeII2587.wave - speclines.FeII2600.wave)/speclines.FeII2600.wave*3E5
        ax.plot([tmpvel, tmpvel], ylimits, ':', lw=2, color='gray')
    if (i == 2):
        ax.text(550, 0.00, r'Mg II $\lambda\lambda$2796,$\,$2804', color='black', fontsize=22)
        tmpvel = (speclines.MgII2796.wave - speclines.MgII2803.wave)/speclines.MgII2803.wave*3E5
        ax.plot([tmpvel, tmpvel], ylimits, ':', lw=2, color='gray')
        ax.set_xlabel(r'Velocity [km$\,$s$^{-1}$]', fontsize=24)

fig.savefig('/Users/Benjamin/Dropbox/Zhu_Projects/Fine Structure Emission/Version 1/Emission_Correction_Example.eps')



In [68]:
print lines


[ 2382.764  2796.352  2803.531  2852.964  2344.213  2374.46   2586.649
  2600.172]

In [80]:
xlimits = [-800,600]
ylimits = [0.75, 1.075]

#use_indices = data['INDEX']
#use_indices = [3,5,6,4,7,0,2,1]
use_indices = (np.array([5, 6, 4, 7, 3, 0, 2, 1]))[::-1]
lines = absorption['LINES']
vel = absorption['VEL']
line_names = [str(int(np.rint(lines[index]))) for index in np.arange(8)]
species_names = ['FeII', 'MgII', 'MgII', 'MgI', 'FeII', 'FeII', 'FeII', 'FeII']

fig, ax = plt.subplots(figsize=(18,6), ncols=1, nrows=1)
#figsize(18,6)
ax.tick_params(axis='x', which='major', length=8, width=2, labelsize=20, pad=8)
ax.tick_params(axis='x', which='minor', length=4, width=2, labelsize=20, pad=8)
ax.tick_params(axis='y', which='major', length=6, width=2, labelsize=18, pad=8)
ax.tick_params(axis='y', which='minor', length=3, width=2, labelsize=18, pad=8)
    
# Middle panel
CM = plt.get_cmap('jet_r')
line_colors = [CM(fcolor) for fcolor in np.arange(8)/8.+1./8.][::-1]
for i, index in enumerate(use_indices):
    ax.plot(vel, 1.-(1.-absorption['FLUX'][index, :])/velmeasure['TFLUX'][index]*0.55, color=line_colors[i], lw=4)
    ax.text(-640, 0.91-i*0.02, line_names[index], color=line_colors[i], fontsize=22)
    ax.text(-720, 0.91-i*0.02, species_names[index], color=line_colors[i], fontsize=22)

ax.plot(xlimits, [1,1], ':', color='gray', lw=2)
ax.plot([0,0], ylimits, ':', lw=2, color='gray')

ax.set_xlabel(r'Velocity [km$\,$s$^{-1}$]', fontsize=21)
ax.set_ylabel(r'$\left<R(\lambda)\right>$', fontsize=22)
#ax.text(200, 0.81, 'Observed Absorption Profile', fontsize=20)
#ax.text(200, 0.79, '(Normalized)', fontsize=20)
ax.set_title('Observed Absorption Profile (Normalized)', fontsize=20)
ax.set_xlim(xlimits)
ax.set_ylim(ylimits)
#fill_between(vel, absorption['UNIFIEDABSORPTION']-absorption_error, 
#                absorption['UNIFIEDABSORPTION']+absorption_error, color='Red')
fig.savefig('/Users/Benjamin/Dropbox/Zhu_Projects/Fine Structure Emission/Version 1/Observed_Absorption_Profile_Normalized.eps')



In [92]:
fig, axes = plt.subplots(figsize=(12,12), ncols=1, nrows=3)
axesall = axes.ravel()
fig.subplots_adjust(hspace=0, top=0.90, bottom=0.10)
xlimits = [-2400, 1800]
ylimits = [0.2, 1.39]

for i, ax in enumerate(axesall):
    ax.tick_params(axis='x', which='major', length=8, width=2, labelsize=22, pad=8)
    ax.tick_params(axis='x', which='minor', length=4, width=2, labelsize=22, pad=8)
    ax.tick_params(axis='y', which='major', length=6, width=2, labelsize=20, pad=8)
    ax.tick_params(axis='y', which='minor', length=3, width=2, labelsize=20, pad=8)
    ax.set_xlim(xlimits) 
    ax.plot(xlimits, [1,1], ':', color='gray', lw=2)
    for axis in ['top','bottom','left','right']:
        ax.spines[axis].set_linewidth(2.2)

indices = [0,7,2]
vel = absorption['VEL']
for i, index in enumerate(indices):
    ax = axesall[i]
    this_flux = ewvelflux['FLUX'][4][index]
    this_fabs = ewvelflux['FLUX'][2][index]
    ax.plot(vel+69./2., this_flux, '-', color='blue', lw=4, drawstyle='steps')
    ax.plot(vel+69./2., this_fabs, '-', color='red', lw=4, drawstyle='steps')
    #ax.plot(vel, this_flux, '-', color='blue', lw=4)
    #ax.plot(vel, this_fabs, '-', color='red', lw=4)
    if (i == 0):
        #ax.plot([500, 850], [0.135, 0.135], '-', color='blue', lw=3)
        ax.text(-2240, 0.45, 'Blue: High [OII] EW', color='blue', fontsize=22)
        #ax.plot([500, 850], [0.035, 0.035], '-', color='red', lw=3)
        ax.text(-2240, 0.35, 'Red: Low [OII] EW', color='red', fontsize=22)
    ax.set_xlim(xlimits)
    ax.set_ylim(ylimits)
    ax.plot(xlimits, [1,1], ':', color='gray', lw=2)
    ax.plot([0,0], ylimits, ':', lw=2, color='gray')
    if (i == 0):
        ax.text(550, 0.35, r'Fe II $\lambda$2374 & $\lambda$2383', color='black', fontsize=22)
        tmpvel = (speclines.FeII2374.wave - speclines.FeII2383.wave)/speclines.FeII2383.wave*3E5
        ax.plot([tmpvel, tmpvel], ylimits, ':', lw=2, color='gray')
    if (i == 1):
        ax.text(550, 0.35, r'Fe II $\lambda$2587 & $\lambda$2600', color='black', fontsize=22)
        ax.set_ylabel(r'Normalized flux $\left<R(\lambda)\right>$', fontsize=24)
        tmpvel = (speclines.FeII2587.wave - speclines.FeII2600.wave)/speclines.FeII2600.wave*3E5
        ax.plot([tmpvel, tmpvel], ylimits, ':', lw=2, color='gray')
    if (i == 2):
        ax.text(550, 0.35, r'Mg II $\lambda\lambda$2796,$\,$2804', color='black', fontsize=22)
        tmpvel = (speclines.MgII2796.wave - speclines.MgII2803.wave)/speclines.MgII2803.wave*3E5
        ax.plot([tmpvel, tmpvel], ylimits, ':', lw=2, color='gray')
        ax.set_xlabel(r'Velocity [km$\,$s$^{-1}$]', fontsize=24)

fig.savefig('/Users/Benjamin/Dropbox/Zhu_Projects/Fine Structure Emission/Version 1/Observed_Absorption_EW.eps')



In [113]:
fig, axes = plt.subplots(figsize=(12,8), ncols=1, nrows=2)
axesall = axes.ravel()
fig.subplots_adjust(hspace=0, top=0.90, bottom=0.10)
xlimits = [-2400, 1800]
ylimits = [0.2, 1.39]

for i, ax in enumerate(axesall):
    ax.tick_params(axis='x', which='major', length=8, width=2, labelsize=22, pad=8)
    ax.tick_params(axis='x', which='minor', length=4, width=2, labelsize=22, pad=8)
    ax.tick_params(axis='y', which='major', length=6, width=2, labelsize=20, pad=8)
    ax.tick_params(axis='y', which='minor', length=3, width=2, labelsize=20, pad=8)
    ax.set_xlim(xlimits) 
    ax.plot(xlimits, [1,1], ':', color='gray', lw=2)
    for axis in ['top','bottom','left','right']:
        ax.spines[axis].set_linewidth(2.2)

indices = [2,2]
vel = absorption['VEL']
for i, index in enumerate(indices):
    ax = axesall[i]
    if (i == 0):
        this_flux = ewvelflux['FLUX'][4][index]
        this_fabs = ewvelflux['FLUX'][2][index]
        ax.plot(vel+69./2., this_flux, '-', color='blue', lw=4, drawstyle='steps')
        ax.plot(vel+69./2., this_fabs, '-', color='red', lw=4, drawstyle='steps')
    if (i == 1):
        this_flux = lumvelflux['FLUX'][4][index]
        this_fabs = lumvelflux['FLUX'][2][index]        
        ax.plot(vel+69./2., this_flux, '-', color='navy', lw=4, drawstyle='steps')
        ax.plot(vel+69./2., this_fabs, '-', color='magenta', lw=4, drawstyle='steps')
    #ax.plot(vel, this_flux, '-', color='blue', lw=4)
    #ax.plot(vel, this_fabs, '-', color='red', lw=4)
    if (i == 0):
        #ax.plot([500, 850], [0.135, 0.135], '-', color='blue', lw=3)
        ax.text(-2240, 0.45, 'Blue: High [OII] EW', color='blue', fontsize=22)
        #ax.plot([500, 850], [0.035, 0.035], '-', color='red', lw=3)
        ax.text(-2240, 0.35, 'Red: Low [OII] EW', color='red', fontsize=22)
    if (i == 1):
        #ax.plot([500, 850], [0.135, 0.135], '-', color='blue', lw=3)
        ax.text(-2240, 0.45, 'Navy: High [OII] Lum', color='navy', fontsize=22)
        #ax.plot([500, 850], [0.035, 0.035], '-', color='red', lw=3)
        ax.text(-2240, 0.35, 'Magenta: Low [OII] Lum', color='magenta', fontsize=22)
    ax.set_xlim(xlimits)
    ax.set_ylim(ylimits)
    ax.plot(xlimits, [1,1], ':', color='gray', lw=2)
    ax.plot([0,0], ylimits, ':', lw=2, color='gray')
    tmpvel = (speclines.MgII2796.wave - speclines.MgII2803.wave)/speclines.MgII2803.wave*3E5
    ax.plot([tmpvel, tmpvel], ylimits, ':', lw=2, color='gray')
    if (i == 1):
        ax.text(550, 0.35, r'Mg II $\lambda\lambda$2796,$\,$2804', color='black', fontsize=22)
        ax.set_xlabel(r'Velocity [km$\,$s$^{-1}$]', fontsize=24)
        ax.text(-2800, 0.80, r'Normalized flux $\left<R(\lambda)\right>$', rotation='vertical', va='bottom', fontsize=24)


fig.savefig('/Users/Benjamin/Dropbox/Zhu_Projects/Fine Structure Emission/Version 1/Observed_Absorption_MgIIEWLUM.eps')



In [58]:
fig, axes = plt.subplots(figsize=(16,15), ncols=1, nrows=3)
axesall = axes.ravel()
fig.subplots_adjust(hspace=0, top=0.90, bottom=0.10)
xlimits = [-2400, 1800]
ylimits = [0.5, 1.59]

for i, ax in enumerate(axesall):
    ax.tick_params(axis='x', which='major', length=8, width=2, labelsize=24, pad=8)
    ax.tick_params(axis='x', which='minor', length=4, width=2, labelsize=24, pad=8)
    ax.tick_params(axis='y', which='major', length=6, width=2, labelsize=22, pad=8)
    ax.tick_params(axis='y', which='minor', length=3, width=2, labelsize=22, pad=8)
    ax.set_xlim(xlimits) 
    ax.plot(xlimits, [1,1], ':', color='gray', lw=2)
    for axis in ['top','bottom','left','right']:
        ax.spines[axis].set_linewidth(2.2)

indices = [8,9,11]
vel = absorption['VEL']
for i, index in enumerate(indices):
    ax = axesall[i]
    this_flux = ewvelflux['FLUX'][4][index]
    this_fabs = ewvelflux['FLUX'][2][index]
    ax.plot(vel+69./2., this_flux, '-', color='blue', lw=4, drawstyle='steps')
    ax.plot(vel+69./2., this_fabs, '-', color='red', lw=4, drawstyle='steps')
    if (i == 0):
        #ax.plot([500, 850], [0.135, 0.135], '-', color='blue', lw=3)
        ax.text(-2240, 0.70, 'Blue: High [OII] EW', color='blue', fontsize=25)
        #ax.plot([500, 850], [0.035, 0.035], '-', color='red', lw=3)
        ax.text(-2240, 0.60, 'Red: Low [OII] EW', color='red', fontsize=25)
    ax.set_xlim(xlimits)
    ax.set_ylim(ylimits)
    ax.plot(xlimits, [1,1], ':', color='gray', lw=2)
    ax.plot([0,0], ylimits, ':', lw=2, color='gray')
    if (i == 0):
        ax.text(600, 1.35, r'Fe II $\lambda$2366', color='black', fontsize=25)
        tmpvel = (speclines.FeII2374.wave - speclines.FeII2383.wave)/speclines.FeII2383.wave*3E5
        #ax.plot([tmpvel, tmpvel], ylimits, ':', lw=2, color='gray')
    if (i == 1):
        ax.text(600, 1.35, r'Fe II $\lambda$2396', color='black', fontsize=25)
        ax.set_ylabel(r'Normalized flux $\left<R(\lambda)\right>$', fontsize=26)
        tmpvel = (speclines.FeII2587.wave - speclines.FeII2600.wave)/speclines.FeII2600.wave*3E5
        #ax.plot([tmpvel, tmpvel], ylimits, ':', lw=2, color='gray')
    if (i == 2):
        ax.text(600, 1.35, r'Fe II $\lambda$2613 & $\lambda$2626', color='black', fontsize=25)
        tmpvel = (speclines.FeII2613.wave - speclines.FeII2626.wave)/speclines.FeII2626.wave*3E5
        ax.plot([tmpvel, tmpvel], ylimits, ':', lw=2, color='gray')
        ax.set_xlabel(r'Velocity [km$\,$s$^{-1}$]', fontsize=26)

fig.savefig('/Users/Benjamin/Dropbox/Zhu_Projects/Fine Structure Emission/Version 1/Observed_Emission_EW.eps')



In [114]:
fig, axes = plt.subplots(figsize=(12,12), ncols=1, nrows=3)
axesall = axes.ravel()
fig.subplots_adjust(hspace=0, top=0.90, bottom=0.10)
xlimits = [-2400, 1800]
ylimits = [0.2, 1.39]

for i, ax in enumerate(axesall):
    ax.tick_params(axis='x', which='major', length=8, width=2, labelsize=22, pad=8)
    ax.tick_params(axis='x', which='minor', length=4, width=2, labelsize=22, pad=8)
    ax.tick_params(axis='y', which='major', length=6, width=2, labelsize=20, pad=8)
    ax.tick_params(axis='y', which='minor', length=3, width=2, labelsize=20, pad=8)
    ax.set_xlim(xlimits) 
    ax.plot(xlimits, [1,1], ':', color='gray', lw=2)
    for axis in ['top','bottom','left','right']:
        ax.spines[axis].set_linewidth(2.2)

indices = [0,7,2]
vel = absorption['VEL']
for i, index in enumerate(indices):
    ax = axesall[i]
    this_flux = lumvelflux['FLUX'][4][index]
    this_fabs = lumvelflux['FLUX'][2][index]
    ax.plot(vel+69./2., this_flux, '-', color='navy', lw=4, drawstyle='steps')
    ax.plot(vel+69./2., this_fabs, '-', color='magenta', lw=4, drawstyle='steps')
    #ax.plot(vel, this_flux, '-', color='blue', lw=4)
    #ax.plot(vel, this_fabs, '-', color='red', lw=4)
    if (i == 0):
        #ax.plot([500, 850], [0.135, 0.135], '-', color='blue', lw=3)
        ax.text(-2240, 0.45, 'Navy: High [OII] Luminosity', color='navy', fontsize=22)
        #ax.plot([500, 850], [0.035, 0.035], '-', color='red', lw=3)
        ax.text(-2240, 0.35, 'Magenta: Low [OII] Luminosity', color='magenta', fontsize=22)
    ax.set_xlim(xlimits)
    ax.set_ylim(ylimits)
    ax.plot(xlimits, [1,1], ':', color='gray', lw=2)
    ax.plot([0,0], ylimits, ':', lw=2, color='gray')
    if (i == 0):
        ax.text(550, 0.35, r'Fe II $\lambda$2374 & $\lambda$2383', color='black', fontsize=22)
        tmpvel = (speclines.FeII2374.wave - speclines.FeII2383.wave)/speclines.FeII2383.wave*3E5
        ax.plot([tmpvel, tmpvel], ylimits, ':', lw=2, color='gray')
    if (i == 1):
        ax.text(550, 0.35, r'Fe II $\lambda$2587 & $\lambda$2600', color='black', fontsize=22)
        ax.set_ylabel(r'Normalized flux $\left<R(\lambda)\right>$', fontsize=24)
        tmpvel = (speclines.FeII2587.wave - speclines.FeII2600.wave)/speclines.FeII2600.wave*3E5
        ax.plot([tmpvel, tmpvel], ylimits, ':', lw=2, color='gray')
    if (i == 2):
        ax.text(550, 0.35, r'Mg II $\lambda\lambda$2796,$\,$2804', color='black', fontsize=22)
        tmpvel = (speclines.MgII2796.wave - speclines.MgII2803.wave)/speclines.MgII2803.wave*3E5
        ax.plot([tmpvel, tmpvel], ylimits, ':', lw=2, color='gray')
        ax.set_xlabel(r'Velocity [km$\,$s$^{-1}$]', fontsize=24)

fig.savefig('/Users/Benjamin/Dropbox/Zhu_Projects/Fine Structure Emission/Version 1/Observed_Absorption_Lum.eps')



In [57]:
fig, axes = plt.subplots(figsize=(16,15), ncols=1, nrows=3)
axesall = axes.ravel()
fig.subplots_adjust(hspace=0, top=0.90, bottom=0.10)
xlimits = [-2400, 1800]
ylimits = [0.5, 1.59]

for i, ax in enumerate(axesall):
    ax.tick_params(axis='x', which='major', length=8, width=2, labelsize=24, pad=8)
    ax.tick_params(axis='x', which='minor', length=4, width=2, labelsize=24, pad=8)
    ax.tick_params(axis='y', which='major', length=6, width=2, labelsize=22, pad=8)
    ax.tick_params(axis='y', which='minor', length=3, width=2, labelsize=22, pad=8)
    ax.set_xlim(xlimits) 
    ax.plot(xlimits, [1,1], ':', color='gray', lw=2)
    for axis in ['top','bottom','left','right']:
        ax.spines[axis].set_linewidth(2.2)

indices = [8,9,11]
vel = absorption['VEL']
for i, index in enumerate(indices):
    ax = axesall[i]
    this_flux = lumvelflux['FLUX'][4][index]
    this_fabs = lumvelflux['FLUX'][2][index]
    ax.plot(vel+69./2., this_flux, '-', color='blue', lw=4, drawstyle='steps')
    ax.plot(vel+69./2., this_fabs, '-', color='red', lw=4, drawstyle='steps')
    if (i == 0):
        #ax.plot([500, 850], [0.135, 0.135], '-', color='blue', lw=3)
        ax.text(-2240, 0.70, 'Blue: High [OII] Luminosity', color='blue', fontsize=25)
        #ax.plot([500, 850], [0.035, 0.035], '-', color='red', lw=3)
        ax.text(-2240, 0.60, 'Red: Low [OII] Luminosity', color='red', fontsize=25)
    ax.set_xlim(xlimits)
    ax.set_ylim(ylimits)
    ax.plot(xlimits, [1,1], ':', color='gray', lw=2)
    ax.plot([0,0], ylimits, ':', lw=2, color='gray')
    if (i == 0):
        ax.text(600, 1.35, r'Fe II $\lambda$2366', color='black', fontsize=25)
        tmpvel = (speclines.FeII2374.wave - speclines.FeII2383.wave)/speclines.FeII2383.wave*3E5
        #ax.plot([tmpvel, tmpvel], ylimits, ':', lw=2, color='gray')
    if (i == 1):
        ax.text(600, 1.35, r'Fe II $\lambda$2396', color='black', fontsize=25)
        ax.set_ylabel(r'Normalized flux $\left<R(\lambda)\right>$', fontsize=26)
        tmpvel = (speclines.FeII2587.wave - speclines.FeII2600.wave)/speclines.FeII2600.wave*3E5
        #ax.plot([tmpvel, tmpvel], ylimits, ':', lw=2, color='gray')
    if (i == 2):
        ax.text(600, 1.35, r'Fe II $\lambda$2613 & $\lambda$2626', color='black', fontsize=25)
        tmpvel = (speclines.FeII2613.wave - speclines.FeII2626.wave)/speclines.FeII2626.wave*3E5
        ax.plot([tmpvel, tmpvel], ylimits, ':', lw=2, color='gray')
        ax.set_xlabel(r'Velocity [km$\,$s$^{-1}$]', fontsize=26)

fig.savefig('/Users/Benjamin/Dropbox/Zhu_Projects/Fine Structure Emission/Version 1/Observed_Emission_Lum.eps')



In [102]:
fig, axes = plt.subplots(figsize=(12,12), ncols=1, nrows=3)
axesall = axes.ravel()
fig.subplots_adjust(hspace=0, top=0.90, bottom=0.10)
xlimits = [-800,600]
ylimits = [-0.1, 1.15]
ylimits1 = [0.75, 1.075]

#use_indices = data['INDEX']
#use_indices = (np.array([5,3,6,4,7,0,2,1]))[::-1]
use_indices = (np.array([5, 6, 4, 7, 3, 0, 2, 1]))[::-1]
lines = absorption['LINES']
vel = absorption['VEL']
line_names = [str(int(np.rint(lines[index]))) for index in np.arange(8)]
species_names = ['FeII', 'MgII', 'MgII', 'MgI', 'FeII', 'FeII', 'FeII', 'FeII']
#line_names = ['2853', '2374', '2587', '2344', '2600', '2382', '2803', '2796']
#line_names = [2796', '2803', '2382', '2600', '2344', '2587', '2374', '2853']
#line_colors = ['blue', 'green', 'olive', 'magenta']

for i, ax in enumerate(axesall):
    ax.tick_params(axis='x', which='major', length=8, width=2, labelsize=22, pad=8)
    ax.tick_params(axis='x', which='minor', length=4, width=2, labelsize=22, pad=8)
    ax.tick_params(axis='y', which='major', length=6, width=2, labelsize=20, pad=8)
    ax.tick_params(axis='y', which='minor', length=3, width=2, labelsize=20, pad=8)
    ax.set_xlim(xlimits) 
    ax.plot(xlimits, [1,1], ':', color='gray', lw=2)
    for axis in ['top','bottom','left','right']:
        ax.spines[axis].set_linewidth(2.2)

# Top panel:
#CM = plt.get_cmap('hot')
#line_colors = [CM(fcolor) for fcolor in np.arange(8)/8./1.3+0.0]
CM = plt.get_cmap('jet_r')
line_colors = [CM(fcolor) for fcolor in np.arange(8)/8.+1./8.][::-1]
ax = axesall[0]
for i, index in enumerate(use_indices):
    ax.plot(vel, absorption['FABS'][index], color=line_colors[i], lw=3)
    ax.text(-620, 0.73-i*0.11, line_names[index], color=line_colors[i], fontsize=22)
    ax.text(-720, 0.73-i*0.11, species_names[index], color=line_colors[i], fontsize=22)

ax.plot([0,0], ylimits, ':', color='gray', lw=2)

    
#ax.text(-750, 1.35, 'Fe II', color=line_colors[0], fontsize=22)
#ax.xaxis.tick_top()
#ax.set_xlabel('Velocity (km/s)', fontsize=22)
#ax.set_ylabel('Flux (normalized)', fontsize=22)
plt.setp(ax.get_xticklabels(), visible=False)
ax.text(200, 0.2, 'Emission-corrected', fontsize=20)
ax.text(200, 0.1, 'Absorption Profile', fontsize=20)
ax.set_ylim(ylimits)
    
# Middle panel
ax = axesall[1]
for i, index in enumerate(use_indices):
    color = CM(i/8./1.5+0.2)
    ax.plot(vel, absorption['NORMFABS'][index, :], color=line_colors[i], lw=3)
#ax.plot(vel, data['UNIFIEDFLUX'], color='black', lw=4)
ax.plot([0,0], ylimits1, ':', color='gray', lw=2)
plt.setp(ax.get_xticklabels(), visible=False)
ax.set_ylabel(r'Normalized flux $\left<R(\lambda)\right>$', fontsize=24)
ax.text(200, 0.8, 'Normalized Profile', fontsize=20)
ax.set_ylim(ylimits1)
    
# Bottom panel
ax = axesall[2]
#ax.fill_between(vel, absorption['UNIFIEDABSORPTION']-absorption_error*2, 
#                absorption['UNIFIEDABSORPTION']+absorption_error*2, color='Bisque')
ax.fill_between(vel, absorption['UNIFIEDABSORPTION']-absorption_error, 
                absorption['UNIFIEDABSORPTION']+absorption_error, color='LightSalmon')
ax.plot(vel, absorption['UNIFIEDABSORPTION'], color='Maroon', lw=4)
ax.plot([0,0], ylimits1, ':', color='gray', lw=2)
ax.text(200, 0.8, 'Unified Profile', fontsize=20)
ax.set_xlabel(r'Velocity [km$\,$s$^{-1}$]', fontsize=24)
#ax.set_ylabel('Flux (normalized)', fontsize=22)
ax.set_ylim(ylimits1)
fig.savefig('/Users/Benjamin/Dropbox/Zhu_Projects/Fine Structure Emission/Version 1/Absorption_Profile_Emission_Corrected.eps')



In [49]:
# Symmetric Gaussian profile
xtmp = np.linspace(-800., 600, num=100)
width = 108.
ytmp = 1.+stats.norm.pdf((xtmp+0)/width)*0.60

fig, ax = plt.subplots(figsize=(14,6), ncols=1, nrows=1)

yabs = 1.+(1.-absorption['UNIFIEDABSORPTION'])*1.25#-0.005
#yemi = data['UNIFIEDFLUX']#+0.005
yemi = data['UNIFIEDFLUX']
ax.plot(vel, yemi, color='blue', lw=3)#, drawstyle='steps')
ax.fill_between(vel, yemi-emission_error, yemi+emission_error, color='DeepSkyBlue')
ax.plot(vel, yabs, color='red', lw=3)#, drawstyle='steps')
ax.fill_between(vel, yabs-absorption_error, yabs+absorption_error*1.00, color='LightSalmon')
ax.set_xlim(-800,600)
ax.set_ylim(0.9, 1.35)
ax.plot(xlimits, [1,1], ':', color='black', lw=2)
ax.set_xlabel(r'Velocity [km$\,$s$^{-1}$]', fontsize=24)
ax.set_ylabel(r'$\left<R(\lambda)\right>$', fontsize=24)
ax.tick_params(axis='x', which='major', length=8, width=2, labelsize=22, pad=8)
ax.tick_params(axis='y', which='major', length=8, width=2, labelsize=22, pad=8)
ax.plot([0,0],[0.9,1.35],':', color='black', lw=2)
ax.plot(xtmp, ytmp, '--', lw=6, color='green')
ax.text(-750, 1.3, 'Unified Absorption Profile (Flipped)', color='Red', fontsize=22)
ax.text(-750, 1.27, 'Unified Emission Profile', color='Blue', fontsize=22)
ax.text(-750, 1.24, r'Gaussian ($\sigma=108\,$km s$^{-1}$)', color='Green', fontsize=22)
fig.savefig('/Users/Benjamin/Dropbox/Zhu_Projects/Fine Structure Emission/Version 1/Absorption_Emission_Gaussian.eps')



In [8]:
# Symmetric Gaussian profile
xtmp = np.linspace(-800., 600, num=100)
width = 108.
ytmp = 1.+stats.norm.pdf((xtmp+0)/width)*0.60

fig, axes = plt.subplots(figsize=(10,9), ncols=1, nrows=2)
fig.subplots_adjust(hspace=0, top=0.90, bottom=0.10)

ax = axes[0]
yabs = 1.+(1.-absorption['UNIFIEDABSORPTION'])*1.25#-0.005
#yemi = data['UNIFIEDFLUX']#+0.005
yemi = data['UNIFIEDFLUX']
ax.plot(vel, yemi, color='blue', lw=3)#, drawstyle='steps')
ax.fill_between(vel, yemi-emission_error, yemi+emission_error, color='DeepSkyBlue')
ax.plot(vel, yabs, color='red', lw=3)#, drawstyle='steps')
ax.fill_between(vel, yabs-absorption_error, yabs+absorption_error*1.00, color='LightSalmon')
ax.set_xlim(-800,600)
ax.set_ylim(0.9, 1.35)
ax.plot(xlimits, [1,1], ':', color='black', lw=2)
ax.set_xlabel(r'Velocity [km$\,$s$^{-1}$]', fontsize=24)
ax.set_ylabel(r'$\left<R(\lambda)\right>$', fontsize=24)
ax.tick_params(axis='x', which='major', length=8, width=2, labelsize=22, pad=8)
ax.tick_params(axis='y', which='major', length=8, width=2, labelsize=22, pad=8)
ax.plot([0,0],[0.9,1.35],':', color='black', lw=2)
ax.plot(xtmp, ytmp, '--', lw=6, color='green')
ax.text(-750, 1.3, 'Unified Absorption Profile (Flipped)', color='Red', fontsize=21)
ax.text(-750, 1.26, 'Unified Emission Profile', color='Blue', fontsize=21)
ax.text(-750, 1.22, r'Gaussian ($\sigma=108\,$km s$^{-1}$)', color='Green', fontsize=21)
plt.setp(ax.get_xticklabels(), visible=False)


ax = axes[1]
#yabs = 1.+(1.-absorption['UNIFIEDABSORPTION'])*1.25#-0.005
#yemi = data['UNIFIEDFLUX']#+0.005
yemi = (oiii_vel['FLUX'][0]-1.)/np.sum(oiii_vel['FLUX'][0][85:110]-1.)*0.94+1.
ax.plot(vel, yemi, color='magenta', lw=5)#, drawstyle='steps')
#ax.fill_between(vel, yemi-emission_error, yemi+emission_error, color='DeepSkyBlue')
#ax.plot(vel, yabs, color='red', lw=3)#, drawstyle='steps')
#ax.fill_between(vel, yabs-absorption_error, yabs+absorption_error*1.00, color='LightSalmon')
ax.set_xlim(-800,600)
ax.set_ylim(0.9, 1.35)
ax.plot(xlimits, [1,1], ':', color='black', lw=2)
ax.set_xlabel(r'Velocity [km$\,$s$^{-1}$]', fontsize=24)
ax.set_ylabel(r'$\left<R(\lambda)\right>$', fontsize=24)
ax.tick_params(axis='x', which='major', length=8, width=2, labelsize=22, pad=8)
ax.tick_params(axis='y', which='major', length=8, width=2, labelsize=22, pad=8)
ax.plot([0,0],[0.9,1.35],':', color='black', lw=2)
ax.plot(xtmp, ytmp, '--', lw=6, color='green')
ax.text(-750, 1.3, r'[OIII]$\,\lambda5008$ Emission Profile', color='Magenta', fontsize=21)
#ax.text(-750, 1.27, 'Unified Emission Profile', color='Blue', fontsize=22)
ax.text(-750, 1.26, r'Gaussian ($\sigma=108\,$km s$^{-1}$)', color='Green', fontsize=21)
#fig.savefig('/Users/Benjamin/Dropbox/Zhu_Projects/Fine Structure Emission/Version 1/OIII_Emission_Gaussian.eps')


Out[8]:
<matplotlib.text.Text at 0x1266aca50>

In [30]:
# Symmetric Gaussian profile
xtmp = np.linspace(-800., 600, num=100)
width = 108.
ytmp = 1.+stats.norm.pdf((xtmp+0)/width)*0.60

fig, axes = plt.subplots(figsize=(12,5), ncols=1, nrows=1)
fig.subplots_adjust(hspace=0, top=0.90, bottom=0.10)

ax = axes
yabs = 1.-(1.-absorption['UNIFIEDABSORPTION'])*1.25#-0.005
#yemi = data['UNIFIEDFLUX']#+0.005
yemi = data['UNIFIEDFLUX']-1.
#ax.plot(vel, 1.+yemi*0., color='green', lw=3)#, drawstyle='steps')
ax.plot(vel, yabs+yemi*0., color='red', lw=3)#, drawstyle='steps')
#ax.plot(vel, 1.+yemi*0.3, color='green', lw=3)#, drawstyle='steps')
ax.plot(vel, yabs+yemi*0.7, color='blue', lw=3)#, drawstyle='steps')
ax.set_xlim(-800,600)
ax.set_ylim(0.74, 1.04)
ax.plot(xlimits, [1,1], ':', color='black', lw=2)
ax.set_xlabel(r'Velocity [km$\,$s$^{-1}$]', fontsize=24)
ax.set_ylabel(r'$\left<R(\lambda)\right>$', fontsize=24)
ax.tick_params(axis='x', which='major', length=8, width=2, labelsize=22, pad=8)
ax.tick_params(axis='y', which='major', length=8, width=2, labelsize=22, pad=8)
ax.plot([0,0],[0.7,1.35],':', color='black', lw=2)
#ax.plot(xtmp, ytmp, '--', lw=6, color='green')
#ax.text(-750, 1.3, 'Unified Absorption Profile (Flipped)', color='Red', fontsize=21)
#ax.text(-750, 1.26, 'Unified Emission Profile', color='Blue', fontsize=21)
#ax.text(-750, 1.22, r'Gaussian ($\sigma=108\,$km s$^{-1}$)', color='Green', fontsize=21)
#plt.setp(ax.get_xticklabels(), visible=False)

#fig.savefig('/Users/Benjamin/Dropbox/Zhu_Projects/Fine Structure Emission/Version 1/OIII_Emission_Gaussian.eps')


Out[30]:
[<matplotlib.lines.Line2D at 0x127f92e90>]

In [651]:
sqrt(69**2+60**2)


Out[651]:
91.438503924769023

In [70]:
fig, ax = plt.subplots(figsize=(9,9), ncols=1, nrows=1)

xlimits = [-1, 8]
ylimits = [190, -490]
indices = np.array([5, 6, 4, 7, 3, 0, 2, 1]) #to be ordered by FR
lines = velmeasure['LINES']
names = np.array([str(int(np.rint(lines[index]))) for index in np.arange(8)])
species_names = ['FeII', 'MgII', 'MgII', 'MgI', 'FeII', 'FeII', 'FeII', 'FeII']

v80 = velmeasure['FLUX_PERCENT'][14,:]
v80_error = vpercent_lines_error[14,:]

v50 = velmeasure['FLUX_PERCENT'][8,:]
v50_error = vpercent_lines_error[8,:]

v20 = velmeasure['FLUX_PERCENT'][2,:]
v20_error = vpercent_lines_error[2,:]

v80_corrected = velmeasure['UNIFIEDPERCENT'][14]
v80_corrected_error = vpercent_error[14]*1.
v50_corrected = velmeasure['UNIFIEDPERCENT'][8]
v50_corrected_error = vpercent_error[8]*1.
v20_corrected = velmeasure['UNIFIEDPERCENT'][2]
v20_corrected_error = vpercent_error[2]*1.

xx = np.arange(8)
#plot(xlimits, [v80_corrected, v80_corrected], lw=2, color='Blue')
ax.fill_between(xlimits, [v80_corrected, v80_corrected]-v80_corrected_error, [v80_corrected, v80_corrected]+v80_corrected_error,
             color='DeepSkyBlue')
ax.plot(xx, v80[indices], 'o', ms=10, color='blue')
ax.errorbar(xx, v80[indices], v80_error[indices], ms=15, color='blue', elinewidth=2, capsize=5, capthick=2)
for i, index in enumerate(indices):
    ax.text(xx[i]-0.3, v80[index]-30., names[index], fontsize=18)
    ax.text(xx[i]-0.3, v80[index]-55., species_names[index], fontsize=18)
ax.text(xx[0]-0.5, v80_corrected-210., r'$v_{80}$ (80% of absorption is at $v>v_{80}$)', fontsize=22, color='blue')
ax.text(xx[0]-0.4, v80_corrected-290., 'Circles: Observed', fontsize=20, color='black')
ax.text(xx[0]-0.4, v80_corrected-260., 'Horizontal bands: Emission-corrected', fontsize=20, color='black')

    
#plot(xlimits, [v50_corrected, v50_corrected], lw=2, color='green', alpha=0.7)
ax.fill_between(xlimits, [v50_corrected, v50_corrected]-v50_corrected_error, [v50_corrected, v50_corrected]+v50_corrected_error,
             color='LightGreen')
ax.plot(xx, v50[indices], 'o', ms=10, color='green')
ax.errorbar(xx, v50[indices], v50_error[indices], ms=15, color='green', elinewidth=2, capsize=5, capthick=2)
ax.text(xx[0]-0.5, v50_corrected-40., r'$v_{50}$', fontsize=24, color='green')

#plot(xlimits, [v20_corrected, v20_corrected], lw=2, color='Salmon', alpha=0.7)
ax.fill_between(xlimits, [v20_corrected, v20_corrected]-v50_corrected_error, [v20_corrected, v20_corrected]+v20_corrected_error,
             color='Salmon')
ax.plot(xx, v20[indices], 'o', ms=10, color='red')
ax.errorbar(xx, v20[indices], v20_error[indices], ms=15, color='red', elinewidth=2, capsize=5, capthick=2)
ax.text(xx[0]-0.5, v20_corrected-40., r'$v_{20}$', fontsize=24, color='red')

ax.set_xlim(xlimits)
ax.set_ylim(ylimits)
ax.tick_params(axis='x', which='major', length=8, width=2, labelsize=20, pad=8)
ax.tick_params(axis='y', which='major', length=8, width=2, labelsize=20, pad=8)
ax.set_xticks(xx)
ax.set_xticklabels(names[indices], rotation=0, fontsize=20)
ax.set_xlabel('Lines', fontsize=22)
ax.set_ylabel(r'Velocity [km$\,$s$^{-1}$]', fontsize=22)
ax.set_title('Non-parametric Velocity Offset', fontsize=21)
fig.savefig('/Users/Benjamin/Dropbox/Zhu_Projects/Fine Structure Emission/Version 1/Velocity_Absorption_Emission.eps')



In [11]:
fig, ax = plt.subplots(figsize=(10,8), ncols=1, nrows=1)

lines = velmeasure['LINES']
indices = np.array([5, 6, 4, 7, 3, 0, 2, 1]) #to be ordered by FR
names = np.array([str(int(np.rint(lines[index]))) for index in np.arange(8)])
species_names = ['FeII', 'MgII', 'MgII', 'MgI', 'FeII', 'FeII', 'FeII', 'FeII']

observed_ratio = velmeasure['TFLUX'][indices]/velmeasure['TFLUX'][5]
tmp_observed_error = np.std(velmeasure_bstrap['TFLUX'], axis=1)
tmp_observed_ratio_error = np.sqrt(np.power(tmp_observed_error, 2)+ \
                               np.power(tmp_observed_error[5], 2)*np.power(velmeasure['TFLUX'], 2))/velmeasure['TFLUX'][5]
observed_ratio_error = tmp_observed_ratio_error[indices]

corrected_ratio = velmeasure['TFABS'][indices]/velmeasure['TFABS'][5]
tmp_corrected_error = np.std(velmeasure_bstrap['TFABS'], axis=1)
tmp_corrected_ratio_error = np.sqrt(np.power(tmp_corrected_error, 2)+ \
                               np.power(tmp_corrected_error[5], 2)*np.power(velmeasure['TFABS'], 2))/velmeasure['TFABS'][5]
corrected_ratio_error = tmp_corrected_ratio_error[indices]

#velmeasure['TFABS'][5]
qso_ratio = rew_absorber['TFLUX'][indices]/rew_absorber['TFLUX'][5]

xx = np.arange(8)
ax.plot(xx, observed_ratio/qso_ratio, 'o', ms=14, color='blue', label='Observed')
ax.errorbar(xx, observed_ratio/qso_ratio, observed_ratio_error/qso_ratio, ms=15, color='blue', capsize=4, capthick=2)
#errorbar(xx, observed_ratio/qso_ratio, 0.04, ms=15, color='blue', capsize=4, capthick=2)
ax.plot(xx, corrected_ratio/qso_ratio, 's', ms=12, color='green', label='Emission-corrected')
ax.errorbar(xx, corrected_ratio/qso_ratio, corrected_ratio_error/qso_ratio, ms=15, color='green', capsize=4, capthick=2)

ax.text(5.05, 1.78, 'Observed', fontsize=22, color='blue')
ax.plot([4.80], [1.85], 'o', ms=14, color='blue')
ax.text(5.05, 2.0, 'Emission-corrected', fontsize=22, color='green')
ax.plot([4.80], [2.08], 's', ms=12, color='green')

#leg = legend(loc='upper right', fontsize=22, frameon=False, numpoints=1)
#tmpcolors = ['blue', 'green']
#for color, legtext in zip(tmpcolors,leg.get_texts()):
#    legtext.set_color(color)

xlimits = [-1, 8]
ylimits = [0.25, 2.4]
ax.set_yscale('log')
ax.set_xlim(xlimits)
ax.set_ylim(ylimits)
ax.plot(xlimits,[1,1], ':', lw=2, color='gray')
ax.tick_params(axis='x', which='major', length=8, width=2, labelsize=22, pad=8)
ax.tick_params(axis='y', which='major', length=8, width=2, labelsize=22, pad=8)
ax.set_xticks(xx)
ax.set_xticklabels(names[indices], rotation=0, fontsize=22)
ytickpos = [0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 2.0]
yticknames = ['0.3', '0.4', '0.5', '0.6', '0.7', '0.8', '0.9', '1.0', '2.0']
ax.set_yticks(ytickpos)
ax.set_yticklabels(yticknames, fontsize=22)
#ylabel('Velocity (km/s)', fontsize=22)
#ylabel(r'Line Ratio $\frac{W_{\rm FeII}^{\lambda}}{W_{\rm FeII}^{\lambda2374}}$', fontsize=22)
ax.set_ylabel(r'$\left(\frac{W^{\lambda}}{W^{\lambda2374}}\right)^{\rm ELG}{/}\left(\frac{W^{\lambda}}{W^{\lambda2374}}\right)^{\rm QSOABS}$', fontsize=22)
ax.set_xlabel('Lines', fontsize=22)
ax.set_title('Comparison of Line Ratios of ELGs and QSOABSs', fontsize=22)

for i, index in enumerate(indices):
    ax.text(xx[i]-0.3, (observed_ratio/qso_ratio)[i]*0.85, names[index], fontsize=18)
    ax.text(xx[i]-0.3, (observed_ratio/qso_ratio)[i]*0.780, species_names[index], fontsize=18)
fig.savefig('/Users/Benjamin/Dropbox/Zhu_Projects/Fine Structure Emission/Version 2/Line_Ratio_QSO_Comparison.eps')



In [21]:
fig, ax = plt.subplots(figsize=(10,8), ncols=1, nrows=1)

lines = velmeasure['LINES']
indices = np.array([5, 6, 4, 7, 3, 0, 2, 1]) #to be ordered by FR
names = np.array([str(int(np.rint(lines[index]))) for index in np.arange(8)])
species_names = ['FeII', 'MgII', 'MgII', 'MgI', 'FeII', 'FeII', 'FeII', 'FeII']

observed_ratio = velmeasure['TFLUX'][indices]/velmeasure['TFLUX'][5]
tmp_observed_error = np.std(velmeasure_bstrap['TFLUX'], axis=1)
tmp_observed_ratio_error = np.sqrt(np.power(tmp_observed_error, 2)+ \
                               np.power(tmp_observed_error[5], 2)*np.power(velmeasure['TFLUX'], 2))/velmeasure['TFLUX'][5]
observed_ratio_error = tmp_observed_ratio_error[indices]

corrected_ratio = velmeasure['TFABS'][indices]/velmeasure['TFABS'][5]
tmp_corrected_error = np.std(velmeasure_bstrap['TFABS'], axis=1)
tmp_corrected_ratio_error = np.sqrt(np.power(tmp_corrected_error, 2)+ \
                               np.power(tmp_corrected_error[5], 2)*np.power(velmeasure['TFABS'], 2))/velmeasure['TFABS'][5]
corrected_ratio_error = tmp_corrected_ratio_error[indices]

star_ratio = rew_starburst['TFLUX'][indices]/rew_starburst['TFLUX'][5]

#velmeasure['TFABS'][5]
qso_ratio = rew_absorber['TFLUX'][indices]/rew_absorber['TFLUX'][5]

xx = np.arange(8)
ax.plot(xx, star_ratio/qso_ratio, 'o', ms=14, color='blue', label='Observed')
ax.errorbar(xx, star_ratio/qso_ratio, observed_ratio_error/qso_ratio*5., ms=15, color='blue', capsize=4, capthick=2)
#errorbar(xx, observed_ratio/qso_ratio, 0.04, ms=15, color='blue', capsize=4, capthick=2)
#ax.plot(xx, corrected_ratio/qso_ratio, 's', ms=12, color='green', label='Emission-corrected')
#ax.errorbar(xx, corrected_ratio/qso_ratio, corrected_ratio_error/qso_ratio, ms=15, color='green', capsize=4, capthick=2)

ax.text(5.05, 1.78, 'Observed', fontsize=22, color='blue')
ax.plot([4.80], [1.85], 'o', ms=14, color='blue')
#ax.text(5.05, 2.0, 'Emission-corrected', fontsize=22, color='green')
#ax.plot([4.80], [2.08], 's', ms=12, color='green')

#leg = legend(loc='upper right', fontsize=22, frameon=False, numpoints=1)
#tmpcolors = ['blue', 'green']
#for color, legtext in zip(tmpcolors,leg.get_texts()):
#    legtext.set_color(color)

xlimits = [-1, 8]
ylimits = [0.25, 2.4]
ax.set_yscale('log')
ax.set_xlim(xlimits)
ax.set_ylim(ylimits)
ax.plot(xlimits,[1,1], ':', lw=2, color='gray')
ax.tick_params(axis='x', which='major', length=8, width=2, labelsize=22, pad=8)
ax.tick_params(axis='y', which='major', length=8, width=2, labelsize=22, pad=8)
ax.set_xticks(xx)
ax.set_xticklabels(names[indices], rotation=0, fontsize=22)
ytickpos = [0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 2.0]
yticknames = ['0.3', '0.4', '0.5', '0.6', '0.7', '0.8', '0.9', '1.0', '2.0']
ax.set_yticks(ytickpos)
ax.set_yticklabels(yticknames, fontsize=22)
#ylabel('Velocity (km/s)', fontsize=22)
#ylabel(r'Line Ratio $\frac{W_{\rm FeII}^{\lambda}}{W_{\rm FeII}^{\lambda2374}}$', fontsize=22)
ax.set_ylabel(r'$\left(\frac{W^{\lambda}}{W^{\lambda2374}}\right)^{\rm Local\,SF}{/}\left(\frac{W^{\lambda}}{W^{\lambda2374}}\right)^{\rm QSOABS}$', fontsize=22)
ax.set_xlabel('Lines', fontsize=22)
ax.set_title('Comparison of Line Ratios of Local SF Regions and QSOABSs', fontsize=22)

for i, index in enumerate(indices):
    ax.text(xx[i]-0.3, (star_ratio/qso_ratio)[i]*0.825, names[index], fontsize=18)
    ax.text(xx[i]-0.3, (star_ratio/qso_ratio)[i]*0.755, species_names[index], fontsize=18)
fig.savefig('/Users/Benjamin/Dropbox/Zhu_Projects/Fine Structure Emission/Version 2/Line_Ratio_LocalSF_QSO_Comparison.eps')



In [19]:
fig, ax = plt.subplots(figsize=(10,8), ncols=1, nrows=1)

lines = velmeasure['LINES']
indices = np.array([5, 6, 4, 7, 3, 0, 2, 1]) #to be ordered by FR
names = np.array([str(int(np.rint(lines[index]))) for index in np.arange(8)])
species_names = ['FeII', 'MgII', 'MgII', 'MgI', 'FeII', 'FeII', 'FeII', 'FeII']

observed_ratio = velmeasure['TFLUX'][indices]/velmeasure['TFLUX'][5]
tmp_observed_error = np.std(velmeasure_bstrap['TFLUX'], axis=1)
tmp_observed_ratio_error = np.sqrt(np.power(tmp_observed_error, 2)+ \
                               np.power(tmp_observed_error[5], 2)*np.power(velmeasure['TFLUX'], 2))/velmeasure['TFLUX'][5]
observed_ratio_error = tmp_observed_ratio_error[indices]

corrected_ratio = velmeasure['TFABS'][indices]/velmeasure['TFABS'][5]
tmp_corrected_error = np.std(velmeasure_bstrap['TFABS'], axis=1)
tmp_corrected_ratio_error = np.sqrt(np.power(tmp_corrected_error, 2)+ \
                               np.power(tmp_corrected_error[5], 2)*np.power(velmeasure['TFABS'], 2))/velmeasure['TFABS'][5]
corrected_ratio_error = tmp_corrected_ratio_error[indices]


#velmeasure['TFABS'][5]
qso_ratio = rew_absorber['TFLUX'][indices]/rew_absorber['TFLUX'][5]

weakest_qso_ratio = rew_absorber_weakest['TFLUX'][indices]/rew_absorber_weakest['TFLUX'][5]
weaker_qso_ratio = rew_absorber_weaker['TFLUX'][indices]/rew_absorber_weaker['TFLUX'][5]
stronger_qso_ratio = rew_absorber_stronger['TFLUX'][indices]/rew_absorber_stronger['TFLUX'][5]
strongest_qso_ratio = rew_absorber_strongest['TFLUX'][indices]/rew_absorber_strongest['TFLUX'][5]


xx = np.arange(8)
ax.plot(xx, star_ratio/qso_ratio, 'o', ms=14, color='blue', label='Observed')
ax.errorbar(xx, star_ratio/qso_ratio, observed_ratio_error/qso_ratio*5., ms=15, color='blue', capsize=4, capthick=2)
#errorbar(xx, observed_ratio/qso_ratio, 0.04, ms=15, color='blue', capsize=4, capthick=2)
#ax.plot(xx, corrected_ratio/qso_ratio, 's', ms=12, color='green', label='Emission-corrected')
#ax.errorbar(xx, corrected_ratio/qso_ratio, corrected_ratio_error/qso_ratio, ms=15, color='green', capsize=4, capthick=2)

ax.text(5.05, 1.78, 'Observed', fontsize=22, color='blue')
ax.plot([4.80], [1.85], 'o', ms=14, color='blue')
#ax.text(5.05, 2.0, 'Emission-corrected', fontsize=22, color='green')
#ax.plot([4.80], [2.08], 's', ms=12, color='green')

#leg = legend(loc='upper right', fontsize=22, frameon=False, numpoints=1)
#tmpcolors = ['blue', 'green']
#for color, legtext in zip(tmpcolors,leg.get_texts()):
#    legtext.set_color(color)

xlimits = [-1, 8]
ylimits = [0.25, 2.4]
ax.set_yscale('log')
ax.set_xlim(xlimits)
ax.set_ylim(ylimits)
ax.plot(xlimits,[1,1], ':', lw=2, color='gray')
ax.tick_params(axis='x', which='major', length=8, width=2, labelsize=22, pad=8)
ax.tick_params(axis='y', which='major', length=8, width=2, labelsize=22, pad=8)
ax.set_xticks(xx)
ax.set_xticklabels(names[indices], rotation=0, fontsize=22)
ytickpos = [0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 2.0]
yticknames = ['0.3', '0.4', '0.5', '0.6', '0.7', '0.8', '0.9', '1.0', '2.0']
ax.set_yticks(ytickpos)
ax.set_yticklabels(yticknames, fontsize=22)
#ylabel('Velocity (km/s)', fontsize=22)
#ylabel(r'Line Ratio $\frac{W_{\rm FeII}^{\lambda}}{W_{\rm FeII}^{\lambda2374}}$', fontsize=22)
ax.set_ylabel(r'$\left(\frac{W^{\lambda}}{W^{\lambda2374}}\right)^{\rm Weak}{/}\left(\frac{W^{\lambda}}{W^{\lambda2374}}\right)^{\rm Strong}$', fontsize=22)
ax.set_xlabel('Lines', fontsize=22)
ax.set_title('Comparison of Line Ratios of Weak and Strong QSOABSs', fontsize=22)

for i, index in enumerate(indices):
    ax.text(xx[i]-0.3, (star_ratio/qso_ratio)[i]*0.825, names[index], fontsize=18)
    ax.text(xx[i]-0.3, (star_ratio/qso_ratio)[i]*0.755, species_names[index], fontsize=18)
fig.savefig('/Users/Benjamin/Dropbox/Zhu_Projects/Fine Structure Emission/Version 2/Line_Ratio_LocalSF_QSO_Comparison.eps')



In [117]:
fig, ax = plt.subplots(figsize=(10,8), ncols=1, nrows=1)

lines = velmeasure['LINES']
indices = np.array([5, 6, 4, 7, 3, 0, 2, 1]) #to be ordered by FR
names = np.array([str(int(np.rint(lines[index]))) for index in np.arange(8)])
species_names = ['FeII', 'MgII', 'MgII', 'MgI', 'FeII', 'FeII', 'FeII', 'FeII']

observed_ratio = velmeasure['TFLUX'][indices]/velmeasure['TFLUX'][5]
tmp_observed_error = np.std(velmeasure_bstrap['TFLUX'], axis=1)
tmp_observed_ratio_error = np.sqrt(np.power(tmp_observed_error, 2)+ \
                               np.power(tmp_observed_error[5], 2)*np.power(velmeasure['TFLUX'], 2))/velmeasure['TFLUX'][5]
observed_ratio_error = tmp_observed_ratio_error[indices]

corrected_ratio = velmeasure['TFABS'][indices]/velmeasure['TFABS'][5]
tmp_corrected_error = np.std(velmeasure_bstrap['TFABS'], axis=1)
tmp_corrected_ratio_error = np.sqrt(np.power(tmp_corrected_error, 2)+ \
                               np.power(tmp_corrected_error[5], 2)*np.power(velmeasure['TFABS'], 2))/velmeasure['TFABS'][5]
corrected_ratio_error = tmp_corrected_ratio_error[indices]

#velmeasure['TFABS'][5]
qso_ratio = rew_absorber['TFLUX'][indices]/rew_absorber['TFLUX'][5]

xx = np.arange(8)
ax.plot(xx, observed_ratio/qso_ratio, 'o', ms=14, color='blue', label='Observed')
ax.errorbar(xx, observed_ratio/qso_ratio, observed_ratio_error/qso_ratio, ms=15, color='blue', capsize=4, capthick=2)
#errorbar(xx, observed_ratio/qso_ratio, 0.04, ms=15, color='blue', capsize=4, capthick=2)
#ax.plot(xx, corrected_ratio/qso_ratio, 's', ms=12, color='green', label='Emission-corrected')
#ax.errorbar(xx, corrected_ratio/qso_ratio, corrected_ratio_error/qso_ratio, ms=15, color='green', capsize=4, capthick=2)

ax.text(5.05, 1.78, 'Observed', fontsize=22, color='blue')
ax.plot([4.80], [1.85], 'o', ms=14, color='blue')
#ax.text(5.05, 2.0, 'Emission-corrected', fontsize=22, color='green')
#ax.plot([4.80], [2.08], 's', ms=12, color='green')

#leg = legend(loc='upper right', fontsize=22, frameon=False, numpoints=1)
#tmpcolors = ['blue', 'green']
#for color, legtext in zip(tmpcolors,leg.get_texts()):
#    legtext.set_color(color)

xlimits = [-1, 8]
ylimits = [0.25, 2.4]
ax.set_yscale('log')
ax.set_xlim(xlimits)
ax.set_ylim(ylimits)
ax.plot(xlimits,[1,1], ':', lw=2, color='gray')
ax.tick_params(axis='x', which='major', length=8, width=2, labelsize=22, pad=8)
ax.tick_params(axis='y', which='major', length=8, width=2, labelsize=22, pad=8)
ax.set_xticks(xx)
ax.set_xticklabels(names[indices], rotation=0, fontsize=22)
ytickpos = [0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 2.0]
yticknames = ['0.3', '0.4', '0.5', '0.6', '0.7', '0.8', '0.9', '1.0', '2.0']
ax.set_yticks(ytickpos)
ax.set_yticklabels(yticknames, fontsize=22)
#ylabel('Velocity (km/s)', fontsize=22)
#ylabel(r'Line Ratio $\frac{W_{\rm FeII}^{\lambda}}{W_{\rm FeII}^{\lambda2374}}$', fontsize=22)
ax.set_ylabel(r'$\left(\frac{W^{\lambda}}{W^{\lambda2374}}\right)^{\rm ELG}{/}\left(\frac{W^{\lambda}}{W^{\lambda2374}}\right)^{\rm QSOABS}$', fontsize=22)
ax.set_xlabel('Lines', fontsize=22)
ax.set_title('Comparison of Line Ratios of ELGs and QSOABSs', fontsize=22)

for i, index in enumerate(indices):
    ax.text(xx[i]-0.3, (observed_ratio/qso_ratio)[i]*0.85, names[index], fontsize=18)
    ax.text(xx[i]-0.3, (observed_ratio/qso_ratio)[i]*0.780, species_names[index], fontsize=18)
#fig.savefig('/Users/Benjamin/Dropbox/Zhu_Projects/Fine Structure Emission/Version 1/Line_Ratio_QSO_Comparison.eps')



In [12]:
fig, ax = plt.subplots(figsize=(10,8), ncols=1, nrows=1)

lines = velmeasure['LINES']
indices = np.array([5, 6, 4, 7, 3, 0, 2, 1]) #to be ordered by FR
names = np.array([str(int(np.rint(lines[index]))) for index in np.arange(8)])
species_names = ['FeII', 'MgII', 'MgII', 'MgI', 'FeII', 'FeII', 'FeII', 'FeII']

observed_ratio = velmeasure['TFLUX'][indices]/velmeasure['TFLUX'][5]
tmp_observed_error = np.std(velmeasure_bstrap['TFLUX'], axis=1)
tmp_observed_ratio_error = np.sqrt(np.power(tmp_observed_error, 2)+ \
                               np.power(tmp_observed_error[5], 2)*np.power(velmeasure['TFLUX'], 2))/velmeasure['TFLUX'][5]
observed_ratio_error = tmp_observed_ratio_error[indices]

corrected_ratio = velmeasure['TFABS'][indices]/velmeasure['TFABS'][5]
tmp_corrected_error = np.std(velmeasure_bstrap['TFABS'], axis=1)
tmp_corrected_ratio_error = np.sqrt(np.power(tmp_corrected_error, 2)+ \
                               np.power(tmp_corrected_error[5], 2)*np.power(velmeasure['TFABS'], 2))/velmeasure['TFABS'][5]
corrected_ratio_error = tmp_corrected_ratio_error[indices]

#velmeasure['TFABS'][5]
star_ratio = rew_starburst['TFLUX'][indices]/rew_starburst['TFLUX'][5]

xx = np.arange(8)
ax.plot(xx, observed_ratio/star_ratio, 'o', ms=14, color='blue', label='Observed')
ax.errorbar(xx, observed_ratio/star_ratio, observed_ratio_error/qso_ratio, ms=15, color='blue', capsize=4, capthick=2)
#errorbar(xx, observed_ratio/star_ratio, 0.04, ms=15, color='blue', capsize=4, capthick=2)
ax.plot(xx, corrected_ratio/star_ratio, 's', ms=12, color='green', label='Emission-corrected')
ax.errorbar(xx, corrected_ratio/star_ratio, corrected_ratio_error/star_ratio, ms=15, color='green', capsize=4, capthick=2)

ax.text(5.05, 1.78, 'Observed', fontsize=22, color='blue')
ax.plot([4.80], [1.85], 'o', ms=14, color='blue')
ax.text(5.05, 2.0, 'Emission-corrected', fontsize=22, color='green')
ax.plot([4.80], [2.08], 's', ms=12, color='green')

#leg = legend(loc='upper right', fontsize=22, frameon=False, numpoints=1)
#tmpcolors = ['blue', 'green']
#for color, legtext in zip(tmpcolors,leg.get_texts()):
#    legtext.set_color(color)

xlimits = [-1, 8]
ylimits = [0.25, 2.4]
ax.set_yscale('log')
ax.set_xlim(xlimits)
ax.set_ylim(ylimits)
ax.plot(xlimits,[1,1], ':', lw=2, color='gray')
ax.tick_params(axis='x', which='major', length=8, width=2, labelsize=22, pad=8)
ax.tick_params(axis='y', which='major', length=8, width=2, labelsize=22, pad=8)
ax.set_xticks(xx)
ax.set_xticklabels(names[indices], rotation=0, fontsize=22)
ytickpos = [0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 2.0]
yticknames = ['0.3', '0.4', '0.5', '0.6', '0.7', '0.8', '0.9', '1.0', '2.0']
ax.set_yticks(ytickpos)
ax.set_yticklabels(yticknames, fontsize=22)
#ylabel('Velocity (km/s)', fontsize=22)
#ylabel(r'Line Ratio $\frac{W_{\rm FeII}^{\lambda}}{W_{\rm FeII}^{\lambda2374}}$', fontsize=22)
ax.set_ylabel(r'$\left(\frac{W^{\lambda}}{W^{\lambda2374}}\right)^{\rm ELG}{/}\left(\frac{W^{\lambda}}{W^{\lambda2374}}\right)^{\rm Local\,SF}$', fontsize=22)
ax.set_xlabel('Lines', fontsize=22)
ax.set_title('Comparison of Line Ratios of ELGs and Local SF Regions', fontsize=22)

for i, index in enumerate(indices):
    ax.text(xx[i]-0.3, (observed_ratio/star_ratio)[i]*0.85, names[index], fontsize=18)
    ax.text(xx[i]-0.3, (observed_ratio/star_ratio)[i]*0.780, species_names[index], fontsize=18)
fig.savefig('/Users/Benjamin/Dropbox/Zhu_Projects/Fine Structure Emission/Version 2/Line_Ratio_LSF_Comparison.eps')



In [115]:
fig, ax = plt.subplots(figsize=(10,8), ncols=1, nrows=1)

lines = velmeasure['LINES']
indices = np.array([5, 6, 4, 7, 3, 0, 2, 1]) #to be ordered by FR
names = np.array([str(int(np.rint(lines[index]))) for index in np.arange(8)])
species_names = ['FeII', 'MgII', 'MgII', 'MgI', 'FeII', 'FeII', 'FeII', 'FeII']

observed_ratio = velmeasure['TFLUX'][indices]/velmeasure['TFLUX'][5]
tmp_observed_error = np.std(velmeasure_bstrap['TFLUX'], axis=1)
tmp_observed_ratio_error = np.sqrt(np.power(tmp_observed_error, 2)+ \
                               np.power(tmp_observed_error[5], 2)*np.power(velmeasure['TFLUX'], 2))/velmeasure['TFLUX'][5]
observed_ratio_error = tmp_observed_ratio_error[indices]

corrected_ratio = velmeasure['TFABS'][indices]/velmeasure['TFABS'][5]
tmp_corrected_error = np.std(velmeasure_bstrap['TFABS'], axis=1)
tmp_corrected_ratio_error = np.sqrt(np.power(tmp_corrected_error, 2)+ \
                               np.power(tmp_corrected_error[5], 2)*np.power(velmeasure['TFABS'], 2))/velmeasure['TFABS'][5]
corrected_ratio_error = tmp_corrected_ratio_error[indices]

#velmeasure['TFABS'][5]
star_ratio = rew_starburst['TFLUX'][indices]/rew_starburst['TFLUX'][5]

xx = np.arange(8)
ax.plot(xx, observed_ratio/star_ratio, 'o', ms=14, color='blue', label='Observed')
ax.errorbar(xx, observed_ratio/star_ratio, observed_ratio_error/qso_ratio, ms=15, color='blue', capsize=4, capthick=2)
#errorbar(xx, observed_ratio/star_ratio, 0.04, ms=15, color='blue', capsize=4, capthick=2)
#ax.plot(xx, corrected_ratio/star_ratio, 's', ms=12, color='green', label='Emission-corrected')
#ax.errorbar(xx, corrected_ratio/star_ratio, corrected_ratio_error/star_ratio, ms=15, color='green', capsize=4, capthick=2)

ax.text(5.05, 1.78, 'Observed', fontsize=22, color='blue')
ax.plot([4.80], [1.85], 'o', ms=14, color='blue')
#ax.text(5.05, 2.0, 'Emission-corrected', fontsize=22, color='green')
#ax.plot([4.80], [2.08], 's', ms=12, color='green')

#leg = legend(loc='upper right', fontsize=22, frameon=False, numpoints=1)
#tmpcolors = ['blue', 'green']
#for color, legtext in zip(tmpcolors,leg.get_texts()):
#    legtext.set_color(color)

xlimits = [-1, 8]
ylimits = [0.25, 2.4]
ax.set_yscale('log')
ax.set_xlim(xlimits)
ax.set_ylim(ylimits)
ax.plot(xlimits,[1,1], ':', lw=2, color='gray')
ax.tick_params(axis='x', which='major', length=8, width=2, labelsize=22, pad=8)
ax.tick_params(axis='y', which='major', length=8, width=2, labelsize=22, pad=8)
ax.set_xticks(xx)
ax.set_xticklabels(names[indices], rotation=0, fontsize=22)
ytickpos = [0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 2.0]
yticknames = ['0.3', '0.4', '0.5', '0.6', '0.7', '0.8', '0.9', '1.0', '2.0']
ax.set_yticks(ytickpos)
ax.set_yticklabels(yticknames, fontsize=22)
#ylabel('Velocity (km/s)', fontsize=22)
#ylabel(r'Line Ratio $\frac{W_{\rm FeII}^{\lambda}}{W_{\rm FeII}^{\lambda2374}}$', fontsize=22)
ax.set_ylabel(r'$\left(\frac{W^{\lambda}}{W^{\lambda2374}}\right)^{\rm ELG}{/}\left(\frac{W^{\lambda}}{W^{\lambda2374}}\right)^{\rm Local\,SF}$', fontsize=22)
ax.set_xlabel('Lines', fontsize=22)
ax.set_title('Comparison of Line Ratios of ELGs and Local SF Regions', fontsize=22)

for i, index in enumerate(indices):
    ax.text(xx[i]-0.3, (observed_ratio/star_ratio)[i]*0.85, names[index], fontsize=18)
    ax.text(xx[i]-0.3, (observed_ratio/star_ratio)[i]*0.780, species_names[index], fontsize=18)
#fig.savefig('/Users/Benjamin/Dropbox/Zhu_Projects/Fine Structure Emission/Version 1/Line_Ratio_LSF_Comparison.eps')



In [62]:
absorption_bstrap.dtype


Out[62]:
dtype([('LINES', '>f8', (8,)), ('VEL', '>f8', (200,)), ('FLUX', '>f8', (8, 200, 500)), ('FABS', '>f8', (8, 200, 500)), ('NORMFABS', '>f8', (8, 200)), ('FNORM', '>f8', (8,)), ('INDEX', '>i4', (8,)), ('UNIFIEDABSORPTION', '>f8', (200, 500)), ('UNIFIEDEMISSION', '>f8', (200, 500)), ('COEFF', '>f8', (8, 2, 500)), ('FABS_2374', '>f8', (200, 500))])

In [63]:
emission_bstrap.dtype


Out[63]:
dtype([('LINES', '>f8', (4,)), ('VEL', '>f8', (200,)), ('FLUX', '>f8', (4, 200, 500)), ('NORMFLUX', '>f8', (4, 200, 500)), ('FNORM', '>f8', (4, 500)), ('INDEX', '>i4', (3,)), ('UNIFIEDFLUX', '>f8', (200, 500))])

In [78]:
yerr = median(absorption_error[noffset-10:noffset+10])*sqrt(2)
print yerr


0.0048251442501

In [109]:
corrected_bstrap.dtype


Out[109]:
dtype([('LINES', '>f8', (12,)), ('VEL', '>f8', (200,)), ('FLUX', '>f8', (12, 200))])

In [122]:
velmeasure_bstrap.dtype


Out[122]:
dtype([('LINES', '<f8', (8,)), ('PERCENT', '<f8', (17,)), ('FLUX_PERCENT', '<f8', (17, 8, 500)), ('FABS_PERCENT', '<f8', (17, 8, 500)), ('UNIFIEDPERCENT', '<f8', (17, 500)), ('TFLUX', '<f8', (8, 500)), ('TFABS', '<f8', (8, 500))])

In [123]:
velmeasure.dtype


Out[123]:
dtype([('LINES', '<f8', (8,)), ('PERCENT', '<f8', (17,)), ('FLUX_PERCENT', '<f8', (17, 8)), ('FABS_PERCENT', '<f8', (17, 8)), ('UNIFIEDPERCENT', '<f8', (17,)), ('TFLUX', '<f8', (8,)), ('TFABS', '<f8', (8,))])

In [148]:
median(v50_error)


Out[148]:
5.2339019076103215

In [175]:
absorption['LINES']


Out[175]:
array([ 2382.764,  2796.352,  2803.531,  2852.964,  2344.213,  2374.46 ,
        2586.649,  2600.172])

In [324]:
print velmeasure['TFLUX']/velmeasure['TFLUX'][5]
print velmeasure['TFABS']/velmeasure['TFABS'][5]
print rew_absorber['TFLUX']/rew_absorber['TFLUX'][5]


[ 1.10603182  1.43243796  1.5073532   0.60605569  1.41937127  1.          1.5018492
  1.76430634]
[ 1.83326946  3.35935246  3.76306501  1.17275494  1.76549976  1.
  1.78544797  2.54935648]
[ 2.8997509   6.03958586  4.99596029  1.04939127  1.8756696   1.
  1.60450511  2.84453704]

In [357]:
text = plt.text

In [362]:
velmeasure_bstrap.dtype


Out[362]:
dtype([('LINES', '<f8', (8,)), ('PERCENT', '<f8', (17,)), ('FLUX_PERCENT', '<f8', (17, 8, 500)), ('FABS_PERCENT', '<f8', (17, 8, 500)), ('UNIFIEDPERCENT', '<f8', (17, 500)), ('TFLUX', '<f8', (8, 500)), ('TFABS', '<f8', (8, 500))])

In [379]:
print observed_error/qso_ratio
print corrected_error


[ 0.0520354   0.03297052  0.02732884  0.01668433  0.01916419  0.0488368
  0.00848401  0.00807544]
[ 0.28460886  0.2319517   0.32865126  0.23787595  0.24440917  0.04961516
  0.24267338  0.31246254]

In [382]:
print observed_ratio_error
print corrected_ratio_error


[ 0.05750554  0.07345122  0.07456909  0.08599531  0.0615849   0.04310993
  0.07644353  0.07409473]
[ 0.05545621  0.1879503   0.18872571  0.24658592  0.21610284  0.17558304
  0.28306536  0.21844245]

In [442]:
ewvelflux[0]['LINES']


Out[442]:
array([ 2382.764,  2796.352,  2803.531,  2852.964,  2344.213,  2374.46 ,
        2586.649,  2600.172,  2365.55 ,  2396.355,  2612.653,  2626.45 ])

In [38]:
rewmin = 0.8
print '{0:3.1f}AA'.format(rewmin)


0.8AA

In [55]:
reload(ebossanalysis)


Out[55]:
<module 'ebossanalysis' from 'ebossanalysis.py'>

In [51]:
test = ebossanalysis.stack_absorber_readin(rew=True)

In [52]:
rew_absorber.dtype


Out[52]:
dtype([('LINES', '>f8', (8,)), ('TFLUX', '>f8', (8,))])

In [53]:
test.dtype


Out[53]:
dtype([('LINES', '>f8', (8,)), ('TFLUX', '>f8', (8,))])

In [60]:
ebossanalysis.absorber_measure(mgiirewmin=0.4, mgiirewmax=0.8)

In [59]:
ebossanalysis.absorber_measure(mgiirewmin=4.0, mgiirewmax=8.0)

In [61]:
rew_absorber_weakest = ebossanalysis.stack_absorber_readin(rew=True, mgiirewmin=0.4, mgiirewmax=0.8)
rew_absorber_weaker = ebossanalysis.stack_absorber_readin(rew=True, mgiirewmin=0.8, mgiirewmax=1.2)
rew_absorber_stronger = ebossanalysis.stack_absorber_readin(rew=True, mgiirewmin=3.0, mgiirewmax=8.0)
rew_absorber_strongest = ebossanalysis.stack_absorber_readin(rew=True, mgiirewmin=4.0, mgiirewmax=8.0)

In [ ]: