From 4f3bd8c4d7c277daea608c26c2bedc8ffb02dea8 Mon Sep 17 00:00:00 2001 From: bandango Date: Mon, 24 Jul 2017 14:25:14 +0200 Subject: [PATCH] 0.1.2! --- REQUIREMENTS | 2 +- doc/src/api.ind | 53 +++++---- doc/src/api.tex | 3 +- doc/src/quickref.tex | 5 +- doc/src/theia-module.tex | 14 ++- doc/src/theia.helpers-module.tex | 14 ++- doc/src/theia.helpers.core-module.tex | 119 +++++++++++++++++++ doc/src/theia.helpers.geometry-module.tex | 4 +- doc/src/theia.helpers.interaction-module.tex | 7 +- doc/src/theia.helpers.settings-module.tex | 2 +- doc/src/theia.helpers.tools-module.tex | 2 +- doc/src/theia.helpers.units-module.tex | 2 +- doc/src/theia.main-module.tex | 2 +- doc/src/theia.optics-module.tex | 8 +- doc/src/theia.optics.beam-module.tex | 2 +- doc/src/theia.optics.beamdump-module.tex | 2 +- doc/src/theia.optics.component-module.tex | 2 +- doc/src/theia.optics.ghost-module.tex | 2 +- doc/src/theia.optics.lens-module.tex | 4 +- doc/src/theia.optics.mirror-module.tex | 4 +- doc/src/theia.optics.optic-module.tex | 2 +- doc/src/theia.optics.thicklens-module.tex | 2 +- doc/src/theia.optics.thinlens-module.tex | 2 +- doc/src/theia.rendering-module.tex | 8 +- doc/src/theia.rendering.features-module.tex | 2 +- doc/src/theia.rendering.shapes-module.tex | 2 +- doc/src/theia.rendering.writer-module.tex | 2 +- doc/src/theia.running-module.tex | 8 +- doc/src/theia.running.parser-module.tex | 2 +- doc/src/theia.running.simulation-module.tex | 2 +- doc/src/theia.tree-module.tex | 8 +- doc/src/theia.tree.beamtree-module.tex | 4 +- doc/src/userguide.tex | 14 ++- tests/syntax.py | 2 +- tests/test_optics.py | 2 +- tests/test_rendering.py | 8 +- tests/test_simulation.py | 11 +- tests/test_simulation.tia | 28 +++++ tests/test_tree.py | 2 +- theia/optics/beam.py | 4 +- theia/optics/lens.py | 4 +- theia/optics/mirror.py | 8 +- theia/optics/optic.py | 22 ++-- theia/running/parser.py | 22 ++-- tutos/optimization.py | 3 +- tutos/sphere.py | 3 +- tutos/telescope.py | 3 +- tutos/vignale.py | 3 +- 48 files changed, 304 insertions(+), 132 deletions(-) create mode 100644 doc/src/theia.helpers.core-module.tex create mode 100644 tests/test_simulation.tia diff --git a/REQUIREMENTS b/REQUIREMENTS index 27126e6..43f1f60 100644 --- a/REQUIREMENTS +++ b/REQUIREMENTS @@ -6,4 +6,4 @@ Compiling the documentation requires: pdflatex Full-fledged usage requires: - FreeCAD libraries (available in major GNU?Linux distros) + FreeCAD libraries (available in major GNU/Linux distros) diff --git a/doc/src/api.ind b/doc/src/api.ind index 1070b33..f90a75d 100644 --- a/doc/src/api.ind +++ b/doc/src/api.ind @@ -2,50 +2,51 @@ \item theia \textit{(package)}, \hyperpage{5--6} \subitem theia.helpers \textit{(package)}, \hyperpage{7} + \subsubitem theia.helpers.core \textit{(module)}, \hyperpage{8} \subsubitem theia.helpers.geometry \textit{(module)}, - \hyperpage{8--10} + \hyperpage{9--11} \subsubitem theia.helpers.interaction \textit{(module)}, - \hyperpage{11} - \subsubitem theia.helpers.settings \textit{(module)}, \hyperpage{12} + \subsubitem theia.helpers.settings \textit{(module)}, + \hyperpage{13} \subsubitem theia.helpers.tools \textit{(module)}, - \hyperpage{13--15} - \subsubitem theia.helpers.units \textit{(module)}, \hyperpage{16} - \subitem theia.main \textit{(module)}, \hyperpage{17} - \subsubitem theia.main.main \textit{(function)}, \hyperpage{17} - \subitem theia.optics \textit{(package)}, \hyperpage{18} + \hyperpage{14--16} + \subsubitem theia.helpers.units \textit{(module)}, \hyperpage{17} + \subitem theia.main \textit{(module)}, \hyperpage{18} + \subsubitem theia.main.main \textit{(function)}, \hyperpage{18} + \subitem theia.optics \textit{(package)}, \hyperpage{19} \subsubitem theia.optics.beam \textit{(module)}, - \hyperpage{19--22} + \hyperpage{20--23} \subsubitem theia.optics.beamdump \textit{(module)}, - \hyperpage{23--25} + \hyperpage{24--26} \subsubitem theia.optics.component \textit{(module)}, - \hyperpage{26--28} + \hyperpage{27--29} \subsubitem theia.optics.ghost \textit{(module)}, - \hyperpage{29--31} + \hyperpage{30--32} \subsubitem theia.optics.lens \textit{(module)}, - \hyperpage{32--35} + \hyperpage{33--36} \subsubitem theia.optics.mirror \textit{(module)}, - \hyperpage{36--40} + \hyperpage{37--41} \subsubitem theia.optics.optic \textit{(module)}, - \hyperpage{41--43} + \hyperpage{42--44} \subsubitem theia.optics.thicklens \textit{(module)}, - \hyperpage{44--46} + \hyperpage{45--47} \subsubitem theia.optics.thinlens \textit{(module)}, - \hyperpage{47--49} - \subitem theia.rendering \textit{(package)}, \hyperpage{50} + \hyperpage{48--50} + \subitem theia.rendering \textit{(package)}, \hyperpage{51} \subsubitem theia.rendering.features \textit{(module)}, - \hyperpage{51--55} + \hyperpage{52--56} \subsubitem theia.rendering.shapes \textit{(module)}, - \hyperpage{56} - \subsubitem theia.rendering.writer \textit{(module)}, \hyperpage{57} - \subitem theia.running \textit{(package)}, \hyperpage{58} + \subsubitem theia.rendering.writer \textit{(module)}, + \hyperpage{58} + \subitem theia.running \textit{(package)}, \hyperpage{59} \subsubitem theia.running.parser \textit{(module)}, - \hyperpage{59--60} + \hyperpage{60--61} \subsubitem theia.running.simulation \textit{(module)}, - \hyperpage{61--63} - \subitem theia.tree \textit{(package)}, \hyperpage{64} + \hyperpage{62--64} + \subitem theia.tree \textit{(package)}, \hyperpage{65} \subsubitem theia.tree.beamtree \textit{(module)}, - \hyperpage{65--67} + \hyperpage{66--68} \end{theindex} diff --git a/doc/src/api.tex b/doc/src/api.tex index ae86c87..f984b25 100644 --- a/doc/src/api.tex +++ b/doc/src/api.tex @@ -3,7 +3,7 @@ % Include File % % Generated by epydoc 3.0.1 -% [Tue Jul 11 10:03:01 2017] +% [Mon Jul 24 12:23:27 2017] % \documentclass{article} \usepackage{alltt, parskip, fancyhdr, boxedminipage} @@ -109,6 +109,7 @@ \include{theia-module} \include{theia.helpers-module} +\include{theia.helpers.core-module} \include{theia.helpers.geometry-module} \include{theia.helpers.interaction-module} \include{theia.helpers.settings-module} diff --git a/doc/src/quickref.tex b/doc/src/quickref.tex index 439823d..927d3e2 100644 --- a/doc/src/quickref.tex +++ b/doc/src/quickref.tex @@ -33,11 +33,12 @@ \tt{gh} & \tt{X}, \tt{Y}, \tt{Z} (position of center of HR), \tt{Theta}, \tt{Phi} (orientation of HR Norm, pointing out), \tt{Diameter}, \tt{Ref} & \tt{X}~=~0., \tt{Y}~=~0., \tt{Z}~=~0., \tt{Theta}~=~pi/2., \tt{Phi}~=~0., \tt{Diameter}~=~5.cm, \tt{Ref}~=~None & This component does not affect the beams, but just allows to have a new entry in the output file for the beam emerging from the ghost surface. It does not have a 3D rendering object associated. \\ \hline \end{tabular} -\begin{multicols}{2} - +\begin{multicols}{3} +\paragraph{Keys.} \tt{bo} (new coordinate origin), \tt{bm} (input beam), \tt{mr} (mirror), \tt{th} (thin lens), \tt{tk} (thick lens), \tt{bd} (beam dump), \tt{gh} (ghost surface) \paragraph{Units.}(km, m = 1., cm, mm, um, nm), (kW, W = 1., mW, uW, nW), (THz, GHz, MHz, kHz, Hz = 1., mHz, uHz), (ppm = 1.e-6, rad = 1., deg), pi \paragraph{Functions.} sin, cos, tan, arcsin, arccos, arctan, sqrt, exp + \paragraph{Notes.}\begin{itemize} \item \tt{Theta}, \tt{Phi} are spherical coordinates around $e_Z$ and \tt{Phi = 0.} $\leftrightarrow~ + e_X$ \item All constructors can be called without arguments, all parameters have default values. diff --git a/doc/src/theia-module.tex b/doc/src/theia-module.tex index 200239b..a1fd206 100644 --- a/doc/src/theia-module.tex +++ b/doc/src/theia-module.tex @@ -3,7 +3,7 @@ % Package theia % % Generated by epydoc 3.0.1 -% [Tue Jul 11 10:03:01 2017] +% [Mon Jul 24 12:23:27 2017] % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -17,15 +17,15 @@ \section{Package theia} This is theia, a Python package for Gaussian ray tracing in 3D optical setups. -\textbf{Version:} 0.1.1 +\textbf{Version:} 0.1.2 -\textbf{Author:} R. Duque +\textbf{Author:} Raphaël Duque -\textbf{Copyright:} Copyright 2017, R. Duque +\textbf{Copyright:} Copyright 2017, Raphaël Duque @@ -50,6 +50,12 @@ \subsection{Modules} \begin{itemize} \setlength{\parskip}{0ex} + \item \textbf{core}: Defines some additional spice for theia. + + + + \textit{(Section \ref{theia:helpers:core}, p.~\pageref{theia:helpers:core})} + \item \textbf{geometry}: Geometry module for theia. diff --git a/doc/src/theia.helpers-module.tex b/doc/src/theia.helpers-module.tex index ae822c5..dc4c3b2 100644 --- a/doc/src/theia.helpers-module.tex +++ b/doc/src/theia.helpers-module.tex @@ -3,7 +3,7 @@ % Package theia.helpers % % Generated by epydoc 3.0.1 -% [Tue Jul 11 10:03:01 2017] +% [Mon Jul 24 12:23:27 2017] % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -18,15 +18,15 @@ \section{Package theia.helpers} It provides it provides all sorts of generic functions for theia. -\textbf{Version:} 0.1.1 +\textbf{Version:} 0.1.2 -\textbf{Author:} R. Duque +\textbf{Author:} Raphaël Duque -\textbf{Copyright:} Copyright 2017, R. Duque +\textbf{Copyright:} Copyright 2017, Raphaël Duque @@ -43,6 +43,12 @@ \subsection{Modules} \begin{itemize} \setlength{\parskip}{0ex} +\item \textbf{core}: Defines some additional spice for theia. + + + + \textit{(Section \ref{theia:helpers:core}, p.~\pageref{theia:helpers:core})} + \item \textbf{geometry}: Geometry module for theia. diff --git a/doc/src/theia.helpers.core-module.tex b/doc/src/theia.helpers.core-module.tex new file mode 100644 index 0000000..f21d802 --- /dev/null +++ b/doc/src/theia.helpers.core-module.tex @@ -0,0 +1,119 @@ +% +% API Documentation for theia +% Module theia.helpers.core +% +% Generated by epydoc 3.0.1 +% [Mon Jul 24 12:23:27 2017] +% + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Module Description %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + \index{theia \textit{(package)}!theia.helpers \textit{(package)}!theia.helpers.core \textit{(module)}|(} +\section{Module theia.helpers.core} + + \label{theia:helpers:core} +Defines some additional spice for theia. + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Functions %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + \subsection{Functions} + + \label{theia:helpers:core:gbeamInit} + \index{theia \textit{(package)}!theia.helpers \textit{(package)}!theia.helpers.core \textit{(module)}!theia.helpers.core.gbeamInit \textit{(function)}} + + \vspace{0.5ex} + +\hspace{.8\funcindent}\begin{boxedminipage}{\funcwidth} + + \raggedright \textbf{gbeamInit}(\textit{menu}) + + \vspace{-1.5ex} + + \rule{\textwidth}{0.5\fboxrule} +\setlength{\parskip}{2ex} + Pick in the menu. + +\setlength{\parskip}{1ex} + \end{boxedminipage} + + \label{theia:helpers:core:hang} + \index{theia \textit{(package)}!theia.helpers \textit{(package)}!theia.helpers.core \textit{(module)}!theia.helpers.core.hang \textit{(function)}} + + \vspace{0.5ex} + +\hspace{.8\funcindent}\begin{boxedminipage}{\funcwidth} + + \raggedright \textbf{hang}() + + \vspace{-1.5ex} + + \rule{\textwidth}{0.5\fboxrule} +\setlength{\parskip}{2ex} + The whole hangman game, from welcome to exit. + +\setlength{\parskip}{1ex} + \end{boxedminipage} + + \label{theia:helpers:core:magazzu} + \index{theia \textit{(package)}!theia.helpers \textit{(package)}!theia.helpers.core \textit{(module)}!theia.helpers.core.magazzu \textit{(function)}} + + \vspace{0.5ex} + +\hspace{.8\funcindent}\begin{boxedminipage}{\funcwidth} + + \raggedright \textbf{magazzu}() + +\setlength{\parskip}{2ex} +\setlength{\parskip}{1ex} + \end{boxedminipage} + + \label{theia:helpers:core:pong} + \index{theia \textit{(package)}!theia.helpers \textit{(package)}!theia.helpers.core \textit{(module)}!theia.helpers.core.pong \textit{(function)}} + + \vspace{0.5ex} + +\hspace{.8\funcindent}\begin{boxedminipage}{\funcwidth} + + \raggedright \textbf{pong}() + +\setlength{\parskip}{2ex} +\setlength{\parskip}{1ex} + \end{boxedminipage} + + \label{theia:helpers:core:pendu} + \index{theia \textit{(package)}!theia.helpers \textit{(package)}!theia.helpers.core \textit{(module)}!theia.helpers.core.pendu \textit{(function)}} + + \vspace{0.5ex} + +\hspace{.8\funcindent}\begin{boxedminipage}{\funcwidth} + + \raggedright \textbf{pendu}() + +\setlength{\parskip}{2ex} +\setlength{\parskip}{1ex} + \end{boxedminipage} + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Variables %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + \subsection{Variables} + + \vspace{-1cm} +\hspace{\varindent}\begin{longtable}{|p{\varnamewidth}|p{\vardescrwidth}|l} +\cline{1-2} +\cline{1-2} \centering \textbf{Name} & \centering \textbf{Description}& \\ +\cline{1-2} +\endhead\cline{1-2}\multicolumn{3}{r}{\small\textit{continued on next page}}\\\endfoot\cline{1-2} +\endlastfoot\raggedright \_\-\_\-p\-a\-c\-k\-a\-g\-e\-\_\-\_\- & \raggedright \textbf{Value:} +{\tt \texttt{'}\texttt{theia.helpers}\texttt{'}}&\\ +\cline{1-2} +\end{longtable} + + \index{theia \textit{(package)}!theia.helpers \textit{(package)}!theia.helpers.core \textit{(module)}|)} diff --git a/doc/src/theia.helpers.geometry-module.tex b/doc/src/theia.helpers.geometry-module.tex index 711ad62..36799f2 100644 --- a/doc/src/theia.helpers.geometry-module.tex +++ b/doc/src/theia.helpers.geometry-module.tex @@ -3,7 +3,7 @@ % Module theia.helpers.geometry % % Generated by epydoc 3.0.1 -% [Tue Jul 11 10:03:01 2017] +% [Mon Jul 24 12:23:27 2017] % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -201,7 +201,7 @@ \section{Module theia.helpers.geometry} a,b: unit 3D vectors. [3D np.arrays] - Returns an np.array such that np.matmul(M,a) == b. + Returns an np.array such that np.dot(M,a) == b. \setlength{\parskip}{1ex} \end{boxedminipage} diff --git a/doc/src/theia.helpers.interaction-module.tex b/doc/src/theia.helpers.interaction-module.tex index 1156c1d..1fe9775 100644 --- a/doc/src/theia.helpers.interaction-module.tex +++ b/doc/src/theia.helpers.interaction-module.tex @@ -3,7 +3,7 @@ % Module theia.helpers.interaction % % Generated by epydoc 3.0.1 -% [Tue Jul 11 10:03:01 2017] +% [Mon Jul 24 12:23:27 2017] % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -32,8 +32,11 @@ \section{Module theia.helpers.interaction} \endlastfoot\raggedright u\-s\-a\-g\-e\- & \raggedright \textbf{Value:} {\tt \texttt{'}\texttt{Usage: theia [options] FNAME{\textbackslash}n{\textbackslash}nArguments:{\textbackslash}n FNAME{\textbackslash}t{\textbackslash}t }\texttt{...}}&\\ \cline{1-2} +\raggedright l\-h\-e\-l\-p\- & \raggedright \textbf{Value:} +{\tt \texttt{'}\texttt{specify the FreeCAD library location. If none is specifi}\texttt{...}}&\\ +\cline{1-2} \raggedright w\-e\-l\-c\-o\-m\-e\- & \raggedright \textbf{Value:} -{\tt \texttt{'}\texttt{{\textbackslash}n{\textbackslash}ttheia Copyright (C) 2017 R. Duque{\textbackslash}n{\textbackslash}tLicense: GNU GP}\texttt{...}}&\\ +{\tt \texttt{...}}&\\ \cline{1-2} \raggedright e\-r\-r\-o\-r\-R\-e\-c\-u\-r\-s\-i\-o\-n\- & \raggedright \textbf{Value:} {\tt \texttt{'}\texttt{{\textbackslash}n{\textbackslash}nIt looks like you reached the maximum recursion dept}\texttt{...}}&\\ diff --git a/doc/src/theia.helpers.settings-module.tex b/doc/src/theia.helpers.settings-module.tex index 95f9b8c..117bff2 100644 --- a/doc/src/theia.helpers.settings-module.tex +++ b/doc/src/theia.helpers.settings-module.tex @@ -3,7 +3,7 @@ % Module theia.helpers.settings % % Generated by epydoc 3.0.1 -% [Tue Jul 11 10:03:01 2017] +% [Mon Jul 24 12:23:27 2017] % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/doc/src/theia.helpers.tools-module.tex b/doc/src/theia.helpers.tools-module.tex index 2ae81e5..1b5b1a9 100644 --- a/doc/src/theia.helpers.tools-module.tex +++ b/doc/src/theia.helpers.tools-module.tex @@ -3,7 +3,7 @@ % Module theia.helpers.tools % % Generated by epydoc 3.0.1 -% [Tue Jul 11 10:03:01 2017] +% [Mon Jul 24 12:23:27 2017] % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/doc/src/theia.helpers.units-module.tex b/doc/src/theia.helpers.units-module.tex index 6dbca85..e64762c 100644 --- a/doc/src/theia.helpers.units-module.tex +++ b/doc/src/theia.helpers.units-module.tex @@ -3,7 +3,7 @@ % Module theia.helpers.units % % Generated by epydoc 3.0.1 -% [Tue Jul 11 10:03:01 2017] +% [Mon Jul 24 12:23:27 2017] % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/doc/src/theia.main-module.tex b/doc/src/theia.main-module.tex index 2f6674e..3cef6a9 100644 --- a/doc/src/theia.main-module.tex +++ b/doc/src/theia.main-module.tex @@ -3,7 +3,7 @@ % Module theia.main % % Generated by epydoc 3.0.1 -% [Tue Jul 11 10:03:01 2017] +% [Mon Jul 24 12:23:27 2017] % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/doc/src/theia.optics-module.tex b/doc/src/theia.optics-module.tex index dfb1db1..85f83d5 100644 --- a/doc/src/theia.optics-module.tex +++ b/doc/src/theia.optics-module.tex @@ -3,7 +3,7 @@ % Package theia.optics % % Generated by epydoc 3.0.1 -% [Tue Jul 11 10:03:01 2017] +% [Mon Jul 24 12:23:27 2017] % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -19,15 +19,15 @@ \section{Package theia.optics} It provides the necessary classes and functions in order to calculate the gaussian beams of the setup. -\textbf{Version:} 0.1.1 +\textbf{Version:} 0.1.2 -\textbf{Author:} R. Duque +\textbf{Author:} Raphaël Duque -\textbf{Copyright:} Copyright 2017, R. Duque +\textbf{Copyright:} Copyright 2017, Raphaël Duque diff --git a/doc/src/theia.optics.beam-module.tex b/doc/src/theia.optics.beam-module.tex index 2eedec0..a069d51 100644 --- a/doc/src/theia.optics.beam-module.tex +++ b/doc/src/theia.optics.beam-module.tex @@ -3,7 +3,7 @@ % Module theia.optics.beam % % Generated by epydoc 3.0.1 -% [Tue Jul 11 10:03:01 2017] +% [Mon Jul 24 12:23:27 2017] % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/doc/src/theia.optics.beamdump-module.tex b/doc/src/theia.optics.beamdump-module.tex index 3b882a4..ea0b0d5 100644 --- a/doc/src/theia.optics.beamdump-module.tex +++ b/doc/src/theia.optics.beamdump-module.tex @@ -3,7 +3,7 @@ % Module theia.optics.beamdump % % Generated by epydoc 3.0.1 -% [Tue Jul 11 10:03:01 2017] +% [Mon Jul 24 12:23:27 2017] % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/doc/src/theia.optics.component-module.tex b/doc/src/theia.optics.component-module.tex index 1505b9f..fd3bd24 100644 --- a/doc/src/theia.optics.component-module.tex +++ b/doc/src/theia.optics.component-module.tex @@ -3,7 +3,7 @@ % Module theia.optics.component % % Generated by epydoc 3.0.1 -% [Tue Jul 11 10:03:01 2017] +% [Mon Jul 24 12:23:27 2017] % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/doc/src/theia.optics.ghost-module.tex b/doc/src/theia.optics.ghost-module.tex index 719e871..8444514 100644 --- a/doc/src/theia.optics.ghost-module.tex +++ b/doc/src/theia.optics.ghost-module.tex @@ -3,7 +3,7 @@ % Module theia.optics.ghost % % Generated by epydoc 3.0.1 -% [Tue Jul 11 10:03:01 2017] +% [Mon Jul 24 12:23:27 2017] % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/doc/src/theia.optics.lens-module.tex b/doc/src/theia.optics.lens-module.tex index a73a4c8..d8cad25 100644 --- a/doc/src/theia.optics.lens-module.tex +++ b/doc/src/theia.optics.lens-module.tex @@ -3,7 +3,7 @@ % Module theia.optics.lens % % Generated by epydoc 3.0.1 -% [Tue Jul 11 10:03:01 2017] +% [Mon Jul 24 12:23:27 2017] % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -152,7 +152,7 @@ \subsection{Class Lens} 'intersection point': point in space where it is first hit. [3D vector] 'face': to indicate which face is first hit, can be 'HR', 'AR' or - 'side'. [string] + 'Side'. [string] 'distance': geometrical distance from beam origin to impact. [float] \end{alltt} diff --git a/doc/src/theia.optics.mirror-module.tex b/doc/src/theia.optics.mirror-module.tex index bef2d28..00e0dd7 100644 --- a/doc/src/theia.optics.mirror-module.tex +++ b/doc/src/theia.optics.mirror-module.tex @@ -3,7 +3,7 @@ % Module theia.optics.mirror % % Generated by epydoc 3.0.1 -% [Tue Jul 11 10:03:01 2017] +% [Mon Jul 24 12:23:27 2017] % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -196,7 +196,7 @@ \subsection{Class Mirror} 'intersection point': point in space where it is first hit. [3D vector] 'face': to indicate which face is first hit, can be 'HR', 'AR' or - 'side'. [string] + 'Side'. [string] 'distance': geometrical distance from beam origin to impact. [float] \end{alltt} diff --git a/doc/src/theia.optics.optic-module.tex b/doc/src/theia.optics.optic-module.tex index 97f0f93..3c53931 100644 --- a/doc/src/theia.optics.optic-module.tex +++ b/doc/src/theia.optics.optic-module.tex @@ -3,7 +3,7 @@ % Module theia.optics.optic % % Generated by epydoc 3.0.1 -% [Tue Jul 11 10:03:01 2017] +% [Mon Jul 24 12:23:27 2017] % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/doc/src/theia.optics.thicklens-module.tex b/doc/src/theia.optics.thicklens-module.tex index ae6efc0..74d396f 100644 --- a/doc/src/theia.optics.thicklens-module.tex +++ b/doc/src/theia.optics.thicklens-module.tex @@ -3,7 +3,7 @@ % Module theia.optics.thicklens % % Generated by epydoc 3.0.1 -% [Tue Jul 11 10:03:01 2017] +% [Mon Jul 24 12:23:27 2017] % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/doc/src/theia.optics.thinlens-module.tex b/doc/src/theia.optics.thinlens-module.tex index 31c17fc..32563b9 100644 --- a/doc/src/theia.optics.thinlens-module.tex +++ b/doc/src/theia.optics.thinlens-module.tex @@ -3,7 +3,7 @@ % Module theia.optics.thinlens % % Generated by epydoc 3.0.1 -% [Tue Jul 11 10:03:01 2017] +% [Mon Jul 24 12:23:27 2017] % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/doc/src/theia.rendering-module.tex b/doc/src/theia.rendering-module.tex index 7b1d11f..662bda5 100644 --- a/doc/src/theia.rendering-module.tex +++ b/doc/src/theia.rendering-module.tex @@ -3,7 +3,7 @@ % Package theia.rendering % % Generated by epydoc 3.0.1 -% [Tue Jul 11 10:03:01 2017] +% [Mon Jul 24 12:23:27 2017] % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -19,15 +19,15 @@ \section{Package theia.rendering} It allows to write the physical objects to FreeCAD format files for 3D rendering. -\textbf{Version:} 0.1.1 +\textbf{Version:} 0.1.2 -\textbf{Author:} R. Duque +\textbf{Author:} Raphaël Duque -\textbf{Copyright:} Copyright 2017, R. Duque +\textbf{Copyright:} Copyright 2017, Raphaël Duque diff --git a/doc/src/theia.rendering.features-module.tex b/doc/src/theia.rendering.features-module.tex index 1455387..a5a6668 100644 --- a/doc/src/theia.rendering.features-module.tex +++ b/doc/src/theia.rendering.features-module.tex @@ -3,7 +3,7 @@ % Module theia.rendering.features % % Generated by epydoc 3.0.1 -% [Tue Jul 11 10:03:01 2017] +% [Mon Jul 24 12:23:27 2017] % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/doc/src/theia.rendering.shapes-module.tex b/doc/src/theia.rendering.shapes-module.tex index bfa5ba3..3b4d5df 100644 --- a/doc/src/theia.rendering.shapes-module.tex +++ b/doc/src/theia.rendering.shapes-module.tex @@ -3,7 +3,7 @@ % Module theia.rendering.shapes % % Generated by epydoc 3.0.1 -% [Tue Jul 11 10:03:01 2017] +% [Mon Jul 24 12:23:27 2017] % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/doc/src/theia.rendering.writer-module.tex b/doc/src/theia.rendering.writer-module.tex index 590a6c5..b0bb523 100644 --- a/doc/src/theia.rendering.writer-module.tex +++ b/doc/src/theia.rendering.writer-module.tex @@ -3,7 +3,7 @@ % Module theia.rendering.writer % % Generated by epydoc 3.0.1 -% [Tue Jul 11 10:03:01 2017] +% [Mon Jul 24 12:23:27 2017] % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/doc/src/theia.running-module.tex b/doc/src/theia.running-module.tex index 88e745b..eb2bfbf 100644 --- a/doc/src/theia.running-module.tex +++ b/doc/src/theia.running-module.tex @@ -3,7 +3,7 @@ % Package theia.running % % Generated by epydoc 3.0.1 -% [Tue Jul 11 10:03:01 2017] +% [Mon Jul 24 12:23:27 2017] % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -19,15 +19,15 @@ \section{Package theia.running} It provides the necessary classes and functions to allow the input, output and encapsulation of simulation data. -\textbf{Version:} 0.1.1 +\textbf{Version:} 0.1.2 -\textbf{Author:} R. Duque +\textbf{Author:} Raphaël Duque -\textbf{Copyright:} Copyright 2017, R. Duque +\textbf{Copyright:} Copyright 2017, Raphaël Duque diff --git a/doc/src/theia.running.parser-module.tex b/doc/src/theia.running.parser-module.tex index e2f10a5..291d345 100644 --- a/doc/src/theia.running.parser-module.tex +++ b/doc/src/theia.running.parser-module.tex @@ -3,7 +3,7 @@ % Module theia.running.parser % % Generated by epydoc 3.0.1 -% [Tue Jul 11 10:03:01 2017] +% [Mon Jul 24 12:23:27 2017] % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/doc/src/theia.running.simulation-module.tex b/doc/src/theia.running.simulation-module.tex index 77fdc0f..6a5f245 100644 --- a/doc/src/theia.running.simulation-module.tex +++ b/doc/src/theia.running.simulation-module.tex @@ -3,7 +3,7 @@ % Module theia.running.simulation % % Generated by epydoc 3.0.1 -% [Tue Jul 11 10:03:01 2017] +% [Mon Jul 24 12:23:27 2017] % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/doc/src/theia.tree-module.tex b/doc/src/theia.tree-module.tex index 893b9bc..0d7e850 100644 --- a/doc/src/theia.tree-module.tex +++ b/doc/src/theia.tree-module.tex @@ -3,7 +3,7 @@ % Package theia.tree % % Generated by epydoc 3.0.1 -% [Tue Jul 11 10:03:01 2017] +% [Mon Jul 24 12:23:27 2017] % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -19,15 +19,15 @@ \section{Package theia.tree} It provides the necessary classes and functions to allow the reverse ray tracing and stray light hunting features of theia. -\textbf{Version:} 0.1.1 +\textbf{Version:} 0.1.2 -\textbf{Author:} R. Duque +\textbf{Author:} Raphaël Duque -\textbf{Copyright:} Copyright 2017, R. Duque +\textbf{Copyright:} Copyright 2017, Raphaël Duque diff --git a/doc/src/theia.tree.beamtree-module.tex b/doc/src/theia.tree.beamtree-module.tex index 85236fb..9549f5c 100644 --- a/doc/src/theia.tree.beamtree-module.tex +++ b/doc/src/theia.tree.beamtree-module.tex @@ -3,7 +3,7 @@ % Module theia.tree.beamtree % % Generated by epydoc 3.0.1 -% [Tue Jul 11 10:03:01 2017] +% [Mon Jul 24 12:23:27 2017] % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -223,7 +223,7 @@ \subsection{Class BeamTree} \rule{\textwidth}{0.5\fboxrule} \setlength{\parskip}{2ex} - Return the list of lines necessary to write the output of simulation. + Return the list of lines to write the output of simulation. \setlength{\parskip}{1ex} \end{boxedminipage} diff --git a/doc/src/userguide.tex b/doc/src/userguide.tex index b61468d..d6999e4 100644 --- a/doc/src/userguide.tex +++ b/doc/src/userguide.tex @@ -163,12 +163,20 @@ \subsection{Usage on the command line} \hline \tt{-c, --no-CAD} & after the simulation, do not write the CAD file\\ \hline +\tt{-a, --anti-clipping} & include anti-clipping in simulation (see next paragraph) \\ +\hline +\tt{-v, --version} & print version of \tt{theia} and exit\\ +\hline \end{tabular} \end{center} \caption{Command lines options of \tt{theia}.} \label{option} \end{table} +\paragraph{Note on anti-clipping.}Anti-clipping in when a beam passes near an optic without formally interacting but its axis is within 2 waists of the optic. This leads to power losses and diffused light. It is the opposite of clipping, in which the beam is not completely included in the optic it is interacting with. + +Warnings are always issued when clipping occurs (except if the \tt{-w, --no-warn} option is used), but calculations for anti-clipping are heavier (they add approximately half more tracing calculations), and are only done if the \tt{-a, --anti-clipping} option is used. If it is, then corresponding warnings are issued. + \paragraph{Note on the \tt{FreeCAD} libraries.}\tt{theia} writes the 3D visualization information for the simulation to a CAD file to be read by \tt{FreeCAD}. If you do not wish to write the CAD file or or if you do not have the \tt{FreeCAD} libraries installed, you may use the \tt{-c} command line option. On the contrary, if you have the \tt{FreeCAD} libraries and you know where they are (usually \tt{usr/lib/freecad/lib}), you can save \tt{theia} the effort of finding them by aliasing \tt{theia} with \tt{theia -l [WHERE YOUR FREECAD LIB IS]}. @@ -302,8 +310,9 @@ \subsection{A note on global variables} from theia.helpers.settings import init # initialize globals in a dictionary -dic = {'info': False, 'warning': False, 'text': False, 'cad': False, - 'fname': 'test_optics', 'fclib': '/usr/lib/freecad/lib'} +dic = {'info': True, 'warning': True, 'text': True, 'cad': True, + 'fname': 'theiasimulation', 'fclib': '/usr/lib/freecad/lib', + 'antiClip': True} init(dic) @@ -332,6 +341,7 @@ \subsection{A note on global variables} & \tt{running.simulation.Simulation.run} \\ \hline \tt{text, cad, fname, fclib} & \tt{main.main} \\ \hline +\tt{antiClip} & \tt{tree.beamtree.treeOfBeam} \\ \hline \end{tabular} \caption{The global variables of theia and the functions who use them} diff --git a/tests/syntax.py b/tests/syntax.py index 8f3636d..a8f79f9 100755 --- a/tests/syntax.py +++ b/tests/syntax.py @@ -8,7 +8,7 @@ FREECADPATH = '/usr/lib/freecad/lib' # and freecad sys.path.insert(0, THEIAPATH) sys.path.append(FREECADPATH) -#import FreeCAD + import theia import theia.optics import theia.optics.thinlens diff --git a/tests/test_optics.py b/tests/test_optics.py index 0beacf7..8fbb639 100644 --- a/tests/test_optics.py +++ b/tests/test_optics.py @@ -13,7 +13,7 @@ # initialize globals dic = {'info': True, 'warning': True, 'text': True, 'cad': True, - 'fname': 'test_optics', 'fclib': FREECADPATH} + 'fname': 'test_optics', 'fclib': FREECADPATH, 'antiClip': True} settings.init(dic) diff --git a/tests/test_rendering.py b/tests/test_rendering.py index a012129..bfeff31 100644 --- a/tests/test_rendering.py +++ b/tests/test_rendering.py @@ -12,13 +12,7 @@ from theia.running import simulation # initialize globals dic = {'info': True, 'warning': True, 'text': True, 'cad': True, - 'fname': 'test_optics', 'fclib': FREECADPATH} - -settings.init(dic) - -# initialize globals -dic = {'info': True, 'warning': True, 'text': True, 'cad': True, - 'fname': 'test_rendering', 'fclib': '/usr/lib/freecad/lib'} + 'fname': 'test_rendering', 'fclib': FREECADPATH, 'antiClip': True} settings.init(dic) diff --git a/tests/test_simulation.py b/tests/test_simulation.py index 79df95a..d714315 100644 --- a/tests/test_simulation.py +++ b/tests/test_simulation.py @@ -7,13 +7,14 @@ sys.path.insert(0, THEIAPATH) import theia -from theia.helpers import settings +from theia.helpers import settings, tools from theia.helpers.units import * from theia.optics import beam, beamdump, thinlens, thicklens, mirror +from theia.running import simulation # initialize globals dic = {'info': True, 'warning': True, 'text': True, 'cad': True, - 'fname': 'test_optics', 'fclib': FREECADPATH} + 'fname': 'test_simulation', 'fclib': FREECADPATH, 'antiClip': True} settings.init(dic) @@ -22,15 +23,15 @@ simu = simulation.Simulation(FName = 'devTest') # test functions -@timer +@tools.timer def loader(): simu.load() -@timer +@tools.timer def runner(): simu.run() -@timer +@tools.timer def writer(): simu.writeOut() diff --git a/tests/test_simulation.tia b/tests/test_simulation.tia new file mode 100644 index 0000000..bcbc1d1 --- /dev/null +++ b/tests/test_simulation.tia @@ -0,0 +1,28 @@ +# This is a test file for development testing +# Here, first line without a comment, has the longname +Development Rendering Simulation + +#Threshold and order each on their own line +order = 1 +threshold = 1.*mW + +# input beam +#bm Wx Wy WDistx WDisty Wl P X Y Z Theta Phi Alpha Ref +bm 0.5*mm, 0.5*mm, 0., 0, 1064*nm, 1*W, Y = 0*m, Z = 0., Phi = 0, Ref = 'TB' + +# mirror (remember that in this case X,Y,Z are coordinates of the center of the chord of the HR) +#mr X Y Z Theta Phi Wedge Alpha HRK ARK Diameter Thickness N HRr HRt ARr ARt KeepI Ref +mr X = 40*cm, Phi = -3.1*pi/4., HRK = 0.e-2, ARK = 0, Wedge = 0*deg, Diameter = 5*cm, Thickness = 1*cm, Alpha = 0*deg, N= 1.1, Ref = 'M1' + +# thin lens (X, Y,Z is the center of the thin lens) +#th X Y Z Theta Phi Focal Diameter R T KeepI Ref +th 10*cm, 0, 0, 90 * deg, 185. *deg, 10*cm, 3*cm, 0.1, 0.9, True, Ref = 'L1' + +# thick lens (X,Y,Z is the apex of the HR face) +#tk X Y Z Theta Phi K1 K2 Diameter Thickness N R T KeepI Ref +tk 0*cm, 0, 0, 360*deg/4., 180.*deg, K1 = -1, K2 = -1, Thickness = 1*cm, Diameter = 3*cm, KeepI = False, Ref = 'L2' + +#beamdump (X,Y,Z is the center of the principal face) +#bd X Y Z Theta Phi Dia Thickness Ref +bd 40.*cm, -.05, 0., 90*deg, -90*deg, 5*cm, Thickness = 2*mm, Ref = 'BD1' + diff --git a/tests/test_tree.py b/tests/test_tree.py index 8a9eddd..a6ecba3 100644 --- a/tests/test_tree.py +++ b/tests/test_tree.py @@ -13,7 +13,7 @@ # initialize globals dic = {'info': True, 'warning': True, 'text': True, 'cad': True, - 'fname': 'test_optics', 'fclib': FREECADPATH} + 'fname': 'test_optics', 'fclib': FREECADPATH, 'antiClip': True} settings.init(dic) diff --git a/theia/optics/beam.py b/theia/optics/beam.py index 94cb4e7..cbe0b3c 100644 --- a/theia/optics/beam.py +++ b/theia/optics/beam.py @@ -105,8 +105,8 @@ def lines(self): ''' ans = [] ans.append("Beam: %s {" %self.Ref ) - ans.append("Power: %sW/Index: %s/Wavelength: %snm/Length: %sm") \ - %(str(self.P), str(self.N), str(self.Wl/nm), str(self.Length)) + ans.append("Power: %sW/Index: %s/Wavelength: %snm/Length: %sm" \ + %(str(self.P), str(self.N), str(self.Wl/nm), str(self.Length))) ans.append("Order: %s" %str(self.StrayOrder)) ans.append("Origin: %s" %str(self.Pos)) diff --git a/theia/optics/lens.py b/theia/optics/lens.py index 1fb339f..b6d217c 100644 --- a/theia/optics/lens.py +++ b/theia/optics/lens.py @@ -236,8 +236,8 @@ def hitActive(self, beam, point, faceTag, order, threshold): # we're done if there are two Nones if len(ans) == 2: if settings.info: - print "theia: Info: Reached leaf of tree by interaction "\ - + "(%s on %s, %s)." %(beam.Ref, self.Ref, faceTag) + print ("theia: Info: Reached leaf of tree by interaction "\ + + "(%s on %s, %s).") %(beam.Ref, self.Ref, faceTag) return ans # Calculate new basis diff --git a/theia/optics/mirror.py b/theia/optics/mirror.py index 9b892f6..0e0da76 100644 --- a/theia/optics/mirror.py +++ b/theia/optics/mirror.py @@ -304,8 +304,8 @@ def hitHR(self, beam, point, order, threshold): # we're done if there are two Nones if len(ans) == 2: if settings.info: - print "theia: Info: Reached leaf of tree by interaction"\ - +" (%s on %s, HR)." %(beam.Ref, self.Ref) + print ("theia: Info: Reached leaf of tree by interaction"\ + +" (%s on %s, HR).") %(beam.Ref, self.Ref) return ans # Calculate new basis @@ -426,8 +426,8 @@ def hitAR(self, beam, point, order, threshold): # we're done if there are two Nones if len(ans) == 2: if settings.info: - print "theia: Info: Reached leaf of tree by interaction"\ - +" (%s on %s, HR)." %(beam.Ref, self.Ref) + print ("theia: Info: Reached leaf of tree by interaction"\ + +" (%s on %s, HR).") %(beam.Ref, self.Ref) return ans # Calculate new basis diff --git a/theia/optics/optic.py b/theia/optics/optic.py index 77ab6d9..975d61b 100644 --- a/theia/optics/optic.py +++ b/theia/optics/optic.py @@ -103,8 +103,8 @@ def hitSide(self, beam): ''' if settings.info: - print "theia: Info: Reached leaf of tree by interaction "\ - +"(%s on %s, Side)." %(beam.Ref, self.Ref) + print ("theia: Info: Reached leaf of tree by interaction "\ + +"(%s on %s, Side).") %(beam.Ref, self.Ref) return {'t': None, 'r': None} def apexes(self): @@ -117,7 +117,7 @@ def apexes(self): except FloatingPointError: #if it fails then the whole semisphere is in the mirror and apex # is a radius away from Center. - theta = np.pi/2. + theta1 = np.pi/2. apex1 = self.HRCenter - (1-np.cos(theta1))*self.HRNorm/self.HRK if self.ARK == 0.: @@ -158,24 +158,22 @@ def geoCheck(self, word): '''Makes geometrical checks on surfaces and warns when necessary.''' if self.HRt + self.HRr > 1.: - print "theia: Warning: In %s (%s) on HR, R + T > 1."\ - %(word, self.Ref) + print "theia: Warning: In %s %s on HR, R + T > 1." %(word, self.Ref) if self.ARt + self.ARr > 1.: - print "theia: Warning: In %s (%s) on AR, R + T > 1."\ - %(word, self.Ref) + print "theia: Warning: In %s %s on AR, R + T > 1." %(word, self.Ref) if self.N < 1.: - print "theia: Warning: In %s (%s), optical index < 1."\ + print "theia: Warning: In %s %s, optical index < 1."\ %(word, self.Ref) if self.HRK != 0. and np.abs(1./self.HRK) < self.Dia/2.: - print "theia: Warning: In %s, the diameter of the %s exceeds the"\ - + " diameter of the HR surface."%(self.Ref, word) + print ("theia: Warning: In %s, the diameter of the %s exceeds the"\ + + " diameter of the HR surface.") %( self.Ref, word) if self.ARK != 0. and np.abs(1./self.ARK) < self.Dia/2.: - print "theia: Warning: In %s, the diameter of the %s exceeds the"\ - + " diameter of the AR surface."%(self.Ref, word) + print ("theia: Warning: In %s, the diameter of the %s exceeds the"\ + + " diameter of the AR surface.") %(self.Ref, word) if self.collision(): print "theia: Warning: In %s, HR and AR surfaces intersect."\ diff --git a/theia/running/parser.py b/theia/running/parser.py index 7975680..afe7438 100644 --- a/theia/running/parser.py +++ b/theia/running/parser.py @@ -58,8 +58,8 @@ def readIn(name): raise InputError(malformed \ %(fileName, str(j), 'parse', word) + ".") except TypeError: - raise InputError(malformed \ - %(fileName, str(j), 'cast', word) \ + raise InputError((malformed \ + %(fileName, str(j), 'cast', word)) \ + "to int.") elif line[0:9] == 'threshold': @@ -70,8 +70,8 @@ def readIn(name): raise InputError(malformed \ %(fileName, str(j), 'parse', word) + ".") except TypeError: - raise InputError(malformed \ - %(fileName, str(j), 'cast', word) \ + raise InputError((malformed \ + %(fileName, str(j), 'cast', word)) \ + "to float.") elif line[0:2] == 'bm': @@ -122,34 +122,34 @@ def dicOf(st, line, fileName, lineNumber): try: ans[settings.inOrder[st][i]] = eval(words[i]) except SyntaxError: - raise InputError(malformed %(fileName, lineNumber, str(i+1))\ + raise InputError((malformed %(fileName, lineNumber, str(i+1)))\ + ". Could not parse '%s'." %words[i]) except NameError: - raise InputError(malformed %(fileName, lineNumber, str(i+1))\ + raise InputError((malformed %(fileName, lineNumber, str(i+1)))\ + ". Did not recognize reference in '%s'." %words[i]) except IndexError: - raise InputError(malformed %(fileName, lineNumber, str(i+1))\ + raise InputError((malformed %(fileName, lineNumber, str(i+1)))\ + ". To many arguments given.") i = i + 1 while i < len(words): #inputs with '=' word = words[i] if word.find('=') == -1: - raise InputError(malformed %(fileName, lineNumber, str(i+1))\ + raise InputError((malformed %(fileName, lineNumber, str(i+1)))\ + ". Found non explicit entry '%s' among explicit entries."\ %word) var = word[0:word.find('=')] if var not in settings.inOrder[st]: - raise InputError(malformed %(fileName, lineNumber, str(i+1))\ + raise InputError((malformed %(fileName, lineNumber, str(i+1)))\ + ". Unknown constructor parameter '%s'." %var) val = word[word.find('=')+1:] try: ans[var] = eval(val) except SyntaxError: - raise InputError(malformed %(fileName, lineNumber, str(i+1))\ + raise InputError((malformed %(fileName, lineNumber, str(i+1)))\ + ". Could not parse '%s'." %val) except NameError: - raise InputError(malformed %(fileName, lineNumber, str(i+1))\ + raise InputError((malformed %(fileName, lineNumber, str(i+1)))\ + ". Did not recognize reference in '%s'." %val) i = i+1 diff --git a/tutos/optimization.py b/tutos/optimization.py index 8159a47..5ad047c 100644 --- a/tutos/optimization.py +++ b/tutos/optimization.py @@ -24,7 +24,8 @@ # initialize globals (necessary to use theia in library form) dic = {'info': False, 'warning': True, 'text': True, 'cad': True, - 'fname': 'optimization', 'fclib' : '/usr/local/lib/freecad/lib'} + 'fname': 'optimization', 'fclib' : '/usr/lib/freecad/lib', + 'antiClip': True} settings.init(dic) #simulation object diff --git a/tutos/sphere.py b/tutos/sphere.py index fc635b1..1527273 100644 --- a/tutos/sphere.py +++ b/tutos/sphere.py @@ -9,7 +9,8 @@ # initialize globals (necessary to use theia in library form) dic = {'info': False, 'warning': True, 'text': True, 'cad': True, - 'fname': 'sphere', 'fclib' : '/usr/local/lib/freecad/lib'} + 'fname': 'sphere', 'fclib' : '/usr/lib/freecad/lib', + 'antiClip': True} settings.init(dic) # Here is a spherical mirror diff --git a/tutos/telescope.py b/tutos/telescope.py index 1391e08..2772825 100644 --- a/tutos/telescope.py +++ b/tutos/telescope.py @@ -9,7 +9,8 @@ # initialize globals (necessary to use theia in library form) dic = {'info': False, 'warning': True, 'text': True, 'cad': True, - 'fname': 'telescope', 'fclib' : '/usr/local/lib/freecad/lib'} + 'fname': 'telescope', 'fclib' : '/usr/lib/freecad/lib', + 'antiClip': True} settings.init(dic) # Mirrors of telescope diff --git a/tutos/vignale.py b/tutos/vignale.py index 67feef3..e73df53 100644 --- a/tutos/vignale.py +++ b/tutos/vignale.py @@ -10,7 +10,8 @@ # initialize globals (necessary to use theia in library form) dic = {'info': False, 'warning': True, 'text': True, 'cad': True, - 'fname': 'vignale', 'fclib' : '/usr/local/lib/freecad/lib'} + 'fname': 'vignale', 'fclib' : '/usr/lib/freecad/lib', + 'antiClip': True} settings.init(dic) # Here is a spherical mirror