summaryrefslogtreecommitdiff
path: root/Master/texmf-dist
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2016-04-02 21:57:34 +0000
committerKarl Berry <karl@freefriends.org>2016-04-02 21:57:34 +0000
commit736d573263d6969c828cadd202b3f248d8cc604e (patch)
treeb5562e31bb4a085499a0ec309eebac89015b3420 /Master/texmf-dist
parent7a1515b2305eebd7a55d99e4c779c5e79c329783 (diff)
nucleardata (2apr16)
git-svn-id: svn://tug.org/texlive/trunk@40216 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r--Master/texmf-dist/doc/latex/nucleardata/README2
-rw-r--r--Master/texmf-dist/doc/latex/nucleardata/nuccommandtest.pdfbin91168 -> 92262 bytes
-rw-r--r--Master/texmf-dist/doc/latex/nucleardata/nuccommandtest.tex70
-rw-r--r--Master/texmf-dist/doc/latex/nucleardata/nucleardata.pdfbin285082 -> 312975 bytes
-rw-r--r--Master/texmf-dist/source/latex/nucleardata/nucleardata.dtx87
-rw-r--r--Master/texmf-dist/source/latex/nucleardata/nucleardata.ins8
-rw-r--r--Master/texmf-dist/tex/latex/nucleardata/nucleardata.pytxcode27
-rw-r--r--Master/texmf-dist/tex/latex/nucleardata/nucleardata.sty35
8 files changed, 182 insertions, 47 deletions
diff --git a/Master/texmf-dist/doc/latex/nucleardata/README b/Master/texmf-dist/doc/latex/nucleardata/README
index db1647ccd4b..0f49d238734 100644
--- a/Master/texmf-dist/doc/latex/nucleardata/README
+++ b/Master/texmf-dist/doc/latex/nucleardata/README
@@ -8,6 +8,8 @@ Released under the LaTeX Project Public License v1.3c or later
See http://www.latex-project.org/lppl.txt
+Version Date: 04/01/2016
+
----------------------------------------------------------------
This package provides data and commands for including nuclear and atomic mass and energy data in LaTeX documents. It uses the PythonTeX package and requires pythontex.exe to be called with the tex file as the argument.
diff --git a/Master/texmf-dist/doc/latex/nucleardata/nuccommandtest.pdf b/Master/texmf-dist/doc/latex/nucleardata/nuccommandtest.pdf
index 2c9c2fa1712..46f1974a406 100644
--- a/Master/texmf-dist/doc/latex/nucleardata/nuccommandtest.pdf
+++ b/Master/texmf-dist/doc/latex/nucleardata/nuccommandtest.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/nucleardata/nuccommandtest.tex b/Master/texmf-dist/doc/latex/nucleardata/nuccommandtest.tex
index 34605c8ef4f..c923f237e70 100644
--- a/Master/texmf-dist/doc/latex/nucleardata/nuccommandtest.tex
+++ b/Master/texmf-dist/doc/latex/nucleardata/nuccommandtest.tex
@@ -5,10 +5,39 @@
\usepackage{booktabs}
\usepackage{nopageno}
\begin{document}
-\centering
-Example and Test File for \texttt{nucleardata} Package
-$^{~184}$Au Halflife Data
+
+
+\twocolumn[\centering Example and Test File for \texttt{nucleardata} Package]
+
+ Commands applied to $^{~40}$Ca
+
+ \begin{tabular}{cc}
+\toprule symbol & \nucsymbol{20} \\
+\midrule Z & \nucz{calcium}\\
+\midrule name & \nucname{20}\\
+\midrule Name & \nucName{20}\\
+\midrule Spin/parity & \nucspin{20}{41}\\
+\midrule mass excess & \nucexcess{20}{41}\\
+\midrule atomic mass (u) & \nucamassu{20}{41}\\
+\midrule atomic mass (u) & \nucamassu[2]{20}{41}\\
+\midrule atomic mass (keV) & \nucamasskev{20}{41}\\
+\midrule atomic mass (keV) & \nucamasskev[2]{20}{41}\\
+\midrule atomic mass (MeV) & \nucamassmev{20}{41}\\
+\midrule atomic mass (MeV) & \nucamassmev[5]{20}{41}\\
+\midrule nuclear mass (u) & \nuclearmassu{20}{41}\\
+\midrule nuclear mass (keV) & \nuclearmasskev[1]{20}{41}\\
+\midrule nuclear mass (MeV) & \nuclearmassmev{20}{41}\\
+\midrule BE/A & \nucbea{20}{41} MeV\\
+\midrule Q$_{\alpha}$ & \nucQalpha{20}{41} MeV\\
+\midrule Q$_{\beta^-}$ & \nucQbeta{20}{41} MeV\\
+\midrule Q$_{\beta^+}$ & \nucQposi{20}{41} MeV\\
+\midrule Q$_{\epsilon}$ & \nucQec{20}{41} MeV\\
+\midrule random A & \nucAran{20} \py{singleAran}\\
+\bottomrule
+ \end{tabular}
+\newpage
+Halflife Commands applied to $^{~184}$Au
\begin{tabular}{cc}
\toprule
@@ -37,29 +66,20 @@ $^{~184}$Au Halflife Data
\bottomrule\\
\end{tabular}
- Other commands applied to $^{~40}$Ca
+
+Five randomly selected nuclides and their masses and halflives
+ \nucrandom{5}
- \begin{tabular}{cc}
-\toprule symbol & \nucsymbol{20} \\
-\midrule Z & \nucz{calcium}\\
-\midrule name & \nucname{20}\\
-\midrule Name & \nucName{20}\\
-\midrule Spin/parity & \nucspin{20}{41}\\
-\midrule mass excess & \nucexcess{20}{41}\\
-\midrule atomic mass (u) & \nucamassu{20}{41}\\
-\midrule atomic mass (u) & \nucamassu[2]{20}{41}\\
-\midrule atomic mass (keV) & \nucamasskev{20}{41}\\
-\midrule atomic mass (keV) & \nucamasskev[2]{20}{41}\\
-\midrule atomic mass (MeV) & \nucamassmev{20}{41}\\
-\midrule atomic mass (MeV) & \nucamassmev[5]{20}{41}\\
-\midrule nuclear mass (u) & \nuclearmassu{20}{41}\\
-\midrule nuclear mass (keV) & \nuclearmasskev[1]{20}{41}\\
-\midrule nuclear mass (MeV) & \nuclearmassmev{20}{41}\\
-\midrule BE/A & \nucbea{20}{41} MeV\\
-\midrule Q$_{\alpha}$ & \nucQalpha{20}{41} MeV\\
-\midrule Q$_{\beta^-}$ & \nucQbeta{20}{41} MeV\\
-\midrule Q$_{\beta^+}$ & \nucQposi{20}{41} MeV\\
-\midrule Q$_{\epsilon}$ & \nucQec{20}{41} MeV\\
+% The second chosen Z is \py{zran[1]} which is \nucname{zran[1]} with symbol \nucsymbol{zran[1]}. The randomly chosen mass number is \py{aran[1]}, and the atomic mass of $^{~\py{aran[1]}}$\nucsymbol{zran[1]} is \nucamassu{zran[1]}{aran[1]} u.
+
+ \begin{tabular}{ccc}
+\toprule nuclide & mass (u) & halflife\\
+\midrule $^{~\py{aran[0]}}$\nucsymbol{zran[0]} & \nucamassu{zran[0]}{aran[0]} & \nuchalflife{zran[0]}{aran[0]}\\
+\midrule $^{~\py{aran[1]}}$\nucsymbol{zran[1]} & \nucamassu{zran[1]}{aran[1]} & \nuchalflife{zran[1]}{aran[1]}\\
+\midrule $^{~\py{aran[2]}}$\nucsymbol{zran[2]} & \nucamassu{zran[2]}{aran[2]} & \nuchalflife{zran[2]}{aran[2]}\\
+\midrule $^{~\py{aran[3]}}$\nucsymbol{zran[3]} & \nucamassu{zran[3]}{aran[3]} & \nuchalflife{zran[3]}{aran[3]}\\
+\midrule $^{~\py{aran[4]}}$\nucsymbol{zran[4]} & \nucamassu{zran[4]}{aran[4]} & \nuchalflife{zran[4]}{aran[4]}\\
\bottomrule
\end{tabular}
+
\end{document} \ No newline at end of file
diff --git a/Master/texmf-dist/doc/latex/nucleardata/nucleardata.pdf b/Master/texmf-dist/doc/latex/nucleardata/nucleardata.pdf
index d953efb53a2..6b96d94efb3 100644
--- a/Master/texmf-dist/doc/latex/nucleardata/nucleardata.pdf
+++ b/Master/texmf-dist/doc/latex/nucleardata/nucleardata.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/latex/nucleardata/nucleardata.dtx b/Master/texmf-dist/source/latex/nucleardata/nucleardata.dtx
index ac26399822d..eda908c1769 100644
--- a/Master/texmf-dist/source/latex/nucleardata/nucleardata.dtx
+++ b/Master/texmf-dist/source/latex/nucleardata/nucleardata.dtx
@@ -14,6 +14,8 @@ Released under the LaTeX Project Public License v1.3c or later
See http://www.latex-project.org/lppl.txt
+Version Date: 04/01/2016
+
----------------------------------------------------------------
This package provides data and commands for including nuclear and atomic mass and energy data in LaTeX documents. It uses the PythonTeX package and requires pythontex.exe to be called with the tex file as the argument.
@@ -45,6 +47,8 @@ Released under the LaTeX Project Public License v1.3c or later
See http://www.latex-project.org/lppl.txt
+Version Date: 04/01/2016
+
----------------------------------------------------------------
\endpreamble
\postamble
@@ -68,6 +72,8 @@ and the derived files nucleardata.ins,
massdata.csv,
nuccommandtest.tex,
nuccommandtext.pdf
+
+Version Date: 04/01/2016
\endpostamble
\usedir{./}
\generate{
@@ -97,7 +103,7 @@ and the derived files nucleardata.ins,
%
%<*package>
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{nucleardata}[2015/01/06 v1.01b LaTeX package for providing basic nuclear properties to documents efficiently]
+\ProvidesPackage{nucleardata}[2016/04/01 v1.01c LaTeX package for providing basic nuclear properties to documents efficiently]
\RequirePackage{pythontex}
\RequirePackage{siunitx}
%</package>
@@ -137,13 +143,15 @@ and the derived files nucleardata.ins,
%\changes{v1.00}{2015/11/15}{Initial Public Release}
%\changes{v1.01}{2015/11/18}{getIsotopes() returns an integer list; getHalfLifeValue returns a float}
%\changes{v1.01b}{2016/01/06}{getIsotopes() bug fix; calls to timeenergy(), time_dict, units_dict bug fixes}
+%\changes{v1.01c}{2016/04/01}{add macros to generate random lists of isotopes and a valid random A for given Z}
%
-% The |nucleardata| package provides a method for quickly accessing information about atomic nuclides (isotopes of elements) by referring to the chemical symbol and mass number (A) or to the atomic number (Z) and mass number (A). This information can be inserted and typeset without the user having to search an outside source. The information available in the current version includes chemical symbol or name given Z, Z given the chemical symbol or name, atomic mass, nuclear mass, Q-values for radioactive decay, half-life of ground states, binding energy, mass excess, and list of known isotopes of an element. \par
+% The |nucleardata| package provides a method for quickly accessing information about atomic nuclides (isotopes of elements) by referring to the chemical symbol and mass number (A) or to the atomic number (Z) and mass number (A). This information can be inserted and typeset without the user having to search an outside source. The information available, via macro commands, in the current version includes chemical symbol or name given Z, Z given the chemical symbol or name, atomic mass, nuclear mass, Q-values for radioactive decay, half-life of ground states, binding energy, mass excess, and list of known isotopes of an element. \par
%~
+% There is a macro command for generating a random set of nuclides, accessible as elements of lists of Z and corresponding (valid) A. The elements of the list can be used as arguments for Z and A arguments of other |nucleardata| macros. Another macro will randomly select an valid A for a user-specified Z.
+%\subsection*{Source of Data}
% The data is contained in two CSV format files: |massdata.csv| and |elementlist.csv|. These files must be installed in the same directory as the |nucleardata.sty| file. They are read during the \LaTeX\ compile process and lookups are done by Python code embedded into the |.sty| file. Initially, the Python code loads all the data from the |CSV| files into Python arrays, |nucleardata| and |elementdata|. \par
%~
% The \texttt{massdata.csv} file was created by the author (Nettles) from ENSDF data files and the file \texttt{mass.mas03round} from ``The Ame2003 atomic mass evaluation (II)'' by G.Audi, A.H.Wapstra and C.Thibault, \textit{ Nuclear Physics} A729 p. 337-676, December 22, 2003. The \texttt{elementlist.csv} file was created by the author from public sources.
-%~
% \subsection*{Using Python\TeX\ }
% Because Python is the basis of the lookup engine, the package |pythontex| is automatically loaded. The user must follow a three-step compiling sequence to get a semifinal/final document. For example, if the user's file is named |carbon.tex|, the sequence will be \par
%\begin{tabular}{l}
@@ -152,7 +160,7 @@ and the derived files nucleardata.ins,
% |pdflatex carbon.tex|
%\end{tabular}\par
% If the user is familiar with Python\TeX\ this shouldn't seem unusual.
-% \subsection*{A Python Class--Nucdata}
+% \subsection*{A Python Class--|Nucdata|}
% Python functions are called by customized \LaTeX\ commands to extract the data from the |nucleardata| and |elementdata| arrays, so the user has the capability of using these functions to write custom Python routines within the default Python\TeX\ environment. The functions belong to a class defined in this package as |Nucdata|. The class is instantiated in the package Python code as |nuc|.\par
% The functions will allow the user to use the data for more specific calculations such as Q-values of reactions or decay chain behaviors. Python\TeX\ was designed for tasks such as this. The user can utilize the functions as part of the |nuc| instantiation or can implement their own instance. The data arrays are loaded external to the class.
%~
@@ -166,7 +174,12 @@ and the derived files nucleardata.ins,
% \end{center}
% This definition gives a default rounding of six decimal places.
%
-% \subsection*{Commands}
+% \subsection*{Using Python variable names as arguments}
+% If a command calls for an integer value for either Z or A, you can supply the name of a Python variable which contains an integer value. This value could be set using a PythonTeX call or one of the |nucleardata| commands that selects random Z or A values (see |nucrandom[]{}| and |nucAran{}|).
+% \begin{center}
+% |\pyc{myz=6} Element Z=\py{myz} is called \nucname{myz}.|
+% \end{center}
+% \subsection*{Macro Commands}
%\DescribeMacro{\nucsymbol}
% Command form: |\nucsymbol{|\meta{namez}|}|.\par
% The argument can be an unquoted string (the name of the element) or an integer (atomic number, Z). Returns a string with the element symbol. Calls a Python function |getSymbol('|\meta{namez}|')|. \par
@@ -188,8 +201,9 @@ and the derived files nucleardata.ins,
%\DescribeMacro{\nuchalfunit}
% Command form: |\nuchalflife[|\meta{unit}|]{|\meta{namez}|}{|\meta{A}|}|. \par
% The optional argument is an unquoted string specifying the time unit to use for the return value. The chart below lists valid arguments. The first required argument can be an unquoted string (the symbol) or an integer (Z). The second required value must be an integer, the mass number, A. Returns a string with the value and units of the halflife of the specific nuclide. Calls a Python function |getHalfLife('|\meta{namez}|'|, \meta{A}, |'|\meta{unit}|')|. \par
-% There are two variations on this command: |\nuchalfvalue| calls |getHalfLifeValue("|\meta{namez}|'|, \meta{A}, |'|\meta{unit}|')| and returns the unformatted numerical portion of the halflife and |\nuchalfunit| calls |getHalfLifeUnit('|\meta{namez}|'|, \meta{A}, |'|\meta{unit}|')| returns a string with the unit portion. They take the same arguments as |\nuchalflife|. If there is no half life listed, the call returns the None token.\par
+% There are two variations on this command: \par |\nuchalfvalue| calls |getHalfLifeValue('|\meta{namez}|'|, \meta{A}, |'|\meta{unit}|')| and returns the unformatted numerical portion of the halflife and |\nuchalfunit| calls |getHalfLifeUnit('|\meta{namez}|'|, \meta{A}, |'|\meta{unit}|')| returns a string with the unit portion. They take the same arguments as |\nuchalflife|. If there is no half life listed, the call returns the None token.\par
%~
+%\begin{center}
%\begin{tabular}{ccc}
% argument & unit symbol & unit name \\
% \hline
@@ -201,17 +215,15 @@ and the derived files nucleardata.ins,
% |us| & \si{\micro\second} & microsecond \\
% |ms| & \si{\ms} & millisecond \\
% |s| & \si{\second} & second \\
-% |m| & \si{\min} & minute \\
-% |min| & \si{\min} & minute \\
-% |h| & \si{\hour} & hour \\
-% |hr| & \si{\hour} & hour \\
-% |d| & \si{\day} & day \\
-% |day| & \si{\day} & day \\
-% |y| & \si{\ensuremath{\mathrm{yr}}} & year \\
-% |yr| & \si{\ensuremath{\mathrm{yr}}} & year \\
+% |m| or |min| & \si{\min} & minute \\
+% |h| or |hr| & \si{\hour} & hour \\
+% |d| or |day| & \si{\day} & day \\
+% |y| or |yr| & \si{\ensuremath{\mathrm{yr}}} & year \\
% |My| & \si{\ensuremath{\mathrm{My}}} & megayear \\
% |Gy| & \si{\ensuremath{\mathrm{Gy}}} & gigayear \\
+% \hline
%\end{tabular}\par
+%\end{center}
%~
%
%\DescribeMacro{\nucspin}
@@ -284,6 +296,16 @@ and the derived files nucleardata.ins,
% Returns the Q-value of the reaction in atomic mass units (u), MeV/c$^2$ or keV/c$^2$, respectively. Calls Python function |getReaction_u('|\meta{namez1}|'|, \meta{A1}, |'|\meta{namez2}|'|, \meta{A2}, |'|\meta{namez3}|'|, \meta{A3}, |'| \meta{namez4}|'|, \meta{A4}|)|, etc. \par
%~
%
+%\DescribeMacro{\nucAran}
+% Command form: |\nucAran{|\meta{namez}|}|.\par
+% This macro generates a random A value for the given element specified by the required argument. The argument can be a string (the element symbol) or a number (Z). The generated A is stored in a Python variable, \textbf{singleAran}, accessible via |PythonTeX| macros such as |\py{singleAran}|. This list element name can also be used as the A argument for other |nucleardata| macros. Calls Python function |nuc.getRandomA('|\meta{namez}|')|. \par
+%~
+%
+%\DescribeMacro{\nucrandom}
+% Command form: |\nucrandom[|\meta{repeater}|]{|\meta{listsize}|}|.\par
+% This macro generates a list of random Z values and a list with a valid random A value for each chosen Z. The optional argument determines whether a Z value can selected more than once (0=no repeat [default], 1=repeats allowed). The required argument is an integer specifying the length of the lists. The generated list of Z is stored in a Python list, \textbf{zran}, and the associated A for each Z is stored in a Python list, \textbf{aran}. \textbf{zran[k]}$\to$\textbf{aran[k]}. The values in each list are accessible via |PythonTeX| macros such as |\py{zran[0]}|. The list element members can also be used as Z or A arguments for other |nucleardata| macros.\par
+% Calls Python function |nuc.makeNucRandom(|\meta{listsize}|,|\meta{repeater}|)|.
+%~
%\StopEventually{^^A
% \PrintChanges
% ^^A \PrintIndex
@@ -297,6 +319,7 @@ import sys
import fileinput
import csv
from subprocess import check_output
+import random as nucrandom
u2Mev=931.502
u2kev=u2Mev*1000.
@@ -389,11 +412,11 @@ class Nucdata(object):
return massu*931502.
def getNuclearMass_mev(self,EL,A):
- massu=self.getnuclearmass_u(EL,A)
+ massu=self.getNuclearMass_u(EL,A)
return massu*931.502
def getNuclearMass_kev(self,EL,A):
- massu=self.getnuclearmass_u(EL,A)
+ massu=self.getNuclearMass_u(EL,A)
return massu*931502.
def getReaction_u(self,EL1,A1,EL2,A2,EL3,A3,EL4,A4):
@@ -617,6 +640,26 @@ class Nucdata(object):
res=[v for v in nucleardata if v.get('SYM').strip().upper()== EL.upper() and v.get('A') == A]
return res[0].get('spin-parity')
+ def makeNucRandom(self,count,repeater):
+ alist=[]
+ zlist=[]
+ for k in range(0,count):
+ if repeater==0:
+ ok=0
+ while ok==0:
+ myz=nucrandom.randint(1,118)
+ ok=1 if (myz not in zlist) else 0
+ zlist.append(myz)
+ else:
+ zlist.append(nucrandom.randint(1,118))
+ mya=nucrandom.choice(self.getIsotopes(str(zlist[k])))
+ alist.append(mya)
+ return(zlist,alist)
+
+ def getRandomA(self,EL):
+ aRandomA=nucrandom.choice(self.getIsotopes(EL))
+ return(aRandomA)
+
elementdata=[] #list of dictionaries of Z, Elemental symbol, Name of element
filename=check_output("kpsewhich elementlist.csv", shell=True)
@@ -653,6 +696,18 @@ nuc=Nucdata()
\end{pycode}
%pythoncode
+%\begin{macro}{\nucAran}
+% \begin{macrocode}
+\newcommand{\nucAran}[1]{\pyc{singleAran=nuc.getRandomA('#1')}}
+% \end{macrocode}
+%\end{macro}
+
+%\begin{macro}{\nucrandom}
+% \begin{macrocode}
+\newcommand{\nucrandom}[2][0]{\pyc{zran,aran=nuc.makeNucRandom(#2,#1)}}
+% \end{macrocode}
+%\end{macro}
+
%\begin{macro}{\nucspin}
% \begin{macrocode}
\newcommand{\nucspin}[2]{\py{nuc.getSpin('#1',#2)}}
diff --git a/Master/texmf-dist/source/latex/nucleardata/nucleardata.ins b/Master/texmf-dist/source/latex/nucleardata/nucleardata.ins
index 8fd793b7b11..8bc936cb117 100644
--- a/Master/texmf-dist/source/latex/nucleardata/nucleardata.ins
+++ b/Master/texmf-dist/source/latex/nucleardata/nucleardata.ins
@@ -15,6 +15,8 @@
%%
%% See http://www.latex-project.org/lppl.txt
%%
+%% Version Date: 04/01/2016
+%%
%% ----------------------------------------------------------------
\input docstrip.tex
\keepsilent
@@ -30,6 +32,8 @@ Released under the LaTeX Project Public License v1.3c or later
See http://www.latex-project.org/lppl.txt
+Version Date: 04/01/2016
+
----------------------------------------------------------------
\endpreamble
\postamble
@@ -53,6 +57,8 @@ and the derived files nucleardata.ins,
massdata.csv,
nuccommandtest.tex,
nuccommandtext.pdf
+
+Version Date: 04/01/2016
\endpostamble
\usedir{./}
\generate{
@@ -79,5 +85,7 @@ and the derived files nucleardata.ins,
%% massdata.csv,
%% nuccommandtest.tex,
%% nuccommandtext.pdf
+%%
+%% Version Date: 04/01/2016
%%
%% End of file `nucleardata.ins'.
diff --git a/Master/texmf-dist/tex/latex/nucleardata/nucleardata.pytxcode b/Master/texmf-dist/tex/latex/nucleardata/nucleardata.pytxcode
index 29f15e528d7..0acf7e3fa54 100644
--- a/Master/texmf-dist/tex/latex/nucleardata/nucleardata.pytxcode
+++ b/Master/texmf-dist/tex/latex/nucleardata/nucleardata.pytxcode
@@ -1,8 +1,9 @@
-=>PYTHONTEX#py#default#default#0#code#####24#
+=>PYTHONTEX#py#default#default#0#code#####26#
import sys
import fileinput
import csv
from subprocess import check_output
+import random as nucrandom
u2Mev=931.502
u2kev=u2Mev*1000.
@@ -95,11 +96,11 @@ class Nucdata(object):
return massu*931502.
def getNuclearMass_mev(self,EL,A):
- massu=self.getnuclearmass_u(EL,A)
+ massu=self.getNuclearMass_u(EL,A)
return massu*931.502
def getNuclearMass_kev(self,EL,A):
- massu=self.getnuclearmass_u(EL,A)
+ massu=self.getNuclearMass_u(EL,A)
return massu*931502.
def getReaction_u(self,EL1,A1,EL2,A2,EL3,A3,EL4,A4):
@@ -323,6 +324,26 @@ class Nucdata(object):
res=[v for v in nucleardata if v.get('SYM').strip().upper()== EL.upper() and v.get('A') == A]
return res[0].get('spin-parity')
+ def makeNucRandom(self,count,repeater):
+ alist=[]
+ zlist=[]
+ for k in range(0,count):
+ if repeater==0:
+ ok=0
+ while ok==0:
+ myz=nucrandom.randint(1,118)
+ ok=1 if (myz not in zlist) else 0
+ zlist.append(myz)
+ else:
+ zlist.append(nucrandom.randint(1,118))
+ mya=nucrandom.choice(self.getIsotopes(str(zlist[k])))
+ alist.append(mya)
+ return(zlist,alist)
+
+ def getRandomA(self,EL):
+ aRandomA=nucrandom.choice(self.getIsotopes(EL))
+ return(aRandomA)
+
elementdata=[] #list of dictionaries of Z, Elemental symbol, Name of element
filename=check_output("kpsewhich elementlist.csv", shell=True)
diff --git a/Master/texmf-dist/tex/latex/nucleardata/nucleardata.sty b/Master/texmf-dist/tex/latex/nucleardata/nucleardata.sty
index 28b811e8755..07403be7765 100644
--- a/Master/texmf-dist/tex/latex/nucleardata/nucleardata.sty
+++ b/Master/texmf-dist/tex/latex/nucleardata/nucleardata.sty
@@ -15,9 +15,11 @@
%%
%% See http://www.latex-project.org/lppl.txt
%%
+%% Version Date: 04/01/2016
+%%
%% ----------------------------------------------------------------
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{nucleardata}[2015/01/06 v1.01b LaTeX package for providing basic nuclear properties to documents efficiently]
+\ProvidesPackage{nucleardata}[2016/04/01 v1.01c LaTeX package for providing basic nuclear properties to documents efficiently]
\RequirePackage{pythontex}
\RequirePackage{siunitx}
@@ -26,6 +28,7 @@ import sys
import fileinput
import csv
from subprocess import check_output
+import random as nucrandom
u2Mev=931.502
u2kev=u2Mev*1000.
@@ -118,11 +121,11 @@ class Nucdata(object):
return massu*931502.
def getNuclearMass_mev(self,EL,A):
- massu=self.getnuclearmass_u(EL,A)
+ massu=self.getNuclearMass_u(EL,A)
return massu*931.502
def getNuclearMass_kev(self,EL,A):
- massu=self.getnuclearmass_u(EL,A)
+ massu=self.getNuclearMass_u(EL,A)
return massu*931502.
def getReaction_u(self,EL1,A1,EL2,A2,EL3,A3,EL4,A4):
@@ -346,6 +349,26 @@ class Nucdata(object):
res=[v for v in nucleardata if v.get('SYM').strip().upper()== EL.upper() and v.get('A') == A]
return res[0].get('spin-parity')
+ def makeNucRandom(self,count,repeater):
+ alist=[]
+ zlist=[]
+ for k in range(0,count):
+ if repeater==0:
+ ok=0
+ while ok==0:
+ myz=nucrandom.randint(1,118)
+ ok=1 if (myz not in zlist) else 0
+ zlist.append(myz)
+ else:
+ zlist.append(nucrandom.randint(1,118))
+ mya=nucrandom.choice(self.getIsotopes(str(zlist[k])))
+ alist.append(mya)
+ return(zlist,alist)
+
+ def getRandomA(self,EL):
+ aRandomA=nucrandom.choice(self.getIsotopes(EL))
+ return(aRandomA)
+
elementdata=[] #list of dictionaries of Z, Elemental symbol, Name of element
filename=check_output("kpsewhich elementlist.csv", shell=True)
@@ -381,6 +404,10 @@ nuc=Nucdata()
\end{pycode}
+\newcommand{\nucAran}[1]{\pyc{singleAran=nuc.getRandomA('#1')}}
+
+\newcommand{\nucrandom}[2][0]{\pyc{zran,aran=nuc.makeNucRandom(#2,#1)}}
+
\newcommand{\nucspin}[2]{\py{nuc.getSpin('#1',#2)}}
\newcommand{\nucamassu}[3][6]{\py{round(nuc.getMass_u('#2',#3),#1)}}
@@ -457,5 +484,7 @@ nuc=Nucdata()
%% massdata.csv,
%% nuccommandtest.tex,
%% nuccommandtext.pdf
+%%
+%% Version Date: 04/01/2016
%%
%% End of file `nucleardata.sty'.