In [1]:
import datapath
import fitsio
data = fitsio.read('/Users/Benjamin/AstroData/SDSS/eBOSS/stack_goodSel_13801.fits', ext=1)
figure(figsize=(10,6))
plot(data['lambda']+0.585, data['fluxMedian'], drawstyle='steps')
xlim(2580, 2630)
ylim(0.05,0.25)
plot([2586.65, 2586.65], [0.05, 0.25], 'g')
plot([2600.17, 2600.17], [0.05, 0.25], 'g')
plot([2626.45, 2626.45], [0.05, 0.25], 'r')
plot([2612.65, 2612.65], [0.05, 0.25], 'r')

In [2]:
datapath.sdss_path()


Out[2]:
'/Users/Benjamin/AstroData/SDSS'

In [3]:
import fitsio

In [4]:
data = fitsio.read('/Users/Benjamin/AstroData/SDSS/eBOSS/stack_goodSel_13801.fits')

In [5]:
data.dtype.fields

In [6]:
data.dtype


Out[6]:
dtype('uint8')

In [7]:
data = fitsio.read('/Users/Benjamin/AstroData/SDSS/eBOSS/stack_goodSel_13801.fits', ext=2)


---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-7-e24964f46f18> in <module>()
----> 1 data = fitsio.read('/Users/Benjamin/AstroData/SDSS/eBOSS/stack_goodSel_13801.fits', ext=2)

/Users/Benjamin/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/fitsio/fitslib.pyc in read(filename, ext, extver, **keys)
    101         item=_make_item(ext, extver=extver)
    102 
--> 103         data = fits[item].read(**keys)
    104         if header:
    105             h = fits[item].read_header()

/Users/Benjamin/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/fitsio/fitslib.pyc in __getitem__(self, item)
    933             else:
    934                 if ext not in self.hdu_map:
--> 935                     raise ValueError("extension not found: %s %s" % (ext,mess))
    936                 hdu = self.hdu_map[ext]
    937 

ValueError: extension not found: 2 (case insensitive)

In [68]:
data = fitsio.read('/Users/Benjamin/AstroData/SDSS/eBOSS/stack_goodSel_13801.fits', ext=1)

In [9]:
data.dtype


Out[9]:
dtype([('lambda', '>f8'), ('fluxMedian', '>f8'), ('Nspectra', '>f8')])

In [10]:
data.shape


Out[10]:
(8451,)

In [69]:
figure(figsize=(10,6))
plot(data['lambda']+0.585, data['fluxMedian'], drawstyle='steps')
xlim(2790, 2830)
ylim(0.05,0.25)
plot([2796.65, 2796.65], [0.05, 0.25], 'g')
plot([2803.17, 2803.17], [0.05, 0.25], 'g')
plot([2626.45, 2626.45], [0.05, 0.25], 'r')
plot([2612.65, 2612.65], [0.05, 0.25], 'r')


Out[69]:
[<matplotlib.lines.Line2D at 0x22ed75710>]

In [33]:
figure(figsize=(10,6))
plot(data['lambda']+0.585, data['fluxMedian'], drawstyle='steps')
xlim(2580, 2630)
ylim(0.05,0.25)
plot([2586.65, 2586.65], [0.05, 0.25], 'g')
plot([2600.17, 2600.17], [0.05, 0.25], 'g')
plot([2626.45, 2626.45], [0.05, 0.25], 'r')
plot([2612.65, 2612.65], [0.05, 0.25], 'r')


Out[33]:
[<matplotlib.lines.Line2D at 0x109d82550>]

In [32]:
figure(figsize=(10,6))
plot(data['lambda']+0.57, data['fluxMedian'], drawstyle='steps')
xlim(2335, 2410)
ylim(0.05,0.25)
plot([2344.21, 2344.21], [0.05, 0.25], 'g')
plot([2374.46, 2374.46], [0.05, 0.25], 'g')
plot([2382.77, 2382.77], [0.05, 0.25], 'g')
plot([2365.55, 2365.55], [0.05, 0.25], 'r')
plot([2396.35, 2396.35], [0.05, 0.25], 'r')


Out[32]:
[<matplotlib.lines.Line2D at 0x109d23750>]

In [25]:
figure(figsize=(10,6))
plot(arange(10), arange(10), drawstyle='steps')


Out[25]:
[<matplotlib.lines.Line2D at 0x1090aeb50>]

In [27]:
wave = data['lambda']
tmp = wave[(wave>2500) & (wave<2600)]

In [28]:
tmp


Out[28]:
array([ 2500.29503833,  2500.87081883,  2501.44673192,  2502.02277763,
        2502.598956  ,  2503.17526705,  2503.75171082,  2504.32828733,
        2504.90499663,  2505.48183873,  2506.05881366,  2506.63592147,
        2507.21316217,  2507.79053581,  2508.36804241,  2508.94568199,
        2509.5234546 ,  2510.10136026,  2510.67939901,  2511.25757086,
        2511.83587587,  2512.41431404,  2512.99288543,  2513.57159004,
        2514.15042793,  2514.72939911,  2515.30850363,  2515.8877415 ,
        2516.46711276,  2517.04661744,  2517.62625557,  2518.20602719,
        2518.78593231,  2519.36597098,  2519.94614323,  2520.52644908,
        2521.10688857,  2521.68746172,  2522.26816857,  2522.84900915,
        2523.42998348,  2524.01109161,  2524.59233356,  2525.17370935,
        2525.75521903,  2526.33686263,  2526.91864016,  2527.50055168,
        2528.08259719,  2528.66477675,  2529.24709037,  2529.82953809,
        2530.41211993,  2530.99483594,  2531.57768614,  2532.16067056,
        2532.74378923,  2533.32704219,  2533.91042946,  2534.49395108,
        2535.07760707,  2535.66139747,  2536.24532231,  2536.82938161,
        2537.41357542,  2537.99790376,  2538.58236666,  2539.16696415,
        2539.75169627,  2540.33656304,  2540.9215645 ,  2541.50670067,
        2542.0919716 ,  2542.6773773 ,  2543.26291781,  2543.84859317,
        2544.43440339,  2545.02034852,  2545.60642859,  2546.19264362,
        2546.77899364,  2547.3654787 ,  2547.95209881,  2548.53885401,
        2549.12574433,  2549.71276981,  2550.29993047,  2550.88722634,
        2551.47465746,  2552.06222385,  2552.64992555,  2553.2377626 ,
        2553.82573501,  2554.41384282,  2555.00208606,  2555.59046477,
        2556.17897898,  2556.76762871,  2557.35641399,  2557.94533487,
        2558.53439136,  2559.12358351,  2559.71291134,  2560.30237488,
        2560.89197416,  2561.48170922,  2562.07158009,  2562.6615868 ,
        2563.25172938,  2563.84200785,  2564.43242226,  2565.02297264,
        2565.61365901,  2566.2044814 ,  2566.79543985,  2567.3865344 ,
        2567.97776506,  2568.56913187,  2569.16063487,  2569.75227408,
        2570.34404953,  2570.93596127,  2571.52800931,  2572.12019369,
        2572.71251444,  2573.3049716 ,  2573.89756518,  2574.49029524,
        2575.08316179,  2575.67616487,  2576.26930451,  2576.86258074,
        2577.45599359,  2578.0495431 ,  2578.64322929,  2579.2370522 ,
        2579.83101186,  2580.4251083 ,  2581.01934155,  2581.61371164,
        2582.20821861,  2582.80286248,  2583.39764329,  2583.99256107,
        2584.58761585,  2585.18280767,  2585.77813654,  2586.37360252,
        2586.96920561,  2587.56494587,  2588.16082332,  2588.75683799,
        2589.35298991,  2589.94927912,  2590.54570564,  2591.14226951,
        2591.73897076,  2592.33580943,  2592.93278553,  2593.52989911,
        2594.1271502 ,  2594.72453883,  2595.32206502,  2595.91972882,
        2596.51753024,  2597.11546934,  2597.71354613,  2598.31176065,
        2598.91011292,  2599.50860299])

In [29]:
tmp[1:]-tmp[:-1]


Out[29]:
array([ 0.57578049,  0.57591309,  0.57604571,  0.57617837,  0.57631105,
        0.57644377,  0.57657651,  0.57670929,  0.5768421 ,  0.57697494,
        0.57710781,  0.57724071,  0.57737364,  0.5775066 ,  0.57763959,
        0.57777261,  0.57790566,  0.57803874,  0.57817186,  0.578305  ,
        0.57843818,  0.57857138,  0.57870462,  0.57883789,  0.57897118,
        0.57910451,  0.57923787,  0.57937126,  0.57950468,  0.57963813,
        0.57977161,  0.57990513,  0.58003867,  0.58017225,  0.58030585,
        0.58043949,  0.58057315,  0.58070685,  0.58084058,  0.58097434,
        0.58110813,  0.58124195,  0.5813758 ,  0.58150968,  0.58164359,
        0.58177754,  0.58191151,  0.58204552,  0.58217955,  0.58231362,
        0.58244772,  0.58258185,  0.58271601,  0.5828502 ,  0.58298442,
        0.58311867,  0.58325296,  0.58338727,  0.58352162,  0.58365599,
        0.5837904 ,  0.58392484,  0.58405931,  0.58419381,  0.58432834,
        0.5844629 ,  0.58459749,  0.58473212,  0.58486677,  0.58500146,
        0.58513618,  0.58527092,  0.5854057 ,  0.58554051,  0.58567535,
        0.58581023,  0.58594513,  0.58608006,  0.58621503,  0.58635003,
        0.58648505,  0.58662011,  0.5867552 ,  0.58689032,  0.58702548,
        0.58716066,  0.58729587,  0.58743112,  0.58756639,  0.5877017 ,
        0.58783704,  0.58797241,  0.58810781,  0.58824324,  0.58837871,
        0.5885142 ,  0.58864973,  0.58878529,  0.58892088,  0.58905649,
        0.58919215,  0.58932783,  0.58946354,  0.58959929,  0.58973506,
        0.58987087,  0.59000671,  0.59014258,  0.59027848,  0.59041441,
        0.59055037,  0.59068637,  0.59082239,  0.59095845,  0.59109454,
        0.59123066,  0.59136681,  0.591503  ,  0.59163921,  0.59177546,
        0.59191173,  0.59204804,  0.59218438,  0.59232075,  0.59245715,
        0.59259359,  0.59273005,  0.59286655,  0.59300308,  0.59313964,
        0.59327623,  0.59341285,  0.59354951,  0.59368619,  0.59382291,
        0.59395966,  0.59409644,  0.59423325,  0.59437009,  0.59450697,
        0.59464387,  0.59478081,  0.59491778,  0.59505478,  0.59519181,
        0.59532888,  0.59546597,  0.5956031 ,  0.59574026,  0.59587745,
        0.59601467,  0.59615192,  0.59628921,  0.59642652,  0.59656387,
        0.59670125,  0.59683866,  0.59697611,  0.59711358,  0.59725109,
        0.59738862,  0.59752619,  0.5976638 ,  0.59780143,  0.59793909,
        0.59807679,  0.59821452,  0.59835228,  0.59849007])

In [36]:
figure(figsize=(20,6))
plot(data['lambda']+0.6, data['fluxMedian'], drawstyle='steps')
xlim(2000, 7500)
ylim(0.07,2)
yscale('log')



In [1]:
import datapath
import fitsio
data = fitsio.read('/Users/Benjamin/AstroData/SDSS/eBOSS/stack_goodSel_13801.fits', ext=1)

In [6]:
figure(figsize=(10,6))
plot(data['lambda']+0.585, data['fluxMedian'], drawstyle='steps')
xlim(4310, 4430)
ylim(0.15,0.45)
plot([4341, 4341], [0.15, 0.45], 'g')
plot([4363, 4363], [0.15, 0.45], 'r')


Out[6]:
[<matplotlib.lines.Line2D at 0x108ae9850>]

In [13]:
figure(figsize=(10,6))
plot(data['lambda']+0.585, data['fluxMedian'], drawstyle='steps')
xlim(2580, 2630)
ylim(0.05,0.25)
plot([2586.65, 2586.65], [0.05, 0.25], 'g')
plot([2600.17, 2600.17], [0.05, 0.25], 'g')
plot([2626.45, 2626.45], [0.05, 0.25], 'r')
plot([2612.65, 2612.65], [0.05, 0.25], 'r')
text(2586.65+0.5, 0.22, 'Fe II', color='green')
text(2600.17+0.5, 0.22, 'Fe II', color='green')
text(2626.45+0.5, 0.07, 'Fe II*', color='red')
text(2612.65+0.5, 0.07, 'Fe II*', color='red')


Out[13]:
<matplotlib.text.Text at 0x10a31d990>

In [14]:
figure(figsize=(10,6))
plot(data['lambda']+0.57, data['fluxMedian'], drawstyle='steps')
xlim(2335, 2410)
ylim(0.05,0.25)
plot([2344.21, 2344.21], [0.05, 0.25], 'g')
plot([2374.46, 2374.46], [0.05, 0.25], 'g')
plot([2382.77, 2382.77], [0.05, 0.25], 'g')
plot([2365.55, 2365.55], [0.05, 0.25], 'r')
plot([2396.35, 2396.35], [0.05, 0.25], 'r')
text(2344.21+0.5, 0.22, 'Fe II', color='green')
text(2374.46+0.5, 0.22, 'Fe II', color='green')
text(2382.77+0.5, 0.22, 'Fe II', color='green')
text(2365.55+0.5, 0.07, 'Fe II*', color='red')
text(2396.35+0.5, 0.07, 'Fe II*', color='red')


Out[14]:
<matplotlib.text.Text at 0x10a482790>

In [41]:
import datapath
import fitsio
data = fitsio.read('/Users/Benjamin/AstroData/SDSS/eBOSS/spAll-ELG-v5.4-zQ.fits', ext=1)

In [42]:
data.size


Out[42]:
21528

In [18]:
'PLUG_RA' in data.dtype.fields


Out[18]:
True

In [30]:
import ebossspec

In [33]:
reload(ebossspec.sdssspec)
ebossspec.rest_allspec()


Will write into these files: /Users/Benjamin/AstroData/AllInOne/AIO_ELG_eBOSS_SDSSRestFrame_Wave01800_03600A.fits
Will write into these files: /Users/Benjamin/AstroData/AllInOne/AIO_ELG_eBOSS_SDSSRestFrame_Wave03600_07200A.fits
/Users/Benjamin/AstroData/SDSS/v5_7_6/spPlate-8124-56954.fits
  0% |                                                                        |
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-33-49d185a0439c> in <module>()
      1 reload(ebossspec.sdssspec)
----> 2 ebossspec.rest_allspec()

/Users/Benjamin/Code/BGT-Cosmology/Spectroscopy/ebossspec.pyc in rest_allspec(overwrite)
     99         # read and interpolate
    100         #try:
--> 101         tmp_outflux, tmp_outivar = sdssspec.load_interp_spec(objs[i], tmp_loglam, path, rest=True)
    102         #except (IndexError, TypeError, NameError, ValueError):
    103         #       raise ValueError("Something went wrong while working on obj {0}".format(i))

/Users/Benjamin/Code/BGT-Cosmology/Spectroscopy/sdssspec.py in load_interp_spec(objs, newloglam, path, rest)
     97         influx = thisdata['flux']*(1.+tmpz)
     98         inivar = thisdata['ivar']/np.power(1.+tmpz, 2)
---> 99         (flux[iobj, :], ivar[iobj, :]) = specutils.interpol_spec(inloglam, influx, inivar, newloglam)
    100     if objs.size == 1:
    101        flux = np.ravel(flux)

/Users/Benjamin/Code/BGT-Cosmology/Spectroscopy/specutils.py in interpol_spec(inloglam, influx, inivar, newloglam)
     90     tmpflux = influx[inivar>0]
     91     f = interp1d(tmploglam, tmpflux, kind='cubic')
---> 92     newflux[inbetween] = f(newloglam[inbetween])
     93 
     94     # Linear

/Users/Benjamin/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/scipy/interpolate/polyint.pyc in __call__(self, x)
     77         """
     78         x, x_shape = self._prepare_x(x)
---> 79         y = self._evaluate(x)
     80         return self._finish_y(y, x_shape)
     81 

/Users/Benjamin/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/scipy/interpolate/interpolate.pyc in _evaluate(self, x_new)
    475         #    The behavior is set by the bounds_error variable.
    476         x_new = asarray(x_new)
--> 477         out_of_bounds = self._check_bounds(x_new)
    478         y_new = self._call(self, x_new)
    479         if len(y_new) > 0:

/Users/Benjamin/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/scipy/interpolate/interpolate.pyc in _check_bounds(self, x_new)
    505                 "range.")
    506         if self.bounds_error and above_bounds.any():
--> 507             raise ValueError("A value in x_new is above the interpolation "
    508                 "range.")
    509 

ValueError: A value in x_new is above the interpolation range.

In [45]:
data1.size


Out[45]:
21528

In [16]:
objs_dtype = [('PLATE', 'i4'),
             ('MJD', 'i4'),
             ('FIBER', 'i4'),
             ('Z', 'f8')]
objs = np.zeros(nobj, dtype=objs_dtype)

In [2]:
30000.*10000.*32./1024./1024./1024.


Out[2]:
8.940696716308594

In [1]:
import ebossspec, sdssspec, datapath, fitsio
import cookb_signalsmooth as cbs

In [2]:
masterwave, allflux, allivar = ebossspec.rest_allspec_readin()


Reading /Users/Benjamin/AstroData/AllInOne/AIO_ELG_eBOSS_SDSSRestFrame_Wave01800_03600A.fits.
Reading /Users/Benjamin/AstroData/AllInOne/AIO_ELG_eBOSS_SDSSRestFrame_Wave03600_07200A.fits.

In [3]:
objs_ori = ebossspec.elg_readin()
nobj = objs_ori.size

In [9]:
path = datapath.sdss_path()+'/v5_7_6'

In [38]:
i = 6
platein = objs_ori[i]['PLATE_1']
fiberin = objs_ori[i]['FIBERID_1']
mjdin = objs_ori[i]['MJD']
output = ('loglam', 'flux', 'ivar',)
thisdata = sdssspec.read_spec(platein, mjdin, fiberin, path, output)

In [39]:
figure(figsize=(10,6))
plot(power(10., thisdata['loglam']), cbs.smooth(thisdata['flux'], window_len=30), 'b')
plot(masterwave*(1.+objs_ori[i]['Z']), cbs.smooth(allflux[:,i]/(1.+objs_ori[i]['Z']), window_len=30), 'r')
xlim(3600, 10400); ylim(-1, 5)


Out[39]:
(-1, 5)

In [37]:
figure(figsize=(10,6))
plot(power(10., thisdata['loglam']), cbs.smooth(thisdata['ivar'], window_len=30), 'b')
plot(masterwave*(1.+objs_ori[i]['Z']), cbs.smooth(allivar[:,i]*(1.+objs_ori[i]['Z'])**2, window_len=30), 'r')
xlim(3600, 10400); ylim(-1, 20)
print(objs_ori[i]['Z'], (1.+objs_ori[i]['Z'])*1800., (1.+objs_ori[i]['Z'])*3727.)


(1.4994594, 4499.026894569397, 9315.4851311445236)

In [44]:
ii = (where(objs_ori['PLATE_1']==7247))[0]
objs_ori[ii]['FIBERID_1'].shape


Out[44]:
(900,)

In [68]:
platein = objs_ori[0]['PLATE_1']
fiberin = objs_ori[0]['FIBERID_1']
fiberin = [2, 3]
mjdin = objs_ori[0]['MJD']
output = ('loglam', 'flux', 'ivar',)
thisdata = sdssspec.read_spec(platein, mjdin, fiberin, path, output)


/Users/Benjamin/AstroData/SDSS/v5_7_6/spPlate-8124-56954.fits

In [20]:
import fitsio
filename =  '/Users/Benjamin/AstroData/SDSS/v5_7_6/spPlate-8124-56954.fits'
data = fitsio.read(filename, rows=[1,11], ext=1)
print(data.shape) # This gives (1000, 4653) but not (2, 4653) as I want

fits = fitsio.FITS(filename)
data = fits[1].read(rows=[1,11], ext=1)
print(data.shape)

data = fits[1][1:11,:]
print(data.shape)


(1000, 4653)
(1000, 4653)
(10, 4653)

In [28]:
fiber = array([30, 40, 50])
data = (fits[1].read())[fiber, :]
data.shape


Out[28]:
(3, 4653)

In [4]:
index_wave = searchsorted(masterwave, [2300., 4001.])

In [19]:
ii = (where(logical_and(logical_and(allivar[index_wave[0], :]>0, allivar[index_wave[1], :]>0), objs_ori['zGOOD']==1)))[0]

In [20]:
ii.shape


Out[20]:
(4849,)

In [21]:
xx = allflux[index_wave[0]:index_wave[1], ii]

In [22]:
from scipy.stats import nanmean, nanmedian
import cosmology as cosmo

In [61]:
xmean = nanmean(xx,1)

In [53]:
xmean.shape


Out[53]:
(2042,)

In [54]:
xx.shape


Out[54]:
(2042, 7209)

In [72]:
figure(figsize=(10,6))
plot(masterwave[index_wave[0]:index_wave[1]], xmean, drawstyle='steps')
xlim(2750, 2860); ylim(0.2,0.55)


Out[72]:
(0.2, 0.55)

In [8]:
index_oii = searchsorted(masterwave, 3727.)
index_oii


Out[8]:
9201

In [82]:
oiisum = sum(allflux[index_oii-10:index_oii+10, ii], axis=0)
oiilum = oiisum*power(cosmo.luminosity_distance(objs_ori[ii]['Z']), 2)
oii_left = sum(allflux[index_oii-25:index_oii-15, ii], axis=0)
oii_right = sum(allflux[index_oii+15:index_oii+25, ii], axis=0)
oii_ew = oiisum/(oii_left+oii_right)*2.

In [85]:
figure(figsize=(10,6))
plot(objs_ori[ii]['Z'], oii_ew, '.')


Out[85]:
[<matplotlib.lines.Line2D at 0x24eaac550>]

In [86]:
sort_index = argsort(oii_ew)

In [87]:
xmean1 = nanmean(xx[:,sort_index[100:2000]], 1)
xmean2 = nanmean(xx[:,sort_index[1000:3000]], 1)
xmean3 = nanmean(xx[:,sort_index[2000:4000]], 1)
xmean4 = nanmean(xx[:,sort_index[3000:4000]], 1)
xmean5 = nanmean(xx[:,sort_index[4000:-100]], 1)
xmean = nanmean(xx, 1)

In [90]:
figure(figsize=(10,6))
plot(masterwave[index_wave[0]:index_wave[1]]+0.5, xmean5, 'b', drawstyle='steps')
xlim(2580, 2635); ylim(0.1,1.1)
plot(masterwave[index_wave[0]:index_wave[1]]+0.5, xmean1, 'r', drawstyle='steps')
#plot(masterwave[index_wave[0]:index_wave[1]]+0.5, xmean*1.8, 'g', drawstyle='steps')
plot([2586.65, 2586.65], [0.0, 1.25], 'g')
plot([2600.17, 2600.17], [0.0, 1.25], 'g')
plot([2626.45, 2626.45], [0.0, 1.25], 'r')
plot([2612.65, 2612.65], [0.0, 1.25], 'r')
text(2586.65+0.5, 1.15, 'Fe II', color='green')
text(2600.17+0.5, 1.15, 'Fe II', color='green')
text(2626.45+0.5, 0.07, 'Fe II*', color='red')
text(2612.65+0.5, 0.07, 'Fe II*', color='red')


Out[90]:
<matplotlib.text.Text at 0x251106d90>

In [98]:
figure(figsize=(10,6))
plot(masterwave[index_wave[0]:index_wave[1]]+0.6, xmean5, 'b', drawstyle='steps')
xlim(3680, 3780); ylim(0.,3.5)
plot(masterwave[index_wave[0]:index_wave[1]]+0.6, xmean1*0.5, 'r', drawstyle='steps')
plot(masterwave[index_wave[0]:index_wave[1]]+0.6, xmean*0.6, 'g', drawstyle='steps')
plot([ 3727.092,  3727.092], [0.0, 3.5], 'k')
plot([3729.875, 3729.875], [0.0, 3.5], 'k')


Out[98]:
[<matplotlib.lines.Line2D at 0x251cad710>]

In [105]:
figure(figsize=(10,6))
plot(masterwave[index_wave[0]:index_wave[1]]+0.6, xmean5, 'b', drawstyle='steps')
xlim(2750, 2850); ylim(0.15,0.5)
plot(masterwave[index_wave[0]:index_wave[1]]+0.6, xmean1*0.6, 'r', drawstyle='steps')
plot(masterwave[index_wave[0]:index_wave[1]]+0.6, xmean*0.8, 'g', drawstyle='steps')
plot([2796.75,  2796.75], [0.0, 3.5], 'k')
plot([2803.27,  2803.27], [0.0, 3.5], 'k')


Out[105]:
[<matplotlib.lines.Line2D at 0x2542c2c10>]

In [ ]: