In [1]:
using DiskJockey.constants

In [2]:
lam0 = lam0s["12CO3-2"] # microns
# lam0 = lam0s["13CO2-1"]
# lam0 = lam0s["12CO2-1"]


Out[2]:
866.9633734040698

In [3]:
c_kms


Out[3]:
299792.458

In [4]:
function wl_to_vel(wl)
    
    return c_kms * (wl - lam0)/lam0
end

function vel_to_wl(vel)
    beta = vel/c_kms # relativistic Doppler formula
    return lam0 * sqrt((1. - beta) / (1. + beta)) # [microns]
end


Out[4]:
vel_to_wl (generic function with 1 method)

In [5]:
# Wavelengths in the data set are
vmin = wl_to_vel(866.950)
vmax = wl_to_vel(866.996)
println("Velocities range from $vmin to $vmax and span ", vmax - vmin, " km/s")
println("Midpoint is ", (vmax + vmin)/2)


Velocities range from -4.624469499965454 to 11.282146040012217 and span 15.906615539977672 km/s
Midpoint is 3.328838270023381

In [18]:
# LSR velocities in Output image span from 2.38 kms to 9.18 km/s.
println(9.18 - 2.38)


6.8

In [12]:
wl_to_vel(867.)


Out[12]:
12.66533000001882

In [13]:
vel_to_wl(12.6653)


Out[13]:
866.9267476685413

In [ ]: