In [14]:
try:
    reload(apogee.modelspec.turbospec)
except (ImportError,NameError):
    import apogee.modelspec.turbospec
from apogee.modelatm import atlas9
import apogee.spec.plot as splot
from apogee.tools import air2vac

Check for differences between running Turbospectrum in vacuum and air wavelengths

Let's generate a spectrum at $T_{\mathrm{eff}} = 4500 K$, $\log g = 2.5$ and solar abundances in vacuum


In [2]:
logg= 2.5
atm= atlas9.Atlas9Atmosphere(teff=4500.,logg=logg,metals=0.,am=0.,cm=0.)

In [3]:
synspec_vac= apogee.modelspec.turbospec.synth(modelatm=atm,linelist='turbospec.201312161124.new.vac',
                                              Hlinelist='Hlinedata.vac',
                                              vmicro=2.478-0.325*logg,
                                              lsf='combo',cont='aspcap',vmacro=6.,isotopes='solar')


/Library/Python/2.7/site-packages/numpy/core/fromnumeric.py:2507: VisibleDeprecationWarning: `rank` is deprecated; use the `ndim` attribute or function instead. To find the rank of a matrix see `numpy.linalg.matrix_rank`.
  VisibleDeprecationWarning)


In [4]:
synspec_air= apogee.modelspec.turbospec.synth(modelatm=atm,linelist='turbospec.201312161124',
                                              Hlinelist='Hlinedata',air=True,
                                              vmicro=2.478-0.325*logg,
                                              lsf='combo',cont='aspcap',vmacro=6.,isotopes='solar')


                                                                                

In [5]:
for op in [numpy.nanmean,numpy.nanstd,lambda x: numpy.nanmax(numpy.fabs(x))]:
    print op(synspec_air[0]-synspec_vac[0])


-7.24792342145e-06
0.000257062907336
0.004796628965

In [6]:
for panel in apogee.spec.plot.highres(synspec_vac[0],synspec_air[0],(synspec_air[0]-synspec_vac[0])*10.+0.25,yrange=[0.1,1.2],
                                      color=['b','g','gold'],labelLines=True,cleanZero=False,fig_width=14.):
    show()


/Library/Python/2.7/site-packages/numpy/lib/nanfunctions.py:220: RuntimeWarning: All-NaN axis encountered
  warnings.warn("All-NaN axis encountered", RuntimeWarning)

Another check before LSF convolution and continuum normalization


In [7]:
synspec_vac= apogee.modelspec.turbospec.turbosynth(modelatm=atm,linelist='turbospec.201312161124.new.vac',
                                                   Hlinelist='Hlinedata.vac',
                                                   vmicro=2.478-0.325*logg,
                                                   isotopes='solar',dw=0.016)


                                                                                

In [8]:
synspec_air= apogee.modelspec.turbospec.turbosynth(modelatm=atm,linelist='turbospec.201312161124',
                                                   Hlinelist='Hlinedata',air=True,
                                                   vmicro=2.478-0.325*logg,
                                                   isotopes='solar',dw=0.016)


                                                                                

In [19]:
figsize(18,4)
nwave= len(synspec_vac[0])
npanel= 50
for ii in range(1,npanel):
    plot(synspec_vac[0][ii*nwave//npanel-100:(ii+1)*nwave//npanel+100],
         synspec_vac[2][ii*nwave//npanel-100:(ii+1)*nwave//npanel+100]/numpy.median(synspec_vac[2][ii*nwave//npanel-100:(ii+1)*nwave//npanel+100]))
    plot([air2vac(w) for w in synspec_air[0][ii*nwave//npanel-100:(ii+1)*nwave//npanel+100]],
         synspec_air[2][ii*nwave//npanel-100:(ii+1)*nwave//npanel+100]/numpy.median(synspec_vac[2][ii*nwave//npanel-100:(ii+1)*nwave//npanel+100]))
    show()



In [ ]: