Velocity Precision

To run this program run idl, then compile and run the program as follows.

idl
IDL> .r max
IDL> max


This starts the program. Then .r compiles the program, max.pro; and finally typing "max" executes the program.

pro max

; divide out contin
;nie=nie/ncontin
;nfit=nfit/ncontin


This part just says what the program is called and reads in the file "noI2345B67.ascii".

The data is read in as doubles and is called;

niw (for no I2 wavelength)
nif (for no I2 flux)
nie (for no I2 error)
nfit (for dude fit)
ncontin (for dude continuum)

The lines with ";" preceeding it are commented out.

min = 1750; array position of the min. wavelength
max = 2500; array position of the max. wavelength
c=2.99e5;km/s
print,"starting wavelength=",niw[min]
print,"ending wavelength=",niw[max]
totoptweight=0
tvp=0
h=niw[min+1]-niw[min]
partial=MAKE_ARRAY(5000,2,VALUE=0.)
mpvubp=MAKE_ARRAY(5000,VALUE=0.)
optweight=MAKE_ARRAY(5000,VALUE=0.)


getting my arrays and constants set.

FOR i=min,max DO BEGIN

partial[i,0] = niw[i]
partial[i,1] = 1/(12.*h)*(-nfit[i+2]+8*nfit[i+1]-8*nfit[i-1]+nfit[i-2])


I used a 5 point method for figuring out the derivative at a point. Specifically: (1)
\begin{align} f'(x)=\frac{1}{12 h} \left(-f(x+2 h) + 8 f (x+h) -8 f (x-h) + f(x-2 h)\right) \end{align} ;minimum possible velocity uncertainty by pixel i is:
mpvubp[i]= nie[i]/(niw[i]*partial[i,1])


This comes from the Murphy paper:

"the minimum possible velocity uncertainty contributed by pixel i is given by:"

(2)
\begin{align} \frac{\sigma_v(i)}{c}=\frac{\sigma_F (i)}{\lambda (i) (\partial F (i)/ \partial \lambda (i))} \end{align}

with

(3)
\begin{array} && \sigma_F (i) \text{being the 1} \sigma \text{error array} \\ && F(i) \text{being a spectrum} \end{array}

Possible spot for errors — does the units on the spectrum matter? ;optimal weight
optweight[i]=(mpvubp[i])^(-2)

endfor


Optimal weight is defined in the paper as:

(4)
\begin{align} W(i)\equiv \left( \sigma_v(i)/c \right)^{-2} \end{align}

(This graph is plotted with y axis data divided by a factor of 1e7) FOR i=min,max DO BEGIN
totoptweight+=(optweight(i))
endfor

;total velocity precision available all pixels in a portion of spectrum
tvp=c*(1./(sqrt(totoptweight)))


"The total velocity precision available from all pixels in a portion of the spectrum then is:"(5)
\begin{align} \sigma_v = c \left[\sum_i W (i) \right ]^{-1/2} \end{align}
print,"total velocity precision available from portion in km/s= ", tvp
stop
end


total velocity precision available from portion in km/s = 0.0313597 km/s

which means total velocity precision available in m/s = 31.359 m/s

For the 2002 data: total velocity precision available = 72 m/s