Skip to content

Commit

Permalink
Merge branch 'devel' into wangc/github_actions
Browse files Browse the repository at this point in the history
  • Loading branch information
wangcj05 authored Nov 4, 2024
2 parents 555982b + f1065ec commit 0f5dca2
Show file tree
Hide file tree
Showing 62 changed files with 6,762 additions and 2,492 deletions.
2 changes: 1 addition & 1 deletion dependencies.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Note all install methods after "main" take
<line_profiler optional='True'/>
<!-- <ete3 optional='True'/> -->
<statsforecast source="pip"/>
<pywavelets optional='True'>1.2</pywavelets>
<pywavelets>1.2</pywavelets>
<python-sensors source="pip"/>
<numdifftools source="pip">0.9</numdifftools>
<fmpy optional='True'/>
Expand Down
44 changes: 23 additions & 21 deletions doc/user_manual/ProbabilityDistributions.tex
Original file line number Diff line number Diff line change
Expand Up @@ -632,16 +632,16 @@ \subsubsection{1-Dimensional Continuous Distributions}
The \distname{Custom1D} distribution is a custom continuous distribution that can be initialized from a dataObject
generated by RAVEN.
This distribution cannot be initialized from a dataObject directly but through a .csv file.
This file must contain the values of either cdf or pdf of the random variable sampled along the range of the desired
This file must contain the values of either cdf or pdf of the random variable sampled along the range of the desired
random variable.
In the distribution block of the RAVEN input file, the user needs to specify which file (including its working directory)
needs to be used to initialize the distribution. In addition, the user is required to specify which type (cdf or pdf) or values
are contained in the file and also the IDs of both the random variable and cdf/pdf.
Thus the csv file contains a set of points that samples the function $pdf(x)$ or $cdf(x)$ for several values of the stochastic variable $x$.
Thus the csv file contains a set of points that samples the function $pdf(x)$ or $cdf(x)$ for several values of the stochastic variable $x$.
The user needs to specify which variable IDs correspond to $x$ and $pdf(x)$ (or $cdf(x)$).
The distribution create a fourth order spline interpolation from the provided input points.
%
Note that the support of this distribution is set between the minimum and maximum values of the random variable which are
Note that the support of this distribution is set between the minimum and maximum values of the random variable which are
specified in the distribution input file.

Refer to the test example ($tests/framework/test_distributionCustom1D.xml$) for more clarification.
Expand Down Expand Up @@ -687,8 +687,8 @@ \subsubsection{1-Dimensional Continuous Distributions}
\end{lstlisting}


The example above initializes two distributions from two .csv files.
For example, the first distribution retrieves the pdf values, located in the column with label $pdf_values$, for several locations of the variable located in the column
The example above initializes two distributions from two .csv files.
For example, the first distribution retrieves the pdf values, located in the column with label $pdf_values$, for several locations of the variable located in the column
with label $x$ in the file $PointSetFile2_dump.csv$.


Expand Down Expand Up @@ -857,11 +857,13 @@ \subsubsection{1-Dimensional Discrete Distributions.}
%%%%%% Categorical
\paragraph{Categorical Distribution}
\label{Categorical}
The \distname{Categorical} distribution is a discrete distribution that describes the result of a random variable that can have $K$ possible outcomes.
The \distname{Categorical} distribution is a discrete distribution that describes the result of a random variable that can have $K$ possible outcomes.
The probability of each outcome is separately specified.
The possible outcomes can be numerical values (either integer or float numbers) or strings.
%
There is not necessarily an underlying ordering of these outcomes, but labels are assigned in describing the distribution (in the range $1$ to $K$).
If the probabilities assigned to the states do not sum to 1, the weights will be normalized by the sum of the weights provided,
turning the weights into valid probabilities.
%
\specBlock{a}{Categorical}
%
Expand All @@ -875,16 +877,16 @@ \subsubsection{1-Dimensional Discrete Distributions.}
\subnodeIntro
\begin{itemize}
\item \xmlNode{rtol}, \xmlDesc{float, optional parameter}, relative tolerance used to identify close state in case of float or integer states, \default{1E-6}.
\item \xmlNode{state}, \xmlDesc{float, required parameter}, probability for outcome 1
\item \xmlNode{state}, \xmlDesc{float, required parameter}, probability (or weight) for outcome 1
\begin{itemize}
\item \xmlAttr{outcome}, \xmlDesc{float, required parameter}, outcome value.
\end{itemize}
\item \xmlNode{state}, \xmlDesc{float, required parameter}, probability for outcome 2
\item \xmlNode{state}, \xmlDesc{float, required parameter}, probability (or weight) for outcome 2
\begin{itemize}
\item \xmlAttr{outcome}, \xmlDesc{float, required parameter}, outcome value.
\end{itemize}
\item ...
\item \xmlNode{state}, \xmlDesc{float, required parameter}, probability for outcome K
\item \xmlNode{state}, \xmlDesc{float, required parameter}, probability (or weight) for outcome K
\begin{itemize}
\item \xmlAttr{outcome}, \xmlDesc{float, required parameter}, outcome value.
\end{itemize}
Expand Down Expand Up @@ -914,12 +916,12 @@ \subsubsection{1-Dimensional Discrete Distributions.}
\paragraph{Uniform Discrete Distribution}
\label{subsec:UniformDiscrete}

The \textbf{UniformDiscrete} distribution is a discrete distribution which describes a random variable
The \textbf{UniformDiscrete} distribution is a discrete distribution which describes a random variable
that can have $N$ values having equal probability value.
This distribution allows the user to choose two kinds of sampling strategies: with or without replacement.
In case the ``without replacement'' strategy is used, the distribution samples from the set of specified $N$ values
reduced by the previously sampled values.
After, the sampler has generated values for all variables, the distribution is
In case the ``without replacement'' strategy is used, the distribution samples from the set of specified $N$ values
reduced by the previously sampled values.
After, the sampler has generated values for all variables, the distribution is
resetted (i.e., the set of values that can be sampled is returned to $N$).
In case the ``with replacement'' strategy is used, the distribution samples always from the complete set of specified $N$ values.

Expand All @@ -937,7 +939,7 @@ \subsubsection{1-Dimensional Discrete Distributions.}
\item \xmlNode{lowerBound}, \xmlDesc{float, required parameter}, lower bound.
\item \xmlNode{upperBound}, \xmlDesc{float, required parameter}, upper bound.
\item \xmlNode{nPoints}, \xmlDesc{integer, optional parameter}, number of points between lower and upper bound
\item \xmlNode{strategy}, \xmlDesc{string, required parameter}, type of sampling strategy
\item \xmlNode{strategy}, \xmlDesc{string, required parameter}, type of sampling strategy
(withReplacement or withoutReplacement).
%
\end{itemize}
Expand Down Expand Up @@ -965,7 +967,7 @@ \subsubsection{1-Dimensional Discrete Distributions.}
\begin{itemize}
\item \xmlNode{transition}, \xmlDesc{float, optional field}, the transition matrix of given Markov model.
\item \xmlNode{dataFile}, \xmlDesc{string, optional xml node}. The path for the given data file, i.e. the transition matrix.
In this node, the following attribute should be specified:
In this node, the following attribute should be specified:
\begin{itemize}
\item \xmlAttr{fileType}, \xmlDesc{string, optional field}, the type of given data file, default is `csv'.
\end{itemize}
Expand All @@ -975,23 +977,23 @@ \subsubsection{1-Dimensional Discrete Distributions.}
the probability for outcome 1.
In this node, the following attribute should be specified:
\begin{itemize}
\item \xmlAttr{outcome}, \xmlDesc{float, required field}, outcome value.
\item \xmlAttr{index}, \xmlDesc{integer, required field}, the index of steady state probabilities corresponding to the transition matrix.
\item \xmlAttr{outcome}, \xmlDesc{float, required field}, outcome value.
\item \xmlAttr{index}, \xmlDesc{integer, required field}, the index of steady state probabilities corresponding to the transition matrix.
\end{itemize}
\item \xmlNode{state}, \xmlDesc{required xml node}. The output from this state indicates
the probability for outcome 2.
In this node, the following attribute should be specified:
\begin{itemize}
\item \xmlAttr{outcome}, \xmlDesc{float, required field}, outcome value.
\item \xmlAttr{index}, \xmlDesc{integer, required field}, the index of steady state probabilities corresponding to the transition matrix.
\item \xmlAttr{outcome}, \xmlDesc{float, required field}, outcome value.
\item \xmlAttr{index}, \xmlDesc{integer, required field}, the index of steady state probabilities corresponding to the transition matrix.
\end{itemize}
\item ...
\item \xmlNode{state}, \xmlDesc{required xml node}. The output from this state indicates
the probability for outcome K.
In this node, the following attribute should be specified:
\begin{itemize}
\item \xmlAttr{outcome}, \xmlDesc{float, required field}, outcome value.
\item \xmlAttr{index}, \xmlDesc{integer, required field}, the index of steady state probabilities corresponding to the transition matrix.
\item \xmlAttr{outcome}, \xmlDesc{float, required field}, outcome value.
\item \xmlAttr{index}, \xmlDesc{integer, required field}, the index of steady state probabilities corresponding to the transition matrix.
\end{itemize}

\end{itemize}
Expand Down
7 changes: 6 additions & 1 deletion doc/user_manual/code_interfaces/serpent.tex
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ \subsubsection{Models}
<!-- EOL parameters -->
<EOL target="absKeff">1.0</EOL>
<EOL target="impKeff">1.0</EOL>
<!-- Volume calculation -->
<volumeCalculation nPoints="1e9">True</volumeCalculation>
</Code>
</Models>
\end{lstlisting}
Expand Down Expand Up @@ -82,7 +84,10 @@ \subsubsection{Models}
\nb The output parser will generate an output variable called ``EOL\_\textit{target}'' that represents the time at which the
parameter ``target'' takes the value indicated in this node. For example, if ``target'' == absKeff and the value of the XML node is 1.0,
the variable ``EOL\_absKeff'' will contain the time (burnDays) at which the ``absKeff'' == 1.0.

\item \xmlNode{volumeCalculation}, \xmlDesc{bool, optional parameter}, true to activate the stochastic material volume calculation via Serpent ``checkvolumes'' command. If True, the execution of
SERPENT is always preceded with a volume calculation. If the user wants to use the volume calculation output file in its SERPENT template input, he needs to include
the filename in the SERPENT template input (e.g. include ``myInputFile.mvol'') value of the ``target'' at which the time (in burnup calculations) of end of life should be recorded.
The \xmlNode{volumeCalculation} node must contain the attribute \xmlAttr{nPoints}, which indicates the number of samples that needs to be used by SERPENT for the calculation of the volumes (e.g. 1e8).
\end{itemize}

\subsubsection{Files}
Expand Down
2 changes: 1 addition & 1 deletion doc/user_manual/generated/generateOptimizerDoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ def insertSolnExport(tex, obj):
msg+= exampleFactory[name]

fName = os.path.abspath(os.path.join(os.path.dirname(__file__), 'optimizer.tex'))
with open(fName, 'w') as f:
with open(fName, 'w', encoding='utf-8') as f:
f.writelines(msg)

print(f'\nSuccessfully wrote "{fName}"')
46 changes: 42 additions & 4 deletions doc/user_manual/generated/generateRomDoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,41 @@
\end{lstlisting}
"""

mra = r"""
\hspace{24pt}
Example:
\begin{lstlisting}[style=XML,morekeywords={name,subType,pivotLength,shift,target,threshold,period,width}]
<Simulation>
...
<Models>
...
<ROM name="synth" subType="MultiResolutionTSA">
<Target>signal1, signal2, hour</Target>
<Features>scaling</Features>
<pivotParameter>hour</pivotParameter>
<filterbankdwt target="signal0,signal1" seed='42'>
<family>db8</family>
<levels>3</levels>
</filterbankdwt>
<Segment grouping="decomposition">
<Target>signal0,signal1, pivot</Target>
<Features>scaling</Features>
<macroParameter>macro</macroParameter>
<pivotParameter>pivot</pivotParameter>
<gaussianize target="signal0,signal1"/>
<arma target="signal0,signal1" seed='42'>
<P>1,1</P>
<Q>1,2</Q>
</arma>
</Segment>
</ROM>
...
</Models>
...
</Simulation>
\end{lstlisting}
"""

synthetic = r"""
\hspace{24pt}
Example:
Expand Down Expand Up @@ -1263,6 +1298,7 @@
'MSR': msr,
'NDinvDistWeight':invDist,
'SyntheticHistory': synthetic,
'MultiResolutionTSA': mra,
'ARMA': armaExp,
'PolyExponential': poly,
'DMD': dmd,
Expand Down Expand Up @@ -1389,7 +1425,8 @@
'Collection',
'Segments',
'Clusters',
'Interpolated']
'Interpolated',
'Decomposition']
validDNNRom = ['KerasMLPClassifier',
'KerasMLPRegression',
'KerasConvNetClassifier',
Expand All @@ -1403,6 +1440,7 @@
'MSR',
'NDinvDistWeight',
'SyntheticHistory',
'MultiResolutionTSA',
'ARMA',
'PolyExponential',
'DMD',
Expand Down Expand Up @@ -1451,14 +1489,14 @@
internalRom += segmentTex
internalRom += exampleTex
except:
print('Can not generate latex file for ' + name)
print(f'Can not generate latex file for {name}')

fName = os.path.abspath(os.path.join(os.path.dirname(__file__), 'internalRom.tex'))
with open(fName, 'w') as f:
with open(fName, 'w', encoding='utf-8') as f:
f.writelines(internalRom)
print(f'\nSuccessfully wrote "{fName}"')

fName = os.path.abspath(os.path.join(os.path.dirname(__file__), 'sklRom.tex'))
with open(fName, 'w') as f:
with open(fName, 'w', encoding='utf-8') as f:
f.writelines(sklROM)
print(f'\nSuccessfully wrote "{fName}"')
Loading

0 comments on commit 0f5dca2

Please sign in to comment.