Commit 4193320d authored by Monica Rainer's avatar Monica Rainer
Browse files

Barycentric correction applied to s1d files

parent c0180681
...@@ -11,4 +11,4 @@ Python packages: ...@@ -11,4 +11,4 @@ Python packages:
Output: Output:
- intermediate: *_str.fits, 2D images with orders straightened and bad pixel removed - intermediate: *_str.fits, 2D images with orders straightened and bad pixel removed
- final output: *_e2ds.fits. The spectra are flat-fielded, extracted, calibrated, and the cosmic rays are removed. The echelle orders are not merged. The FITS files contain three images 50 orders x 2048 pixels: the primary image contains the fluxes, the second contains the wavelength calibration and the third contains the signal-to-noise ratio. - final output: *_e2ds.fits. The spectra are flat-fielded, extracted, calibrated, and the cosmic rays are removed. The echelle orders are not merged. The FITS files contain three images 50 orders x 2048 pixels: the primary image contains the fluxes, the second contains the wavelength calibration and the third contains the signal-to-noise ratio.
- final output (optional): *_s1d.fits. The spectra are flat-fielded, extracted, calibrated, and the cosmic rays are removed. The echelle orders are merged. These are monodimensional spectra with constant step in wavelength. - final output (optional): *_s1d.fits. The spectra are flat-fielded, extracted, calibrated, and the cosmic rays are removed. The echelle orders are merged. The barycentric correction is applied. These are monodimensional spectra with constant step in wavelength.
...@@ -1042,7 +1042,12 @@ def create_s1d(spectrum, header): ...@@ -1042,7 +1042,12 @@ def create_s1d(spectrum, header):
end = {} end = {}
s1d = np.asarray([]) s1d = np.asarray([])
wstep = CONFIG['S1D_STEP'] # step in nm of the final s1d file wstep = CONFIG['S1D_STEP'] # step in nm of the final s1d file
try:
berv = float(header[CONFIG['BERV'][0]])
except:
berv = 0.0
c = const.c.to('km/s')
c = c.value
for o in reversed(xrange(CONFIG['N_ORD'])): for o in reversed(xrange(CONFIG['N_ORD'])):
#t1 = time.time() #t1 = time.time()
...@@ -1062,6 +1067,8 @@ def create_s1d(spectrum, header): ...@@ -1062,6 +1067,8 @@ def create_s1d(spectrum, header):
#print 's1d spectrum order %s normalization: %s s' % (str(o),str(t2-t1)) #print 's1d spectrum order %s normalization: %s s' % (str(o),str(t2-t1))
wave_old[o] = wcalib(header,o)[::-1] wave_old[o] = wcalib(header,o)[::-1]
wave_old[o] = wave_old[o]*(1+(berv/c))
try: try:
#shift = int((wave_old[o][0] - end[o+1])/wstep) -1 #shift = int((wave_old[o][0] - end[o+1])/wstep) -1
shift = max(int(round((wave_old[o][0] - end[o+1])/wstep,0)),1) shift = max(int(round((wave_old[o][0] - end[o+1])/wstep,0)),1)
...@@ -1080,7 +1087,7 @@ def create_s1d(spectrum, header): ...@@ -1080,7 +1087,7 @@ def create_s1d(spectrum, header):
try: try:
flux_new = spl(wave_new[o]) flux_new = spl(wave_new[o])
except: except:
select_wave = wave_new[o][wave_old[o][0]<=wave_new<=wave_old[o][-1]] select_wave = wave_new[o][wave_old[o][0]<=wave_new[o]<=wave_old[o][-1]]
flux_new = spl(select_wave) flux_new = spl(select_wave)
start[o] = select_wave[0] start[o] = select_wave[0]
end[o] = select_wave[-1] end[o] = select_wave[-1]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment