<jupyter_start><jupyter_text>Examples for AbsSystem Class (v1.3)<jupyter_code># suppress warnings for these examples
import warnings
warnings.filterwarnings('ignore')

# imports
import imp
from astropy.coordinates import SkyCoord
import astropy.units as u

from linetools.isgm import abssystem as lt_absys
from linetools.spectralline import AbsLine
from linetools.isgm.abscomponent import AbsComponent
from linetools.spectra import io
def data_path(filename):
    data_dir = '../../linetools/spectra/tests/files'
    return os.path.join(data_dir, filename)<jupyter_output><empty_output><jupyter_text>Simple instantiation  Standard init<jupyter_code>radec = SkyCoord(ra=123.1143*u.deg, dec=-12.4321*u.deg)
gensys = lt_absys.GenericAbsSystem(radec, 1.244, [-500,500]*u.km/u.s, NHI=16.)
gensys<jupyter_output><empty_output><jupyter_text>From components  One component<jupyter_code># HI Lya, Lyb
lya = AbsLine(1215.670*u.AA, z=2.92939)
lya.limits.set([-300.,300.]*u.km/u.s)  # vlim
lyb = AbsLine(1025.7222*u.AA, z=lya.attrib['z'])
lyb.limits.set([-300.,300.]*u.km/u.s)  # vlim
abscomp = AbsComponent.from_abslines([lya,lyb])
abscomp.coord = radec
# HILyman system
HIsys = lt_absys.LymanAbsSystem.from_components([abscomp])
print(HIsys)
print(HIsys._components)<jupyter_output><LymanAbsSystem: name=J081227.432-122555.56_z2.929 type=HILyman, 08:12:27.432 -12:25:55.56, z=2.92939, NHI=0>
[<AbsComponent: 08:12:27.432 -12:25:55.56, Name=HI_z2.92939, Zion=(1,1), Ej=0 1 / cm, z=2.92939, vlim=-300 km / s,300 km / s>]<jupyter_text>Multiple components<jupyter_code># SiII
SiIItrans = ['SiII 1260', 'SiII 1304', 'SiII 1526', 'SiII 1808']
abslines = []
for trans in SiIItrans:
    iline = AbsLine(trans, z=2.92939)
    iline.limits.set([-250.,80.]*u.km/u.s)  # vlim
    abslines.append(iline)
#
SiII_comp = AbsComponent.from_abslines(abslines)
SiII_comp.coord = radec
# Generic 
imp.reload(lt_absys)
LLSsys = lt_absys.GenericAbsSystem.from_components([abscomp,SiII_comp])
print(LLSsys)
print(LLSsys._components)<jupyter_output><GenericAbsSystem: name=Foo type=Generic, 08:12:27.432 -12:25:55.56, z=2.92939, NHI=0>
[<AbsComponent: 08:12:27.432 -12:25:55.56, Name=HI_z2.92939, Zion=(1,1), Ej=0 1 / cm, z=2.92939, vlim=-300 km / s,300 km / s>, <AbsComponent: 08:12:27.432 -12:25:55.56, Name=SiII_z2.92939, Zion=(14,2), Ej=0 1 / cm, z=2.92939, vlim=-250 km / s,80 km / s>]<jupyter_text>Methods  List of AbsLines<jupyter_code>lines = LLSsys.list_of_abslines()
lines<jupyter_output><empty_output><jupyter_text>Measure EW<jupyter_code>spec = io.readspec(data_path('UM184_nF.fits'))
LLSsys.measure_restew(spec=spec)<jupyter_output><empty_output><jupyter_text>Measure AODM<jupyter_code>LLSsys.measure_aodm(spec=spec)<jupyter_output>You may now wish to update the component column densities with update_component_colm()<jupyter_text>Update Component Columns<jupyter_code>LLSsys.update_component_colm()<jupyter_output><empty_output><jupyter_text>Single Line<jupyter_code>lyb = LLSsys.get_absline('HI 1025')
lyb
lyb = LLSsys.get_absline(1025.72*u.AA)
lyb
lyb.wrest<jupyter_output><empty_output><jupyter_text>Tables  Table of Transitions from abslines<jupyter_code>LLSsys.fill_trans()
LLSsys._trans<jupyter_output><empty_output><jupyter_text>Table of Columns for Components<jupyter_code>LLSsys.fill_ionN()
LLSsys._ionN<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14384592235931387, 'fraction_numerical': 0.08606680710201625, 'mean_word_length': 7.167076167076167, 'pattern_counts': {'":': 0, '<': 47, '<?xml version=': 0, '>': 47, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '11', 'dir': 'jupyter-structured-clean-dedup', 'id': '360287', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 1570, 'n_tokens_neox': 1402, 'n_words': 213, 'path': 'docs/examples/AbsSystem_examples.ipynb', 'repo_name': 'jchowk/linetools', 'size': '3323'}