Skip to content
Snippets Groups Projects
Commit 96bee2e4 authored by Celine Durniak's avatar Celine Durniak
Browse files

Merge branch 'fit_python_ex' into develop

Conflicts:
	Doc/UserManual/UserManual.pdf
parents 12272a9d fa6f6d29
No related branches found
No related tags found
No related merge requests found
...@@ -77,8 +77,8 @@ void TestFittingModule1::execute() ...@@ -77,8 +77,8 @@ void TestFittingModule1::execute()
//m_fitSuite->setMinimizer( MinimizerFactory::createMinimizer("Scan") ); //m_fitSuite->setMinimizer( MinimizerFactory::createMinimizer("Scan") );
m_fitSuite->attachObserver( FitSuiteObserverFactory::createPrintObserver() ); m_fitSuite->attachObserver( FitSuiteObserverFactory::createPrintObserver() );
m_fitSuite->attachObserver( FitSuiteObserverFactory::createDrawObserver() ); //m_fitSuite->attachObserver( FitSuiteObserverFactory::createDrawObserver() );
m_fitSuite->attachObserver( FitSuiteObserverFactory::createTreeObserver() ); //m_fitSuite->attachObserver( FitSuiteObserverFactory::createTreeObserver() );
m_fitSuite->runFit(); m_fitSuite->runFit();
} }
......
%\newpage %\newpage
\chapter{Examples} \chapter{Examples} \label{Exampleschap}
%\section{Examples} %\section{Examples}
%\subsection{Hello listing}
%\begin{lstlisting}[language=python, style=eclipse]
%mAmbience = MaterialManager.getHomogeneousMaterial("Air", 1.0, 0.0 )
%mSubstrate = MaterialManager.getHomogeneousMaterial("Substrate", 1.0-6e-6, 2e-8 )
%n_particle = complex(1.0-6e-4, 2e-8)
%cylinder_ff = FormFactorCylinder(5*nanometer, 5*nanometer)
%cylinder = Particle(n_particle, cylinder_ff)
%prism_ff = FormFactorPrism3(5*nanometer, 5*nanometer)
%prism = Particle(n_particle, prism_ff)
%particle_decoration = ParticleDecoration()
%particle_decoration.addParticle(cylinder, 0.0, 0.5)
%particle_decoration.addParticle(prism, 0.0, 0.5)
%interference = InterferenceFunctionNone()
%particle_decoration.addInterferenceFunction(interference)
%# air layer with particles and substrate form multi layer
%air_layer = Layer(mAmbience)
%air_layer_decorator = LayerDecorator(air_layer, particle_decoration)
%substrate_layer = Layer(mSubstrate, 0)
%multi_layer = MultiLayer()
%multi_layer.addLayer(air_layer_decorator)
%multi_layer.addLayer(substrate_layer)
%# build and run experiment
%simulation = Simulation()
%simulation.setDetectorParameters(100,-1.0*degree, 1.0*degree, 100, 0.0*degree 2.0*degree, True)
%simulation.setBeamParameters(1.0*angstrom, -0.2*degree, 0.0*degree)
%simulation.setSample(multi_layer)
%simulation.runSimulation()
%\end{lstlisting}
\section{General methodology} \section{General methodology}
A simulation of GISAXS using BornAgain platform can be decomposed into the following points: A simulation of GISAXS using \BornAgain\ platform can be decomposed into the following points:
\begin{itemize} \begin{itemize}
\item Definition of the materials by specifying their names and their \item Definition of the materials by specifying their names and their
refractive indices, refractive indices,
...@@ -72,7 +41,7 @@ roughnesses (equal to 0 by default) and the refractive index of the ...@@ -72,7 +41,7 @@ roughnesses (equal to 0 by default) and the refractive index of the
material. We do not define any dimensions in the $x$, $y$ material. We do not define any dimensions in the $x$, $y$
directions. And, except for roughness, the layer's vertical boundaries are plane and directions. And, except for roughness, the layer's vertical boundaries are plane and
perpendicular to the $z$-axis. There is also no limitation to the perpendicular to the $z$-axis. There is also no limitation to the
number of layers that could be defined in BornAgain.\\ number of layers that could be defined in \BornAgain.\\
\noindent {\huge\danger} \noindent {\huge\danger}
\colorbox{Lightgray}{\parbox{\dimexpr\linewidth-8\fboxsep} \colorbox{Lightgray}{\parbox{\dimexpr\linewidth-8\fboxsep}
...@@ -81,7 +50,7 @@ When assembling the sample, the layers are defined from top to ...@@ -81,7 +50,7 @@ When assembling the sample, the layers are defined from top to
bottom. So in most cases the first layer will be the air layer.}}\\ bottom. So in most cases the first layer will be the air layer.}}\\
\noindent The particles are characterized by their form factors (\textit{i.e.} the Fourier transform of the shape function - see the list of form factors implemented \noindent The particles are characterized by their form factors (\textit{i.e.} the Fourier transform of the shape function - see the list of form factors implemented
in BornAgain) and in \BornAgain) and
the refractive index of the composing material. The number of input parameters for the form the refractive index of the composing material. The number of input parameters for the form
factor depends on the factor depends on the
particle symmetry; it ranges from one parameter for a sphere (its particle symmetry; it ranges from one parameter for a sphere (its
...@@ -130,11 +99,10 @@ parameter like, for example, \texttt{20.0*Units::micrometer} in C++. ...@@ -130,11 +99,10 @@ parameter like, for example, \texttt{20.0*Units::micrometer} in C++.
\subsection{Programs} \subsection{Programs}
\noindent \smallpencil \colorbox{Lightgray}{\parbox{\dimexpr\linewidth-8\fboxsep} \MakeRemark{Programming}{The examples presented in the next
{\underline{Programming}: The examples presented in the next
paragraphs are written in C++ or Python. For tutorials about these paragraphs are written in C++ or Python. For tutorials about these
programming languages, the users are referred to programming languages, the users are referred to
\cite{Cppref} and \cite{Pythonref} respectively.}}\\ \cite{Cppref} and \cite{Pythonref} respectively.}\\
\noindent Note about the version of C++ and Python to run the \noindent Note about the version of C++ and Python to run the
examples.\\ examples.\\
...@@ -161,7 +129,7 @@ modules (lines~\ref{import_begin}-\ref{import_end}). For example, ...@@ -161,7 +129,7 @@ modules (lines~\ref{import_begin}-\ref{import_end}). For example,
line~\ref{import_numpy} imports NumPy, which line~\ref{import_numpy} imports NumPy, which
is a fundamental package for scientific computing with Python is a fundamental package for scientific computing with Python
(\url{http://www.numpy.org/}). In particular, line~\ref{import_end} (\url{http://www.numpy.org/}). In particular, line~\ref{import_end}
imports the features of BornAgain software.\\ imports the features of \BornAgain\ software.\\
\noindent Finally line~\ref{def_function} marks the beginning of the \noindent Finally line~\ref{def_function} marks the beginning of the
function to define and run the simulation. function to define and run the simulation.
...@@ -221,7 +189,7 @@ prism = Particle(n_particle, prism_ff) @\label{particlesprism2}@ ...@@ -221,7 +189,7 @@ prism = Particle(n_particle, prism_ff) @\label{particlesprism2}@
\end{lstlisting} \end{lstlisting}
\noindent We implement two different shapes of particles: cylinders and \noindent We implement two different shapes of particles: cylinders and
prisms (\textit{i.e.} elongated particles with a constant equilateral triangular cross section).\\ All particles implemented in BornAgain are defined by their prisms (\textit{i.e.} elongated particles with a constant equilateral triangular cross section).\\ All particles implemented in \BornAgain\ are defined by their
form factors, their sizes and the refractive index of the material form factors, their sizes and the refractive index of the material
they are made of. Here, for the they are made of. Here, for the
cylindrical particle, we input its radius and its height. For the prism, cylindrical particle, we input its radius and its height. For the prism,
...@@ -368,7 +336,7 @@ are the minimum and maximum values respectively of $\phi_f$, which is the in-pla ...@@ -368,7 +336,7 @@ are the minimum and maximum values respectively of $\phi_f$, which is the in-pla
the number of points in the range of variations of the exit angle the number of points in the range of variations of the exit angle
$\alpha_f$ measured from the $x,y$-plane in the $z$-direction,\\ \texttt{alpha\_f\_min=0.0*degree} and \texttt{alpha\_f\_max=2.0*degree} $\alpha_f$ measured from the $x,y$-plane in the $z$-direction,\\ \texttt{alpha\_f\_min=0.0*degree} and \texttt{alpha\_f\_max=2.0*degree}
are the minimum and maximum values respectively of $\alpha_f$,\\ are the minimum and maximum values respectively of $\alpha_f$,\\
\texttt{isgisaxs\_style=True} (default value = False) is a boolean \texttt{isgisaxs\_style=True} (default value = \texttt{False}) is a boolean
used to characterise the structure of the output data. If used to characterise the structure of the output data. If
\texttt{isgisaxs\_style=True}, the output data is binned at constant \texttt{isgisaxs\_style=True}, the output data is binned at constant
values of the sine of the output angles, $\alpha_f$ and $\phi_f$, otherwise it is binned values of the sine of the output angles, $\alpha_f$ and $\phi_f$, otherwise it is binned
...@@ -382,7 +350,7 @@ at constant values of these two angles.\\ ...@@ -382,7 +350,7 @@ at constant values of these two angles.\\
grazing angle on the surface of the sample, grazing angle on the surface of the sample,
\texttt{phi\_i=0.0*degree} is the in-plane \texttt{phi\_i=0.0*degree} is the in-plane
direction of the incident beam (measured with respect to the direction of the incident beam (measured with respect to the
$x$-axis). Note that in Fig.\ref{fig:multil3d} $\alpha_i=\alpha_0$ and $\phi_i=\phi_0$.\\ $x$-axis). Note that in Fig.~\ref{fig:multil3d} $\alpha_i=\alpha_0$ and $\phi_i=\phi_0$.\\
\noindent \underline{Remark}: Note that, except for \noindent \underline{Remark}: Note that, except for
\texttt{isgisaxs\_style}, there are no default values implemented for the \texttt{isgisaxs\_style}, there are no default values implemented for the
...@@ -404,7 +372,7 @@ return GetOutputData(simulation) @\label{outputdata}@%arr = GetOutputData(simula ...@@ -404,7 +372,7 @@ return GetOutputData(simulation) @\label{outputdata}@%arr = GetOutputData(simula
as a function of outgoing angles $\alpha_f$ and $\phi_f$ for further as a function of outgoing angles $\alpha_f$ and $\phi_f$ for further
uses (plots, fits,\ldots) as a NumPy array containing uses (plots, fits,\ldots) as a NumPy array containing
\texttt{n\_phi}$\times$\texttt{n\_alpha} \texttt{n\_phi}$\times$\texttt{n\_alpha}
datapoints. Some options are provided by BornAgain. For example, figure~\ref{fig:output_ex1} shows the two-dimensional datapoints. Some options are provided by \BornAgain. For example, figure~\ref{fig:output_ex1} shows the two-dimensional
contourplot of the intensity as a function of $\alpha_f$ and contourplot of the intensity as a function of $\alpha_f$ and
$\phi_f$. $\phi_f$.
......
This diff is collapsed.
...@@ -146,15 +146,16 @@ keepaspectratio]{results2_2.png}% ...@@ -146,15 +146,16 @@ keepaspectratio]{results2_2.png}%
\maketitle \maketitle
\tableofcontents \tableofcontents
%\lstlistoflistings \lstlistoflistings
%\listoffigures %\listoffigures
%\listoftables \listoftables
\input{Introduction} %\input{Introduction}
\input{QuickStart} %\input{QuickStart}
\input{SoftwareArchitecture} %\input{SoftwareArchitecture}
\input{Installation} %\input{Installation}
\input{Examples} \input{Examples}
%\input{Fitting}
%List of notations\\ Bugs\\ License agreement\\ Directory layout \\ FAQ \\ Future development. %List of notations\\ Bugs\\ License agreement\\ Directory layout \\ FAQ \\ Future development.
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
context, ERROR, WARNING, INFO, enum}, context, ERROR, WARNING, INFO, enum},
morecomment=[l]{//}, morecomment=[l]{//},
morecomment=[s]{/*}{*/}, morecomment=[s]{/*}{*/},
% FIXME: listings does not see guillemots, so any regions with them wont work % FIXME: listings does not see guillemets, so any regions with them wont work
morecomment=[s]{«REM»}{«ENDREM»}, morecomment=[s]{«REM»}{«ENDREM»},
morecomment=[s]{«REM}{»}, morecomment=[s]{«REM}{»},
morestring=[s]{'}{'}, morestring=[s]{'}{'},
...@@ -262,16 +262,16 @@ breaklines = true ...@@ -262,16 +262,16 @@ breaklines = true
stringstyle=\color{darkblue}, stringstyle=\color{darkblue},
numberstyle=\color{darkgrey}\lstfontfamily, numberstyle=\color{darkgrey}\lstfontfamily,
emph={Simulation,MaterialManager,MultiLayer,Layer,Particle,ParticleDecoration}, emph={Simulation,MaterialManager,MultiLayer,Layer,Particle,ParticleDecoration},
emphstyle=\color{dockerblue},%dred}, %darkpink}, emphstyle=\color{dockerblue},
% emphstyle=\color{red}, backgroundcolor=\color{lightlightgrey},
backgroundcolor=\color{lightgrey},
morecomment=[s][\color{lightblue}]{/**}{*/}, morecomment=[s][\color{lightblue}]{/**}{*/},
showstringspaces=false, showstringspaces=false,
numbers=left,%none, numbers=left,
emphstyle={[2]\color{blue}}, emphstyle={[2]\color{blue}},
frame=shadowbox, frame=single,
firstnumber=auto, firstnumber=auto,
rulesepcolor=\color{darkgrey}, rulesepcolor=\color{darkgrey},
rulecolor=\color{darkgrey},
breaklines = true breaklines = true
%showspaces=true, %showspaces=true,
%showtabs=true, %showtabs=true,
......
...@@ -102,7 +102,7 @@ void FitSuite::runFit() ...@@ -102,7 +102,7 @@ void FitSuite::runFit()
// running minimization using strategies // running minimization using strategies
m_fit_strategies.minimize(); m_fit_strategies.minimize();
// seting parameters to the optimum values found by the minimizer // setting parameters to the optimum values found by the minimizer
m_fit_parameters.setValues(m_minimizer->getValueOfVariablesAtMinimum()); m_fit_parameters.setValues(m_minimizer->getValueOfVariablesAtMinimum());
// calling observers to let them to get results // calling observers to let them to get results
...@@ -123,7 +123,7 @@ void FitSuite::minimize() ...@@ -123,7 +123,7 @@ void FitSuite::minimize()
// initializing minimizer's parameters with the list of local fit parameters // initializing minimizer's parameters with the list of local fit parameters
m_minimizer->setParameters(m_fit_parameters); m_minimizer->setParameters(m_fit_parameters);
// setting number of free parameters for propper chi2 normalization // setting number of free parameters for proper chi2 normalization
m_fit_objects.setNfreeParameters((int)m_fit_parameters.getNfreeParameters()); m_fit_objects.setNfreeParameters((int)m_fit_parameters.getNfreeParameters());
// minimizing // minimizing
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment