Skip to content

Commit

Permalink
More comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
Elisabeth Newton committed Dec 22, 2015
1 parent 343640f commit bab0b33
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 45 deletions.
19 changes: 15 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
# nir_rv
Radial velocities for low-resolution NIR spectra using telluric features to provide absolute wavelength calibration. Requires a standard star (M dwarf spectra included), and both the telluric and non-telluric-corrected spectra. Orders do not need to be combined.
# Absolute near-infared radial velocities

See check_standards for an example of usage.
This code measures absolute radial velocities for low-resolution NIR spectra. I use telluric features to provide absolute wavelength calibration, and then cross-correlate with a standard star. To use the code for your star, you will need observations of a standard star (included) and your science target (examples included). You will need both the telluric and non-telluric-corrected spectra and the FITS headers, but no other spectra is required. Orders do not need to be combined. It should work for all extant spectra taken with SpeX on IRTF or similar instruments.

Please see nir_rv and check_standards for an example of usage.

Run check_standards to test code.

Choose cross-correlation routine. xcorl is not my code, but may be available to you. c_correlate should exist in any modern IDL distribution. I prefer the routine cross_correlate which may be available in your installation. xcorl and cross_correlate produce consistent results; values from c_correlate may differ by up to 1 km/s.
## Altenrative sub-routines

### Cross-correlation
There are three options for cross-correlation routines: xcorl, c_correlate, and cross_correlate. These are used in ern_rv, and can be selected by keyword in the top-level routine nir_rv. c_correlate is the default since I believe it is the most commonly available, and ought to be included exist in any modern IDL distribution. xcorl is not my code, but may be available to you. I prefer the routine cross_correlate which may be available in your installation. xcorl and cross_correlate produce consistent results; I have improved the peak ginding in c_correlate but values may still differ by up to 1 km/s.

### Continuum fitting
There are two options for continuum fitting: a spline-based routine and the routine contf. contf is not my code, but may be available to you. The default spline-based routine is based on contf and is included in this code. The choice is not important in most cases.

# Reference
If you use this code in published research, please cite Newton et al. (2014): http://adslabs.org/adsabs/abs/2014AJ....147...20N/

# License
Copyright 2015 Elisabeth R. Newton. Licensed under the terms of the MIT License (see LICENSE).
4 changes: 4 additions & 0 deletions check_standards.pro
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
;============================================
; Test code functionality and usage example

PRO check_standards, ccorr_fxn=ccorfxn, contf=contf, showplot=showplot

; read in atmospheric transmission spectrum (Lord, 1992)
Expand Down Expand Up @@ -48,6 +51,7 @@ PRO check_standards, ccorr_fxn=ccorfxn, contf=contf, showplot=showplot

data_tc[*,0,*]=data[*,0,*] ; wavelength was modified during reduction

; J, H, and K bands independently
temp = FLTARR(3)
FOR order=0,2 DO BEGIN
; get pertinant variables for SpeX
Expand Down
2 changes: 1 addition & 1 deletion ern_rv.pro
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ END


;============================================
; PRO RV
; PRO ERN_RV
; Find the offset between data and a standard star


Expand Down
1 change: 1 addition & 0 deletions makemeastandwich.pro
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
;============================================
; Makes the RV standard on which this code has been tested.
; note that a -2.6 km/s offset correction was applied in Newton et al. (2014)
; if using the standard as created here, this is not necessary.
Expand Down
67 changes: 29 additions & 38 deletions nir_rv.pro
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
; wlcal: flag to indicate that standard star has already been shifted to rest wavelength
; stdrv: RV of standard star
;
; information on spectra
;
; pixscale
; spixscale
;
;

;+
; NAME:
; NIR_RV
Expand Down Expand Up @@ -64,37 +54,38 @@
; EXAMPLE:
; ALSO SEE CHECK_STANDARDS.PRO FOR MORE INFORMATION
;
; read in data
data = MRDFITS('spec/J0727+0513.fits',0,hdr)
data_tc = MRDFITS('spec/J0727+0513_tc.fits')
data_tc[*,0,*]=data[*,0,*] ; wavelength was modified during reduction

std = MRDFITS('spec/J0727+0513.fits',0,shdr)
std_tc = MRDFITS('spec/J0727+0513_tc.fits',0,shdr)
std_tc[*,0,*]=std[*,0,*] ; wavelength was modified during reduction

; get pertinent info
order = 1
order_variables, hdr, order, wrange, trange, pixscale, polydegree, instrument="spex"

; run program
NIR_RV, data_tc[*,*,order], hdr, data[*,*,order], $
std_tc[*,*,order], shdr, std[*,*,order], stdrv=18.2, $
pixscale=pixscale, polydegree=polydegree, $
spixscale=pixscale, spolydegree=polydegree, $
wrange=wrange, trange=trange, $
shftarr=shftarr, rv=myrv
print, "RV: ", myrv ; answer should be 18.2(+-0.1)
data_rest = data_tc[*,*,order]
data_rest[*,0] = data_rest + shftarr ; ready to use

; ; read in data
; data = MRDFITS('spec/J0727+0513.fits',0,hdr)
; data_tc = MRDFITS('spec/J0727+0513_tc.fits')
; data_tc[*,0,*]=data[*,0,*] ; wavelength was modified during reduction
;
; std = MRDFITS('spec/J0727+0513.fits',0,shdr)
; std_tc = MRDFITS('spec/J0727+0513_tc.fits',0,shdr)
; std_tc[*,0,*]=std[*,0,*] ; wavelength was modified during reduction
;
; ; get pertinent info
; order = 1
; order_variables, hdr, order, wrange, trange, pixscale, polydegree, instrument="spex"
;
; ; run program
; NIR_RV, data_tc[*,*,order], hdr, data[*,*,order], $
; std_tc[*,*,order], shdr, std[*,*,order], stdrv=18.2, $
; pixscale=pixscale, polydegree=polydegree, $
; spixscale=pixscale, spolydegree=polydegree, $
; wrange=wrange, trange=trange, $
; shftarr=shftarr, rv=myrv
; print, "RV: ", myrv ; answer should be 18.2(+-0.1)
; data_rest = data_tc[*,*,order]
; data_rest[*,0] = data_rest + shftarr ; ready to use
;
; METHOD:

; Uses telluric features to determine absolute wavelength calibration for the science
; target (and optionally the standard star). Cross-correlates to determine the
; radial velocity relative to the standard star. Calculates absolute radial velocity.
;
; PROCEDURES USED:

; REVISON HISTORY:

; tellrv
;
;-


Expand Down
3 changes: 1 addition & 2 deletions order_variables.pro
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
; ##################
;============================================
; get order variables for RV fitting
; ##################

PRO order_variables, hdr, order, wrange, trange, pixscale, polydegree, instrument=instrument

Expand Down

0 comments on commit bab0b33

Please sign in to comment.