Skip to content

Commit

Permalink
tests, docs, and more
Browse files Browse the repository at this point in the history
  • Loading branch information
profxj committed Jun 3, 2016
1 parent 6aaf603 commit 2689ad0
Show file tree
Hide file tree
Showing 9 changed files with 360 additions and 87 deletions.
145 changes: 127 additions & 18 deletions docs/examples/AbsLine_examples.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 1,
"metadata": {
"collapsed": false
},
Expand All @@ -24,6 +24,7 @@
"from linetools.spectralline import AbsLine, SpectralLine\n",
"from linetools import spectralline as ltsp\n",
"from linetools import line_utils as ltlu\n",
"from linetools.spectra import io as lsio\n",
"from linetools.spectra.xspectrum1d import XSpectrum1D"
]
},
Expand All @@ -36,7 +37,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 2,
"metadata": {
"collapsed": false
},
Expand All @@ -47,7 +48,7 @@
"<AbsLine: CIV 1548, wrest=1548.1950 Angstrom>"
]
},
"execution_count": 3,
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -66,7 +67,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 3,
"metadata": {
"collapsed": false
},
Expand Down Expand Up @@ -102,7 +103,7 @@
" 'wrest': <Quantity 1548.195 Angstrom>}"
]
},
"execution_count": 4,
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -120,7 +121,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 4,
"metadata": {
"collapsed": false
},
Expand All @@ -143,9 +144,11 @@
" u'b': {'unit': u'km / s', 'value': 0.0},\n",
" u'flag_EW': 0,\n",
" u'flag_N': 0,\n",
" u'logN': 0.0,\n",
" u'sig_EW': {'unit': u'Angstrom', 'value': 0.0},\n",
" u'sig_N': {'unit': u'1 / cm2', 'value': 0.0},\n",
" u'sig_b': {'unit': u'km / s', 'value': 0.0},\n",
" u'sig_logN': 0.0,\n",
" u'sig_v': {'unit': u'km / s', 'value': 0.0},\n",
" u'sig_z': 0.0,\n",
" u'v': {'unit': u'km / s', 'value': 0.0},\n",
Expand Down Expand Up @@ -179,7 +182,7 @@
" 'wrest': {'unit': u'Angstrom', 'value': 1548.195}}"
]
},
"execution_count": 5,
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -199,7 +202,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 5,
"metadata": {
"collapsed": false
},
Expand All @@ -210,7 +213,7 @@
"<AbsLine: CIV 1548, wrest=1548.1950 Angstrom>"
]
},
"execution_count": 6,
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -229,7 +232,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 6,
"metadata": {
"collapsed": true
},
Expand All @@ -240,7 +243,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 7,
"metadata": {
"collapsed": false
},
Expand All @@ -251,7 +254,7 @@
"[<Quantity 1548.195 Angstrom>, <Quantity 1215.67 Angstrom>]"
]
},
"execution_count": 9,
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -261,6 +264,52 @@
"wrest_values"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Transition Table"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
"&lt;Table length=2&gt;\n",
"<table id=\"table4594379280\">\n",
"<thead><tr><th>wrest</th><th>name</th><th>Z</th><th>ion</th><th>Ej</th><th>z</th><th>EW</th><th>sig_EW</th><th>flag_N</th><th>logN</th></tr></thead>\n",
"<thead><tr><th>Angstrom</th><th></th><th></th><th></th><th>1 / cm</th><th></th><th>Angstrom</th><th>Angstrom</th><th></th><th></th></tr></thead>\n",
"<thead><tr><th>float64</th><th>str8</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></tr></thead>\n",
"<tr><td>1215.67</td><td>HI 1215</td><td>1</td><td>1</td><td>0.0</td><td>0.0</td><td>0.0</td><td>0.0</td><td>0</td><td>0.0</td></tr>\n",
"<tr><td>1548.195</td><td>CIV 1548</td><td>6</td><td>4</td><td>0.0</td><td>0.0</td><td>0.0</td><td>0.0</td><td>0</td><td>0.0</td></tr>\n",
"</table>"
],
"text/plain": [
"<Table length=2>\n",
" wrest name Z ion Ej z EW sig_EW flag_N logN \n",
"Angstrom 1 / cm Angstrom Angstrom \n",
"float64 str8 int64 int64 float64 float64 float64 float64 int64 float64\n",
"-------- -------- ----- ----- ------- ------- -------- -------- ------ -------\n",
" 1215.67 HI 1215 1 1 0.0 0.0 0.0 0.0 0 0.0\n",
"1548.195 CIV 1548 6 4 0.0 0.0 0.0 0.0 0 0.0"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"tbl = ltlu.transtable_from_speclines(abslines)\n",
"tbl"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand All @@ -270,7 +319,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 9,
"metadata": {
"collapsed": false
},
Expand All @@ -282,7 +331,7 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 10,
"metadata": {
"collapsed": true
},
Expand All @@ -294,7 +343,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 11,
"metadata": {
"collapsed": false
},
Expand Down Expand Up @@ -322,9 +371,9 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 12,
"metadata": {
"collapsed": true
"collapsed": false
},
"outputs": [],
"source": [
Expand All @@ -337,7 +386,7 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 13,
"metadata": {
"collapsed": false
},
Expand All @@ -356,6 +405,54 @@
"print('logN = {:g}, siglogN = {:g}'.format(abslin.attrib['logN'], abslin.attrib['sig_logN']))"
]
},
{
"cell_type": "markdown",
"metadata": {
"collapsed": true
},
"source": [
"### Another Table"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
"&lt;Table length=2&gt;\n",
"<table id=\"table4595718160\">\n",
"<thead><tr><th>wrest</th><th>name</th><th>Z</th><th>ion</th><th>Ej</th><th>z</th><th>EW</th><th>sig_EW</th><th>flag_N</th><th>logN</th></tr></thead>\n",
"<thead><tr><th>Angstrom</th><th></th><th></th><th></th><th>1 / cm</th><th></th><th>Angstrom</th><th>Angstrom</th><th></th><th></th></tr></thead>\n",
"<thead><tr><th>float64</th><th>str8</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></tr></thead>\n",
"<tr><td>1215.67</td><td>HI 1215</td><td>1</td><td>1</td><td>0.0</td><td>0.0</td><td>0.0</td><td>0.0</td><td>0</td><td>0.0</td></tr>\n",
"<tr><td>1548.195</td><td>CIV 1548</td><td>6</td><td>4</td><td>0.0</td><td>2.92929</td><td>0.993502101206</td><td>0.0527114204241</td><td>1</td><td>13.9050897399</td></tr>\n",
"</table>"
],
"text/plain": [
"<Table length=2>\n",
" wrest name Z ion ... sig_EW flag_N logN \n",
"Angstrom ... Angstrom \n",
"float64 str8 int64 int64 ... float64 int64 float64 \n",
"-------- -------- ----- ----- ... --------------- ------ -------------\n",
" 1215.67 HI 1215 1 1 ... 0.0 0 0.0\n",
"1548.195 CIV 1548 6 4 ... 0.0527114204241 1 13.9050897399"
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"tbl = ltlu.transtable_from_speclines(abslines)\n",
"tbl"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand All @@ -371,6 +468,18 @@
"display_name": "Python 2",
"language": "python",
"name": "python2"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.11"
}
},
"nbformat": 4,
Expand Down
Loading

0 comments on commit 2689ad0

Please sign in to comment.