Skip to content

Commit

Permalink
expunging attrib['z']
Browse files Browse the repository at this point in the history
  • Loading branch information
profxj committed Nov 24, 2016
1 parent 09a50e1 commit 3617d55
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 65 deletions.
30 changes: 7 additions & 23 deletions docs/examples/AbsSightline.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@
"/Users/xavier/local/Python/linetools/linetools/lists/linelist.py:374: RuntimeWarning: divide by zero encountered in log10\n",
" self._data['log(w*f)'] = np.log10(qm_strength)\n",
"/Users/xavier/anaconda/lib/python2.7/site-packages/numpy/ma/core.py:827: RuntimeWarning: invalid value encountered in less_equal\n",
" return umath.less_equal(x, self.critical_value)\n"
" return umath.less_equal(x, self.critical_value)\n",
"/Users/xavier/anaconda/lib/python2.7/site-packages/astropy/table/column.py:1095: MaskedArrayFutureWarning: setting an item on a masked array which has a shared mask will not copy the mask and also change the original mask array in the future.\n",
"Check the NumPy 1.11 release notes for more information.\n",
" ma.MaskedArray.__setitem__(self, index, value)\n"
]
},
{
Expand All @@ -93,22 +96,12 @@
"Loading abundances from Asplund2009\n",
"Abundances are relative by number on a logarithmic scale with H=12\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"/Users/xavier/anaconda/lib/python2.7/site-packages/astropy/table/column.py:1095: MaskedArrayFutureWarning: setting an item on a masked array which has a shared mask will not copy the mask and also change the original mask array in the future.\n",
"Check the NumPy 1.11 release notes for more information.\n",
" ma.MaskedArray.__setitem__(self, index, value)\n"
]
}
],
"source": [
"lya = AbsLine('HI 1215')\n",
"lya = AbsLine('HI 1215', z=2.3)\n",
"lya.limits.set([-300.,300.]*u.km/u.s) # vlim\n",
"lya.attrib['z'] = 2.3\n",
"lyb = AbsLine(1025.7222*u.AA, z=lya.attrib['z'])\n",
"lyb = AbsLine(1025.7222*u.AA, z=2.3)\n",
"lyb.limits.set([-300.,300.]*u.km/u.s) # vlim\n",
"abscomp = AbsComponent.from_abslines([lya,lyb])\n",
"abscomp.coord = ltu.radec_to_coord((10.*u.deg, 45*u.deg))\n",
Expand Down Expand Up @@ -190,7 +183,7 @@
"data": {
"text/html": [
"<Table length=1>\n",
"<table id=\"table4656546192\" class=\"table-striped table-bordered table-condensed\">\n",
"<table id=\"table4608359888\" class=\"table-striped table-bordered table-condensed\">\n",
"<thead><tr><th>Z</th><th>ion</th><th>A</th><th>Ej</th><th>z</th><th>vmin</th><th>vmax</th><th>flag_N</th><th>logN</th><th>sig_logN</th></tr></thead>\n",
"<thead><tr><th></th><th></th><th></th><th>1 / cm</th><th></th><th>km / s</th><th>km / s</th><th></th><th></th><th></th></tr></thead>\n",
"<thead><tr><th>int64</th><th>int64</th><th>int64</th><th>float64</th><th>float64</th><th>float64</th><th>float64</th><th>int64</th><th>float64</th><th>float64</th></tr></thead>\n",
Expand All @@ -214,15 +207,6 @@
"source": [
"tbl"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down
34 changes: 1 addition & 33 deletions linetools/isgm/tests/test_init_abssightline.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,46 +12,14 @@
from astropy.coordinates import SkyCoord

from linetools.isgm.abssightline import GenericAbsSightline
from linetools.isgm.abscomponent import AbsComponent
from linetools.spectralline import AbsLine
from .utils import lyman_comp, si2_comp


def data_path(filename):
data_dir = os.path.join(os.path.dirname(__file__), 'files')
return os.path.join(data_dir, filename)


def lyman_comp(radec):
# HI Lya, Lyb
lya = AbsLine(1215.670*u.AA)
lya.analy['vlim'] = [-300.,300.]*u.km/u.s
lya.attrib['z'] = 2.92939
lya.attrib['N'] = 1e17 / u.cm**2
lya.attrib['coord'] = radec
lyb = AbsLine(1025.7222*u.AA)
lyb.analy['vlim'] = [-300.,300.]*u.km/u.s
lyb.attrib['z'] = lya.attrib['z']
lyb.attrib['coord'] = radec
abscomp = AbsComponent.from_abslines([lya,lyb])
return abscomp


def si2_comp(radec):
# SiII
SiIItrans = ['SiII 1260', 'SiII 1304', 'SiII 1526', 'SiII 1808']
abslines = []
for trans in SiIItrans:
iline = AbsLine(trans)
iline.attrib['z'] = 2.92939
iline.attrib['coord'] = radec
iline.analy['vlim'] = [-250.,80.]*u.km/u.s
abslines.append(iline)
#
SiII_comp = AbsComponent.from_abslines(abslines)
#
return SiII_comp


def test_from_components():
radec = SkyCoord(ra=123.1143*u.deg, dec=-12.4321*u.deg)
# HI
Expand Down
15 changes: 6 additions & 9 deletions linetools/isgm/tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,13 @@ def data_path(filename):

def lyman_comp(radec):
# HI Lya, Lyb
lya = AbsLine(1215.670*u.AA)
lya.analy['vlim'] = [-300.,300.]*u.km/u.s
lya.attrib['z'] = 2.92939
lya = AbsLine(1215.670*u.AA, z=2.92939)
lya.limits.set([-300.,300.]*u.km/u.s)
lya.attrib['flag_N'] = 1
lya.attrib['N'] = 1e17 / u.cm**2
lya.attrib['coord'] = radec
lyb = AbsLine(1025.7222*u.AA)
lyb.analy['vlim'] = [-300.,300.]*u.km/u.s
lyb.attrib['z'] = lya.attrib['z']
lyb = AbsLine(1025.7222*u.AA, z=2.92939)
lyb.limits.set([-300.,300.]*u.km/u.s)
lyb.attrib['coord'] = radec
abscomp = AbsComponent.from_abslines([lya,lyb])
abscomp.synthesize_colm()
Expand All @@ -41,10 +39,9 @@ def si2_comp(radec):
SiIItrans = ['SiII 1260', 'SiII 1304', 'SiII 1526', 'SiII 1808']
abslines = []
for trans in SiIItrans:
iline = AbsLine(trans)
iline.attrib['z'] = 2.92939
iline = AbsLine(trans, z=2.92939)
iline.attrib['coord'] = radec
iline.analy['vlim'] = [-250.,80.]*u.km/u.s
iline.limits.set([-250.,80.]*u.km/u.s)
abslines.append(iline)
#
SiII_comp = AbsComponent.from_abslines(abslines)
Expand Down

0 comments on commit 3617d55

Please sign in to comment.