In [ ]:
from xastropy.xguis import spec_guis as xxsg
reload(xxsg)
#
spec_fil = '/Users/xavier/VLT/XShooter/LP/idl_reduced_frames/0952-0115_uvb_coadd_vbin_flx.fits'
xxsg.run_fitlls(spec_fil)
Run spec_guis with the '4' flag
I recommend you generate an alias like this:
alias xfitlls 'python ~/xastropy/xastropy/xguis/spec_guis.py 4'
Then it is as simple as:
unix> xfitlls 0952-0115_uvb_coadd_vbin_flx.fits
Here is the current help:
usage: spec_guis.py [-h] [-out_file OUT_FILE] [-smooth SMOOTH] flag in_file
Parser for XFitLLSGUI
positional arguments:
flag GUI flag (ignored)
in_file Spectral file
optional arguments:
-h, --help show this help message and exit
-out_file OUT_FILE LLS Fit file
-smooth SMOOTH Smoothing (pixels)
-lls_fit_file LLS_FIT_FILE
Input LLS Fit file
-zqso ZQSO Use Telfer template with zqso
The GUI has been built to enable a user to overlay a series of LLS 'models' on a spectrum, including a continuum. The LLS is modeled by the Lyman series to Lyman-30, with a traditional N,b,z parameterization and then continuum opacity beyond the Limit. There is a "kludge" implemented to cover the gap between Lyman-30 and the LL.
Here is an overview of using the GUI:
(1) Most of the action occurs in the plot window.
(2) The obvious exceptions are when you wish to change between LLS for fiddling their parameters. For that, you need to select the LLS in the list widget.
(3) You can modify redshift, N_HI or bval in the boxes provided.
(4) Lastly, you can Write, Write+Quit, or Quit with the boxes at the bottom right.
Note: You have to click in the plot window for key strokes to take effect. This includes after actions that engage the LLS list widget.
When you Write or Write+Quit, a JSON output file is generated that saves the LLS parameters, the continuum parameters and a few other bits and pieces. Here is an example:
{ "LLS": { "1": { "NHI": 17.3, "bval": 42.0, "z": 4.1348662134175811 } }, "conti": { "Norm": 6.6073753071076802e-18, "piv_wv": 4166.4861195151479, "tilt": 0.0 }, "smooth": 2.5, "spec_file": "0952-0115_uvb_coadd_vbin_flx.fits" }
In [3]:
#LL Opacity
from xastropy.atomic import ionization as xatomi
wv_rest = 911.5*u.AA
energy = wv_rest.to(u.eV, equivalencies=u.spectral())
tau_LL = (10.**17.5 / u.cm**2) * xatomi.photo_cross(1,1,energy)
print(tau_LL)
# XIDL gives 2.0060005 -- Close enough
#tau_eng = c.h*c.c/(tau_wv*1e-8) / c.ev ; eV
#tau_LL = 10.^(16+tau_id*delta_N) * x_photocross(1,1, tau_eng)
In [1]:
#Lyman-a
#line = x_setline(1215.6701)
#line.N=17.5
#line.b=20.
# wave = 1200. + findgen(40000)*0.001
# vgt = x_voigt(wave,line,tau=tau,/nosmooth)
# tau peaks at 11978.7
from linetools.spectralline import AbsLine
lya = AbsLine('HI 1215')
lya.attrib['N'] = 17.5
lya.attrib['b'] = 20.*u.km/u.s
In [2]:
lya.data
Out[2]:
In [13]:
from xastropy.spec import voigt as xsv
from linetools.spectra.xspectrum1d import XSpectrum1D
reload(xsv)
wv = np.arange(lya.wrest.value-10.,lya.wrest.value+10,0.001)
npix = len(wv)
spec = XSpectrum1D.from_tuple((wv, np.ones(npix)))
tau = xsv.voigt_model(spec,lya,flg_ret=2)
# Max at ~6760!
# Now at 11974. Thank goodness..
In [14]:
np.max(tau)
Out[14]:
In [12]:
# Voigt
# IDL for print,voigt(0.0003030379,0.)=0.999658
avoigt = 0.0003030378771933264 # Same a in each evaluation
vking=xsv.voigtking(np.array([0.,1.]),avoigt)
print(vking)
In [9]:
np.sqrt(np.pi)
Out[9]:
In [ ]: