diff --git a/ChargedParticle.ipynb b/ChargedParticle.ipynb index e440e1a..2dd08f3 100644 --- a/ChargedParticle.ipynb +++ b/ChargedParticle.ipynb @@ -42,13 +42,16 @@ "`NE`\n", ": The number of energies in the grid\n", "\n", + "`Emin`\n", + ": The smallest tabulated energy\n", + "\n", "`Emax`\n", ": The highest tabulated energy" ] }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 1, "metadata": {}, "outputs": [], "source": [ @@ -67,7 +70,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 3, "metadata": {}, "outputs": [ { @@ -99,6 +102,7 @@ " T(K)\n", " Date\n", " NE\n", + " Emin\n", " Emax\n", " \n", " \n", @@ -113,103 +117,99 @@ " 0.0\n", " 2020-09-04\n", " 94\n", - " 10277.4\n", + " 0.1\n", + " 20.0\n", " \n", " \n", - " 6\n", - " 2004.00o\n", - " 3.967130\n", + " 1\n", + " 3006.00a\n", + " 5.963449\n", " CP2020\n", - " CP2020/2004.00o\n", - " 2004\n", + " CP2020/3006.00a\n", + " 3006\n", " 0.0\n", - " 2020-09-04\n", - " 109\n", - " 72517.8\n", + " 2020-09-10\n", + " 209\n", + " 0.0\n", + " 200.0\n", " \n", " \n", - " 10\n", - " 2004.00s\n", - " 3.967130\n", + " 2\n", + " 3007.00a\n", + " 6.955734\n", " CP2020\n", - " CP2020/2004.00s\n", - " 2004\n", + " CP2020/3007.00a\n", + " 3007\n", " 0.0\n", - " 2020-09-04\n", - " 147\n", - " 98672.9\n", + " 2020-09-10\n", + " 215\n", + " 0.0\n", + " 200.0\n", " \n", " \n", - " 17\n", - " 2004.00h\n", - " 3.968219\n", + " 3\n", + " 1002.00o\n", + " 1.996256\n", " CP2020\n", - " CP2020/2004.00h\n", - " 2004\n", + " CP2020/1002.00o\n", + " 1002\n", " 0.0\n", " 2020-09-04\n", - " 538\n", - " 12569.6\n", + " 101\n", + " 0.0\n", + " 10.0\n", " \n", " \n", - " 22\n", - " 2004.00r\n", - " 3.968219\n", + " 4\n", + " 1003.00o\n", + " 2.989596\n", " CP2020\n", - " CP2020/2004.00r\n", - " 2004\n", + " CP2020/1003.00o\n", + " 1003\n", " 0.0\n", " 2020-09-04\n", - " 200\n", - " 986.7\n", - " \n", - " \n", - " 12042\n", - " 2004.70a\n", - " 3.967130\n", - " CP2011\n", - " CP2011/alpha/2004.70a\n", - " 2004\n", + " 167\n", " 0.0\n", - " 2013-05-23\n", - " 94\n", - " 10237.0\n", + " 10.0\n", " \n", " \n", - " 12048\n", - " 2004.70o\n", - " 3.967130\n", - " CP2011\n", - " CP2011/deuteron/2004.70o\n", - " 2004\n", - " 0.0\n", - " 2012-09-14\n", - " 109\n", - " 72517.8\n", + " ...\n", + " ...\n", + " ...\n", + " ...\n", + " ...\n", + " ...\n", + " ...\n", + " ...\n", + " ...\n", + " ...\n", + " ...\n", " \n", " \n", - " 12052\n", - " 2004.70s\n", - " 3.967130\n", + " 12062\n", + " 1003.70r\n", + " 2.989596\n", " CP2011\n", - " CP2011/helium3/2004.70s\n", - " 2004\n", + " CP2011/triton/1003.70r\n", + " 1003\n", " 0.0\n", " 2011-08-30\n", - " 147\n", - " 98673.0\n", + " 75\n", + " 0.0\n", + " 2.0\n", " \n", " \n", - " 12059\n", - " 2004.71h\n", - " 3.967130\n", + " 12063\n", + " 2003.70r\n", + " 2.989032\n", " CP2011\n", - " CP2011/proton/2004.71h\n", - " 2004\n", + " CP2011/triton/2003.70r\n", + " 2003\n", " 0.0\n", " 2011-08-30\n", - " 110\n", - " 12571.0\n", + " 81\n", + " 0.0\n", + " 3.0\n", " \n", " \n", " 12064\n", @@ -221,36 +221,68 @@ " 0.0\n", " 2011-08-30\n", " 201\n", - " 986.9\n", + " 0.1\n", + " 14.0\n", + " \n", + " \n", + " 12065\n", + " 3006.70r\n", + " 5.961817\n", + " CP2011\n", + " CP2011/triton/3006.70r\n", + " 3006\n", + " 0.0\n", + " 2011-08-30\n", + " 45\n", + " 0.0\n", + " 20.0\n", + " \n", + " \n", + " 12066\n", + " 3007.70r\n", + " 6.955734\n", + " CP2011\n", + " CP2011/triton/3007.70r\n", + " 3007\n", + " 0.0\n", + " 2011-07-07\n", + " 205\n", + " 0.0\n", + " 200.0\n", " \n", " \n", "\n", + "

138 rows × 10 columns

\n", "" ], "text/plain": [ - " ZAID AWR library path ZA T(K) \\\n", - "0 2004.00a 3.967130 CP2020 CP2020/2004.00a 2004 0.0 \n", - "6 2004.00o 3.967130 CP2020 CP2020/2004.00o 2004 0.0 \n", - "10 2004.00s 3.967130 CP2020 CP2020/2004.00s 2004 0.0 \n", - "17 2004.00h 3.968219 CP2020 CP2020/2004.00h 2004 0.0 \n", - "22 2004.00r 3.968219 CP2020 CP2020/2004.00r 2004 0.0 \n", - "12042 2004.70a 3.967130 CP2011 CP2011/alpha/2004.70a 2004 0.0 \n", - "12048 2004.70o 3.967130 CP2011 CP2011/deuteron/2004.70o 2004 0.0 \n", - "12052 2004.70s 3.967130 CP2011 CP2011/helium3/2004.70s 2004 0.0 \n", - "12059 2004.71h 3.967130 CP2011 CP2011/proton/2004.71h 2004 0.0 \n", - "12064 2004.70r 3.967130 CP2011 CP2011/triton/2004.70r 2004 0.0 \n", + " ZAID AWR library path ZA T(K) \\\n", + "0 2004.00a 3.967130 CP2020 CP2020/2004.00a 2004 0.0 \n", + "1 3006.00a 5.963449 CP2020 CP2020/3006.00a 3006 0.0 \n", + "2 3007.00a 6.955734 CP2020 CP2020/3007.00a 3007 0.0 \n", + "3 1002.00o 1.996256 CP2020 CP2020/1002.00o 1002 0.0 \n", + "4 1003.00o 2.989596 CP2020 CP2020/1003.00o 1003 0.0 \n", + "... ... ... ... ... ... ... \n", + "12062 1003.70r 2.989596 CP2011 CP2011/triton/1003.70r 1003 0.0 \n", + "12063 2003.70r 2.989032 CP2011 CP2011/triton/2003.70r 2003 0.0 \n", + "12064 2004.70r 3.967130 CP2011 CP2011/triton/2004.70r 2004 0.0 \n", + "12065 3006.70r 5.961817 CP2011 CP2011/triton/3006.70r 3006 0.0 \n", + "12066 3007.70r 6.955734 CP2011 CP2011/triton/3007.70r 3007 0.0 \n", + "\n", + " Date NE Emin Emax \n", + "0 2020-09-04 94 0.1 20.0 \n", + "1 2020-09-10 209 0.0 200.0 \n", + "2 2020-09-10 215 0.0 200.0 \n", + "3 2020-09-04 101 0.0 10.0 \n", + "4 2020-09-04 167 0.0 10.0 \n", + "... ... ... ... ... \n", + "12062 2011-08-30 75 0.0 2.0 \n", + "12063 2011-08-30 81 0.0 3.0 \n", + "12064 2011-08-30 201 0.1 14.0 \n", + "12065 2011-08-30 45 0.0 20.0 \n", + "12066 2011-07-07 205 0.0 200.0 \n", "\n", - " Date NE Emax \n", - "0 2020-09-04 94 10277.4 \n", - "6 2020-09-04 109 72517.8 \n", - "10 2020-09-04 147 98672.9 \n", - "17 2020-09-04 538 12569.6 \n", - "22 2020-09-04 200 986.7 \n", - "12042 2013-05-23 94 10237.0 \n", - "12048 2012-09-14 109 72517.8 \n", - "12052 2011-08-30 147 98673.0 \n", - "12059 2011-08-30 110 12571.0 \n", - "12064 2011-08-30 201 986.9 " + "[138 rows x 10 columns]" ] }, "metadata": {}, @@ -259,7 +291,7 @@ ], "source": [ "ZA = 2004\n", - "display(ZA)" + "display()" ] } ], diff --git a/GettingStarted.ipynb b/GettingStarted.ipynb index f92484e..f77b59d 100644 --- a/GettingStarted.ipynb +++ b/GettingStarted.ipynb @@ -23,15 +23,23 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 3, "metadata": { "tags": [] }, "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Reading from xsdir at: /Users/jlconlin/Documents/Data/type1/xsdir\n", + "Reading xsdir using 15 parallel threads.\n" + ] + }, { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "ca15c5cc674d4b078a599c5b6b8e2038", + "model_id": "0f6bb15845e64492ad34e2fb087a183f", "version_major": 2, "version_minor": 0 }, @@ -54,12 +62,19 @@ "import os\n", "import pathlib\n", "import listing\n", + "import multiprocessing as mp\n", "\n", "xsdirName = 'xsdir'\n", "datapath = pathlib.Path(os.environ['DATAPATH'], xsdirName)\n", + "print(\"Reading from xsdir at: {}\".format(datapath))\n", "# If your XSDIR file is not called `xsdir` you will need to change the \n", - "# xsdirName variable obove to match the name of your file\n", - "listing.generateJSON(datapath, 20)" + "# xsdirName variable above to match the name of your file\n", + "\n", + "# The variable N is how many parallel threads are used\n", + "# By default, it uses all but one of the available CPUs\n", + "N = max(1, mp.cpu_count()-1)\n", + "print(\"Reading xsdir using {} parallel threads.\".format(N))\n", + "listing.generateJSON(datapath,N)" ] }, { diff --git a/listing.py b/listing.py index 3dd103c..a863c14 100644 --- a/listing.py +++ b/listing.py @@ -45,7 +45,7 @@ def _fastNeutron(self, entry, ACE): meta = {} NE = int(ACE.NXS[3]) meta[ 'NE'] = NE - meta[ 'Emax'] = round(ACE.XSS[NE], 1) + meta[ 'Emax'] = round(ACE.XSS[NE-1], 1) if (ACE.JXS[12] != 0) or (ACE.JXS[13] != 0): meta[ 'GPD'] = True else: @@ -117,7 +117,7 @@ def _chargedParticle(self, entry, ACE): meta['target'] = entry.ZA meta['NE'] = NE meta['Emin'] = round(ACE.XSS[0], 1) - meta['Emax'] = round(ACE.XSS[NE], 1) + meta['Emax'] = round(ACE.XSS[NE-1], 1) return meta def _default(self, entry, ACE):