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 @@ "
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):