Examples for AbslineSystem Class (v1.0)


In [1]:
# imports
import imp
from astropy.coordinates import SkyCoord

from xastropy.igm.abs_sys import ionclms as xionc
from xastropy.igm.abs_sys import abssys_utils as xabsys

from linetools.spectralline import AbsLine
from linetools.lists.linelist import LineList

xa_path = imp.find_module('xastropy')[1]

Simple instantiation


In [2]:
reload(xabsys)
gensys = xabsys.GenericAbsSystem(NHI=16., zabs=1.244)
gensys.coord = SkyCoord(ra=123.1143*u.deg, dec=-12.4321*u.deg)

In [3]:
gensys


Out[3]:
[AbslineSystem: Foo Generic 08:12:27.432 -12:25:55.56, z=1.244, NHI=16]

Add some absorption lines


In [4]:
ism = LineList('ISM')


WARNING: UnitsWarning: The unit 'Angstrom' has been deprecated in the FITS standard. Suggested: nm (with data multiplied by 0.1). [astropy.units.format.utils]
WARNING:astropy:UnitsWarning: The unit 'Angstrom' has been deprecated in the FITS standard. Suggested: nm (with data multiplied by 0.1).
linetools.lists.parse: Reading linelist --- 
   /Users/xavier/local/Python/linetools/linetools/data/lines/morton03_table2.fits.gz
linetools.lists.parse: Reading linelist --- 
   /Users/xavier/local/Python/linetools/linetools/data/lines/morton00_table2.fits.gz
linetools.lists.parse: Reading linelist --- 
   /Users/xavier/local/Python/linetools/linetools/data/lines/verner94_tab6.fits

In [5]:
few_lines = [1215.6700, 1334.5323, 1808.0129]*u.AA
for ilin in few_lines:
    gensys.lines.append(AbsLine(ilin,linelist=ism))
gensys.lines


Out[5]:
[[AbsLine: HI 1215, wrest=1215.6700 Angstrom],
 [AbsLine: CII 1334, wrest=1334.5323 Angstrom],
 [AbsLine: SiII 1808, wrest=1808.0129 Angstrom]]

Grab a lines matching a given transition


In [6]:
Lya = gensys[1215.670*u.AA]
Lya[0]


Out[6]:
[AbsLine: HI 1215, wrest=1215.6700 Angstrom]

Fill with IonClms


In [7]:
allfil = xa_path+'/igm/abs_sys/tests/files/UM184.z2929_MAGE.all'
gensys._ionclms = xionc.IonClms(all_file=allfil)

In [8]:
gensys['SiII']


Out[8]:
{'Z': 14,
 'clm': 13.699999999999999,
 'flg_clm': 1,
 'flg_inst': 16,
 'ion': 2,
 'lines': [<Quantity 1808.0129 Angstrom>],
 'sig_clm': 0.045999999999999999}

In [9]:
gensys[(14,2)]


Out[9]:
{'Z': 14,
 'clm': 13.699999999999999,
 'flg_clm': 1,
 'flg_inst': 16,
 'ion': 2,
 'lines': [<Quantity 1808.0129 Angstrom>],
 'sig_clm': 0.045999999999999999}

In [ ]: