diff --git a/README.md b/README.md index 03132d9..b838eaf 100644 --- a/README.md +++ b/README.md @@ -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). diff --git a/check_standards.pro b/check_standards.pro index 2f5bd9f..19acbed 100644 --- a/check_standards.pro +++ b/check_standards.pro @@ -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) @@ -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 diff --git a/ern_rv.pro b/ern_rv.pro index c2518ef..0f79a86 100644 --- a/ern_rv.pro +++ b/ern_rv.pro @@ -95,7 +95,7 @@ END ;============================================ -; PRO RV +; PRO ERN_RV ; Find the offset between data and a standard star diff --git a/makemeastandwich.pro b/makemeastandwich.pro index 13f0597..83129ab 100644 --- a/makemeastandwich.pro +++ b/makemeastandwich.pro @@ -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. diff --git a/nir_rv.pro b/nir_rv.pro index 8fc6be9..e99f3a0 100644 --- a/nir_rv.pro +++ b/nir_rv.pro @@ -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 @@ -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 +; ;- diff --git a/order_variables.pro b/order_variables.pro index c31684e..e9d6add 100644 --- a/order_variables.pro +++ b/order_variables.pro @@ -1,6 +1,5 @@ -; ################## +;============================================ ; get order variables for RV fitting -; ################## PRO order_variables, hdr, order, wrange, trange, pixscale, polydegree, instrument=instrument