Page MenuHomec4science

pNbody.tex
No OneTemporary

File Metadata

Created
Thu, May 30, 20:06

pNbody.tex

This file is larger than 256 KB, so syntax highlighting was skipped.
% Generated by Sphinx.
\def\sphinxdocclass{report}
\documentclass[letterpaper,10pt,english]{sphinxmanual}
\usepackage[utf8]{inputenc}
\DeclareUnicodeCharacter{00A0}{\nobreakspace}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{times}
\usepackage[Bjarne]{fncychap}
\usepackage{longtable}
\usepackage{sphinx}
\title{pNbody Documentation}
\date{September 01, 2011}
\release{4}
\author{Yves Revaz}
\newcommand{\sphinxlogo}{}
\renewcommand{\releasename}{Release}
\makeindex
\makeatletter
\def\PYG@reset{\let\PYG@it=\relax \let\PYG@bf=\relax%
\let\PYG@ul=\relax \let\PYG@tc=\relax%
\let\PYG@bc=\relax \let\PYG@ff=\relax}
\def\PYG@tok#1{\csname PYG@tok@#1\endcsname}
\def\PYG@toks#1+{\ifx\relax#1\empty\else%
\PYG@tok{#1}\expandafter\PYG@toks\fi}
\def\PYG@do#1{\PYG@bc{\PYG@tc{\PYG@ul{%
\PYG@it{\PYG@bf{\PYG@ff{#1}}}}}}}
\def\PYG#1#2{\PYG@reset\PYG@toks#1+\relax+\PYG@do{#2}}
\def\PYG@tok@gd{\def\PYG@tc##1{\textcolor[rgb]{0.63,0.00,0.00}{##1}}}
\def\PYG@tok@gu{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.50,0.00,0.50}{##1}}}
\def\PYG@tok@gt{\def\PYG@tc##1{\textcolor[rgb]{0.00,0.25,0.82}{##1}}}
\def\PYG@tok@gs{\let\PYG@bf=\textbf}
\def\PYG@tok@gr{\def\PYG@tc##1{\textcolor[rgb]{1.00,0.00,0.00}{##1}}}
\def\PYG@tok@cm{\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.25,0.50,0.56}{##1}}}
\def\PYG@tok@vg{\def\PYG@tc##1{\textcolor[rgb]{0.73,0.38,0.84}{##1}}}
\def\PYG@tok@m{\def\PYG@tc##1{\textcolor[rgb]{0.13,0.50,0.31}{##1}}}
\def\PYG@tok@mh{\def\PYG@tc##1{\textcolor[rgb]{0.13,0.50,0.31}{##1}}}
\def\PYG@tok@cs{\def\PYG@tc##1{\textcolor[rgb]{0.25,0.50,0.56}{##1}}\def\PYG@bc##1{\colorbox[rgb]{1.00,0.94,0.94}{##1}}}
\def\PYG@tok@ge{\let\PYG@it=\textit}
\def\PYG@tok@vc{\def\PYG@tc##1{\textcolor[rgb]{0.73,0.38,0.84}{##1}}}
\def\PYG@tok@il{\def\PYG@tc##1{\textcolor[rgb]{0.13,0.50,0.31}{##1}}}
\def\PYG@tok@go{\def\PYG@tc##1{\textcolor[rgb]{0.19,0.19,0.19}{##1}}}
\def\PYG@tok@cp{\def\PYG@tc##1{\textcolor[rgb]{0.00,0.44,0.13}{##1}}}
\def\PYG@tok@gi{\def\PYG@tc##1{\textcolor[rgb]{0.00,0.63,0.00}{##1}}}
\def\PYG@tok@gh{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.00,0.00,0.50}{##1}}}
\def\PYG@tok@ni{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.84,0.33,0.22}{##1}}}
\def\PYG@tok@nl{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.00,0.13,0.44}{##1}}}
\def\PYG@tok@nn{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.05,0.52,0.71}{##1}}}
\def\PYG@tok@no{\def\PYG@tc##1{\textcolor[rgb]{0.38,0.68,0.84}{##1}}}
\def\PYG@tok@na{\def\PYG@tc##1{\textcolor[rgb]{0.25,0.44,0.63}{##1}}}
\def\PYG@tok@nb{\def\PYG@tc##1{\textcolor[rgb]{0.00,0.44,0.13}{##1}}}
\def\PYG@tok@nc{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.05,0.52,0.71}{##1}}}
\def\PYG@tok@nd{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.33,0.33,0.33}{##1}}}
\def\PYG@tok@ne{\def\PYG@tc##1{\textcolor[rgb]{0.00,0.44,0.13}{##1}}}
\def\PYG@tok@nf{\def\PYG@tc##1{\textcolor[rgb]{0.02,0.16,0.49}{##1}}}
\def\PYG@tok@si{\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.44,0.63,0.82}{##1}}}
\def\PYG@tok@s2{\def\PYG@tc##1{\textcolor[rgb]{0.25,0.44,0.63}{##1}}}
\def\PYG@tok@vi{\def\PYG@tc##1{\textcolor[rgb]{0.73,0.38,0.84}{##1}}}
\def\PYG@tok@nt{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.02,0.16,0.45}{##1}}}
\def\PYG@tok@nv{\def\PYG@tc##1{\textcolor[rgb]{0.73,0.38,0.84}{##1}}}
\def\PYG@tok@s1{\def\PYG@tc##1{\textcolor[rgb]{0.25,0.44,0.63}{##1}}}
\def\PYG@tok@gp{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.78,0.36,0.04}{##1}}}
\def\PYG@tok@sh{\def\PYG@tc##1{\textcolor[rgb]{0.25,0.44,0.63}{##1}}}
\def\PYG@tok@ow{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.00,0.44,0.13}{##1}}}
\def\PYG@tok@sx{\def\PYG@tc##1{\textcolor[rgb]{0.78,0.36,0.04}{##1}}}
\def\PYG@tok@bp{\def\PYG@tc##1{\textcolor[rgb]{0.00,0.44,0.13}{##1}}}
\def\PYG@tok@c1{\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.25,0.50,0.56}{##1}}}
\def\PYG@tok@kc{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.00,0.44,0.13}{##1}}}
\def\PYG@tok@c{\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.25,0.50,0.56}{##1}}}
\def\PYG@tok@mf{\def\PYG@tc##1{\textcolor[rgb]{0.13,0.50,0.31}{##1}}}
\def\PYG@tok@err{\def\PYG@bc##1{\fcolorbox[rgb]{1.00,0.00,0.00}{1,1,1}{##1}}}
\def\PYG@tok@kd{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.00,0.44,0.13}{##1}}}
\def\PYG@tok@ss{\def\PYG@tc##1{\textcolor[rgb]{0.32,0.47,0.09}{##1}}}
\def\PYG@tok@sr{\def\PYG@tc##1{\textcolor[rgb]{0.14,0.33,0.53}{##1}}}
\def\PYG@tok@mo{\def\PYG@tc##1{\textcolor[rgb]{0.13,0.50,0.31}{##1}}}
\def\PYG@tok@mi{\def\PYG@tc##1{\textcolor[rgb]{0.13,0.50,0.31}{##1}}}
\def\PYG@tok@kn{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.00,0.44,0.13}{##1}}}
\def\PYG@tok@o{\def\PYG@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
\def\PYG@tok@kr{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.00,0.44,0.13}{##1}}}
\def\PYG@tok@s{\def\PYG@tc##1{\textcolor[rgb]{0.25,0.44,0.63}{##1}}}
\def\PYG@tok@kp{\def\PYG@tc##1{\textcolor[rgb]{0.00,0.44,0.13}{##1}}}
\def\PYG@tok@w{\def\PYG@tc##1{\textcolor[rgb]{0.73,0.73,0.73}{##1}}}
\def\PYG@tok@kt{\def\PYG@tc##1{\textcolor[rgb]{0.56,0.13,0.00}{##1}}}
\def\PYG@tok@sc{\def\PYG@tc##1{\textcolor[rgb]{0.25,0.44,0.63}{##1}}}
\def\PYG@tok@sb{\def\PYG@tc##1{\textcolor[rgb]{0.25,0.44,0.63}{##1}}}
\def\PYG@tok@k{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.00,0.44,0.13}{##1}}}
\def\PYG@tok@se{\let\PYG@bf=\textbf\def\PYG@tc##1{\textcolor[rgb]{0.25,0.44,0.63}{##1}}}
\def\PYG@tok@sd{\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.25,0.44,0.63}{##1}}}
\def\PYGZbs{\char`\\}
\def\PYGZus{\char`\_}
\def\PYGZob{\char`\{}
\def\PYGZcb{\char`\}}
\def\PYGZca{\char`\^}
% for compatibility with earlier versions
\def\PYGZat{@}
\def\PYGZlb{[}
\def\PYGZrb{]}
\makeatother
\begin{document}
\maketitle
\tableofcontents
\phantomsection\label{index::doc}
Contents:
\chapter{Overview}
\label{rst/Overview:welcome-to-pnbody-s-documentation}\label{rst/Overview::doc}\label{rst/Overview:overview}
\textbf{pNbody} is a parallelized python module toolbox designed to manipulate and display
interactively very lage N-body systems.
Its oriented object approche allows the user to perform complicate manipulation
with only very few commands.
As python is an interpreted language, the user can load an N-body system and explore it
interactively using the python interpreter. pNbody may also be used in python scripts.
The module also contains graphical facilities desinged to create maps of physical values of
the system, like density maps, temperture maps, velocites maps, etc. Stereo capabilities are
also implemented.
pNbody is not limited by file format. Each user may redefine in a parameter file how to read
its prefered format.
Its new parallel (mpi) facilities make it works on computer cluster without being limitted by
memory consumption. It has already been tested with several millions of particles.
\includegraphics{cosmo.png}
\chapter{Installation}
\label{rst/Installation:installation}\label{rst/Installation::doc}
pNbody is curently only supported by linux.
\section{Prerequiste}
\label{rst/Prerequiste:prerequiste}\label{rst/Prerequiste::doc}
The basic module of pNbody needs python and additional packages :
\begin{enumerate}
\item {}
Python 2.5.x, 2.6.x, 2.7.x
\href{http://www.python.org}{http://www.python.org}
\item {}
a C compiler
gcc is fine \href{http://gcc.gnu.org/}{http://gcc.gnu.org/}
\item {}
numpy-1.0.4 or higher
\href{http://numpy.scipy.org/}{http://numpy.scipy.org/}
\item {}
Imaging 1.1.5 or higher
\href{http://www.pythonware.com/products/pil/}{http://www.pythonware.com/products/pil/}
\end{enumerate}
For additional but usefull special functions :
\begin{enumerate}
\setcounter{enumi}{4}
\item {}
scipy 0.7 or higher
\href{http://www.scipy.org/}{http://www.scipy.org/}
\end{enumerate}
For the parallel capabilities, an mpi distribution is needed (ex. openmpi)
as well as the additional python mpi wrapping:
\begin{enumerate}
\setcounter{enumi}{5}
\item {}
mpi4py
\href{http://cheeseshop.python.org/pypi/mpi4py}{http://cheeseshop.python.org/pypi/mpi4py}
\end{enumerate}
In order to convert movies in standard format (gif or mpeg), the two following applications are needed :
\begin{enumerate}
\item {}
convert (imagemagick)
\href{http://www.imagemagick.org/script/index.php}{http://www.imagemagick.org/script/index.php}
\item {}
mencoder (mplayer)
\href{http://www.mplayerhq.hu/design7/news.html}{http://www.mplayerhq.hu/design7/news.html}
\end{enumerate}
\section{Installing from source}
\label{rst/Installing_from_tarball:installing-from-source}\label{rst/Installing_from_tarball::doc}
\subsection{Decompress the tarball}
\label{rst/Installing_from_tarball:decompress-the-tarball}
Decompress the tarball file:
\begin{Verbatim}[commandchars=@\[\]]
tar -xzf pNbody-4.x.tar.gz
\end{Verbatim}
enter the directory:
\begin{Verbatim}[commandchars=@\[\]]
cd pNbody-4.x
\end{Verbatim}
\subsection{Compile}
\label{rst/Installing_from_tarball:compile}
The compilation is performed using the standard command:
\begin{Verbatim}[commandchars=@\[\]]
python setup.py build
\end{Verbatim}
If one wants to install in another directory than the default
python one, it is possible to use the standard \code{-{-}prefix} option:
\begin{Verbatim}[commandchars=@\[\]]
python setup.py build --prefix other@_directory
\end{Verbatim}
\subsection{Install}
\label{rst/Installing_from_tarball:install}
Now, depending on your python installation you need to be root.
The module is installed with the following command:
\begin{Verbatim}[commandchars=@\[\]]
python setup.py install
\end{Verbatim}
\section{Check the installation}
\label{rst/Test_the_installation:check-the-installation}\label{rst/Test_the_installation::doc}
You can check the installation by simply running the following
command:
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{n}{pNbody\PYGZus{}checkall}
\end{Verbatim}
This command must of course be in your path. This will be the case
if you did not specified any \code{-{-}prefix}. On the contrary if \code{-{-}prefix}
is set to for example, \emph{localdir} you should have your \emph{PATH} environment
variable should contains:
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{n}{localdir}\PYG{o}{/}\PYG{n+nb}{bin}
\end{Verbatim}
and you \emph{PYTHONPATH} environment should contains:
\begin{Verbatim}[commandchars=@\[\]]
localdir/lib/python2.x/site-packages/
\end{Verbatim}
to ensure that the \textbf{pNbody} package will be found.
If everything goes well, you should see a lots of outputs on your screen,
as well as a window displaying an edge-on disk.
\includegraphics{edge-on-disk.png}
Close it when you see it.
The script should finally ends up with something like
\begin{Verbatim}[commandchars=@\[\]]
@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#
Good News ! pNbody with format gadget is working !
@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#
You are currently using the following paths
HOME : /home/leo
PNBODYPATH : /home/leo/local/lib/python2.6/site-packages/pNbody
CONFIGDIR : /home/leo/local/lib/python2.6/site-packages/pNbody/config
PARAMETERFILE : /home/leo/local/lib/python2.6/site-packages/pNbody/config/defaultparameters
UNITSPARAMETERFILE : /home/leo/local/lib/python2.6/site-packages/pNbody/config/unitsparameters
PALETTEDIR : /home/leo/local/lib/python2.6/site-packages/pNbody/config/rgb@_tables
PLUGINSDIR : /home/leo/local/lib/python2.6/site-packages/pNbody/config/plugins
OPTDIR : /home/leo/local/lib/python2.6/site-packages/pNbody/config/opt
FORMATSDIR : /home/leo/local/lib/python2.6/site-packages/pNbody/config/formats
\end{Verbatim}
\section{Default configuration}
\label{rst/Default_configurations:default-configuration}\label{rst/Default_configurations::doc}
\textbf{pNbody} uses a set of parameters files, color tables and formats files.
These files are provided by the installation and are by default stored in
the directory \code{site-packages/pNbody/config}.
To display where these files are taken from, you can use the command:
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{n}{pNbody\PYGZus{}show}\PYG{o}{-}\PYG{n}{path}
\end{Verbatim}
It is recommanded that the user uses its own configuration files. To be automatically
recongnized by \textbf{pNbody}, the latter must be in the user \code{\textasciitilde{}/.pNbody} directory.
\textbf{pNbody} provides a simple command to copy all parameters in this directory. Simply
type:
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{n}{pNbody\PYGZus{}copy}\PYG{o}{-}\PYG{n}{defaultconfig}
\end{Verbatim}
and check the values of the new paths:
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{n}{pNbody\PYGZus{}show}\PYG{o}{-}\PYG{n}{path}
\end{Verbatim}
You can now freely modify the files contains in the configuratio directory.
By default, the content of the configuration directory is:
\begin{tabulary}{\linewidth}{|L|L|L|}
\hline
\textbf{
name
} & \textbf{
type
} & \textbf{
Content
}\\
\hline
defaultparameters
&
file
&
the default graphical parameters used by \textbf{pNbody}
\\
unitsparameters
&
file
&
the default units parameters used by \textbf{pNbody}
\\
formats
&
directory
&
specific class definition files used to read different file formats
\\
rgb\_tables
&
directory
&
color tables
\\
plugins
&
directory
&
optional plugins
\\
opt
&
directory
&
optional files
\\
\hline
\end{tabulary}
\section{Default parameters}
\label{rst/Default_parameters::doc}\label{rst/Default_parameters:default-parameters}
To see what default parameters \textbf{pNbody} uses, type:
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{n}{pNbody\PYGZus{}show}\PYG{o}{-}\PYG{n}{parameters}
\end{Verbatim}
The script returns the parameters taken from the files
\emph{defaultparameters} and \emph{unitsparameters}.
Their current values are displayed:
\begin{Verbatim}[commandchars=@\[\]]
parameters in /home/leo/local/lib/python2.6/site-packages/pNbody/config/defaultparameters
----------------------------------------------------------------------------------------------------
name meaning value (type)
----------------------------------------------------------------------------------------------------
obs : observer = None (ArrayObs)
xp : observing position = None (List)
x0 : position of observer = None (List)
alpha : angle of the head = None (Float)
view : view = xz (String)
r@_obs : dist. to the observer = 201732.223771 (Float)
clip : clip planes = (100866.11188556443, 403464.44754225772) (Tuple)
cut : cut clip planes = no (String)
eye : name of the eye = None (String)
dist@_eye : distance between eyes = -0.0005 (Float)
foc : focal = 300.0 (Float)
persp : perspective = off (String)
shape : shape of the image = (512, 512) (Tuple)
size : pysical size = (6000, 6000) (Tuple)
frsp : frsp = 0.0 (Float)
space : space = pos (String)
mode : mode = m (String)
rendering : rendering mode = map (String)
filter@_name : name of the filter = None (String)
filter@_opts : filter options = @PYGZlb[]10, 10, 2, 2@PYGZrb[] (List)
scale : scale = log (String)
cd : cd = 0.0 (Float)
mn : mn = 0.0 (Float)
mx : mx = 0.0 (Float)
l@_n : number of levels = 15 (Int)
l@_min : min level = 0.0 (Float)
l@_max : max level = 0.0 (Float)
l@_kx : l@_kx = 10 (Int)
l@_ky : l@_ky = 10 (Int)
l@_color : level color = 0 (Int)
l@_crush : crush background = no (String)
b@_weight : box line weight = 0 (Int)
b@_xopts : x axis options = None (Tuple)
b@_yopts : y axis options = None (Tuple)
b@_color : line color = 255 (Int)
parameters in /home/leo/local/lib/python2.6/site-packages/pNbody/config/unitsparameters
----------------------------------------------------------------------------------------------------
name meaning value (type)
----------------------------------------------------------------------------------------------------
xi : hydrogen mass fraction = 0.76 (Float)
ionisation : ionisation flag = 1 (Int)
metalicity : metalicity index = 4 (Int)
Nsph : number of sph neighbors = 50 (Int)
gamma : adiabatic index = 1.66666666667 (Float)
coolingfile : Cooling file = @textasciitilde[]/.Nbody/cooling.dat (String)
HubbleParam : HubbleParam = 1.0 (Float)
UnitLength@_in@_cm : UnitLength in cm = 3.085e+21 (Float)
UnitMass@_in@_g : UnitMass in g = 4.435693e+44 (Float)
UnitVelocity@_in@_cm@_per@_s : UnitVelocity in cm per s = 97824708.2699 (Float)
\end{Verbatim}
\section{Examples}
\label{rst/Examples::doc}\label{rst/Examples:examples}
A series of examples is provided by \textbf{pNbody} in the
\code{PNBODYPATH/examples}, where NBODYPATH is obtained
with the command:
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{n}{pNbody\PYGZus{}show}\PYG{o}{-}\PYG{n}{path}
\end{Verbatim}
\chapter{Tutorial}
\label{rst/Tutorial::doc}\label{rst/Tutorial:tutorial}
\section{Using \textbf{pNbody} with the python interpreter}
\label{rst/Tutorial_interpreter:using-pnbody-with-the-python-interpreter}\label{rst/Tutorial_interpreter::doc}
In order to use this tutorial, you first need to copy some examples provided
with \textbf{pNbody}. This can be done by typing:
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{n}{pNbody\PYGZus{}copy}\PYG{o}{-}\PYG{n}{examples}
\end{Verbatim}
by default, this create a directory in your home \code{\textasciitilde{}/pnbody\_examples}.
Move to this directory:
\begin{Verbatim}[commandchars=@\[\]]
cd @textasciitilde[]/pnbody@_examples
\end{Verbatim}
Then you can simply follow the instructions below.
First, start the python interpreter:
\begin{Verbatim}[commandchars=@\[\]]
leo@PYGZat[]obsrevaz:@textasciitilde[]/pnbody@_examples python
Python 2.4.2 (@#2, Jul 13 2006, 15:26:48)
@PYGZlb[]GCC 4.0.1 (4.0.1-5mdk for Mandriva Linux release 2006.0)@PYGZrb[] on linux2
Type "help", "copyright", "credits" or "license" for more information.
@textgreater[]@textgreater[]@textgreater[]
\end{Verbatim}
Now, you can load the \textbf{pNbody} module:
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{k+kn}{from} \PYG{n+nn}{pNbody} \PYG{k+kn}{import} \PYG{o}{*}
\end{Verbatim}
\subsection{Creating \textbf{pNbody} objects from scratch}
\label{rst/Tutorial_interpreter:creating-pnbody-objects-from-scratch}
We can first start by creating a default \textbf{pNbody} objet and get info about it
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb} \PYG{o}{=} \PYG{n}{Nbody}\PYG{p}{(}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb}\PYG{o}{.}\PYG{n}{info}\PYG{p}{(}\PYG{p}{)}
\PYG{g+go}{-----------------------------------}
\PYG{g+go}{particle file : ['file.dat']}
\PYG{g+go}{ftype : 'Nbody\PYGZus{}default'}
\PYG{g+go}{mxntpe : 6}
\PYG{g+go}{nbody : 0}
\PYG{g+go}{nbody\PYGZus{}tot : 0}
\PYG{g+go}{npart : [0, 0, 0, 0, 0, 0]}
\PYG{g+go}{npart\PYGZus{}tot : [0, 0, 0, 0, 0, 0]}
\PYG{g+go}{mass\PYGZus{}tot : 0.0}
\PYG{g+go}{byteorder : 'little'}
\PYG{g+go}{pio : 'no'}
\PYG{g+go}{\textgreater{}\textgreater{}\textgreater{}}
\end{Verbatim}
All variables linked to the object nb are accesible by typing nb. followed by the associated variables :
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb}\PYG{o}{.}\PYG{n}{nbody}
\PYG{g+go}{0}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb}\PYG{o}{.}\PYG{n}{mass\PYGZus{}tot}
\PYG{g+go}{0.0}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb}\PYG{o}{.}\PYG{n}{pio}
\PYG{g+go}{'no'}
\end{Verbatim}
Now, you can create an object by giving the positions of particles:
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{pos} \PYG{o}{=} \PYG{n}{ones}\PYG{p}{(}\PYG{p}{(}\PYG{l+m+mi}{10}\PYG{p}{,}\PYG{l+m+mi}{3}\PYG{p}{)}\PYG{p}{,}\PYG{n}{float32}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb} \PYG{o}{=} \PYG{n}{Nbody}\PYG{p}{(}\PYG{n}{pos}\PYG{o}{=}\PYG{n}{pos}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb}\PYG{o}{.}\PYG{n}{info}\PYG{p}{(}\PYG{p}{)}
\PYG{g+go}{-----------------------------------}
\PYG{g+go}{particle file : ['file.dat']}
\PYG{g+go}{ftype : 'Nbody\PYGZus{}default'}
\PYG{g+go}{mxntpe : 6}
\PYG{g+go}{nbody : 10}
\PYG{g+go}{nbody\PYGZus{}tot : 10}
\PYG{g+go}{npart : array([10, 0, 0, 0, 0, 0])}
\PYG{g+go}{npart\PYGZus{}tot : array([10, 0, 0, 0, 0, 0])}
\PYG{g+go}{mass\PYGZus{}tot : 1.00000011921}
\PYG{g+go}{byteorder : 'little'}
\PYG{g+go}{pio : 'no'}
\PYG{g+go}{len pos : 10}
\PYG{g+go}{pos[0] : array([ 1., 1., 1.], dtype=float32)}
\PYG{g+go}{pos[-1] : array([ 1., 1., 1.], dtype=float32)}
\PYG{g+go}{len vel : 10}
\PYG{g+go}{vel[0] : array([ 0., 0., 0.], dtype=float32)}
\PYG{g+go}{vel[-1] : array([ 0., 0., 0.], dtype=float32)}
\PYG{g+go}{len mass : 10}
\PYG{g+go}{mass[0] : 0.10000000149}
\PYG{g+go}{mass[-1] : 0.10000000149}
\PYG{g+go}{len num : 10}
\PYG{g+go}{num[0] : 0}
\PYG{g+go}{num[-1] : 9}
\PYG{g+go}{len tpe : 10}
\PYG{g+go}{tpe[0] : 0}
\PYG{g+go}{tpe[-1] : 0}
\end{Verbatim}
In this case, you can see that the class automatically intitialize other arrays variables
(vel, mass, num and rsp) with default values. Only the first and the last element of
each defined vector are displyed by the methode info. All defined arrays and array elements
may be easily accessible using the numarray convensions. For exemple, to display and
change the positions of the tree first particles, type:
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb}\PYG{o}{.}\PYG{n}{pos}\PYG{p}{[}\PYG{p}{:}\PYG{l+m+mi}{3}\PYG{p}{]}
\PYG{g+go}{array([[ 1., 1., 1.],}
\PYG{g+go}{ [ 1., 1., 1.],}
\PYG{g+go}{ [ 1., 1., 1.]], type=float32)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb}\PYG{o}{.}\PYG{n}{pos}\PYG{p}{[}\PYG{p}{:}\PYG{l+m+mi}{3}\PYG{p}{]}\PYG{o}{=}\PYG{l+m+mi}{2}\PYG{o}{*}\PYG{n}{ones}\PYG{p}{(}\PYG{p}{(}\PYG{l+m+mi}{3}\PYG{p}{,}\PYG{l+m+mi}{3}\PYG{p}{)}\PYG{p}{,}\PYG{n}{float32}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb}\PYG{o}{.}\PYG{n}{pos}\PYG{p}{[}\PYG{p}{:}\PYG{l+m+mi}{3}\PYG{p}{]}
\PYG{g+go}{array([[ 2., 2., 2.],}
\PYG{g+go}{ [ 2., 2., 2.],}
\PYG{g+go}{ [ 2., 2., 2.]], type=float32)}
\end{Verbatim}
\subsection{Open from existing file}
\label{rst/Tutorial_interpreter:open-from-existing-file}
Now, lets try to open the gadget snapshot gadget\_z00.dat. This is achieved by typing:
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb} \PYG{o}{=} \PYG{n}{Nbody}\PYG{p}{(}\PYG{l+s}{'}\PYG{l+s}{gadget\PYGZus{}z00.dat}\PYG{l+s}{'}\PYG{p}{,}\PYG{n}{ftype}\PYG{o}{=}\PYG{l+s}{'}\PYG{l+s}{gadget}\PYG{l+s}{'}\PYG{p}{)}
\end{Verbatim}
Again, informatins on this snapshot may be obtained using the instance info():
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb}\PYG{o}{.}\PYG{n}{info}\PYG{p}{(}\PYG{p}{)}
\PYG{g+go}{-----------------------------------}
\PYG{g+go}{particle file : ['gadget\PYGZus{}z00.dat']}
\PYG{g+go}{ftype : 'Nbody\PYGZus{}gadget'}
\PYG{g+go}{mxntpe : 6}
\PYG{g+go}{nbody : 20560}
\PYG{g+go}{nbody\PYGZus{}tot : 20560}
\PYG{g+go}{npart : array([ 9160, 10280, 0, 0, 1120, 0])}
\PYG{g+go}{npart\PYGZus{}tot : array([ 9160, 10280, 0, 0, 1120, 0])}
\PYG{g+go}{mass\PYGZus{}tot : 79.7066955566}
\PYG{g+go}{byteorder : 'little'}
\PYG{g+go}{pio : 'no'}
\PYG{g+go}{len pos : 20560}
\PYG{g+go}{pos[0] : array([-1294.48828125, -2217.09765625, -9655.49609375], dtype=float32)}
\PYG{g+go}{pos[-1] : array([ -986.0625 , -2183.83203125, 4017.04296875], dtype=float32)}
\PYG{g+go}{len vel : 20560}
\PYG{g+go}{vel[0] : array([ -69.80491638, 60.56475067, -166.32981873], dtype=float32)}
\PYG{g+go}{vel[-1] : array([-140.59715271, -66.44669342, -37.01613235], dtype=float32)}
\PYG{g+go}{len mass : 20560}
\PYG{g+go}{mass[0] : 0.00108565215487}
\PYG{g+go}{mass[-1] : 0.00108565215487}
\PYG{g+go}{len num : 20560}
\PYG{g+go}{num[0] : 21488}
\PYG{g+go}{num[-1] : 1005192}
\PYG{g+go}{len tpe : 20560}
\PYG{g+go}{tpe[0] : 0}
\PYG{g+go}{tpe[-1] : 4}
\PYG{g+go}{atime : 1.0}
\PYG{g+go}{redshift : 2.22044604925e-16}
\PYG{g+go}{flag\PYGZus{}sfr : 1}
\PYG{g+go}{flag\PYGZus{}feedback : 1}
\PYG{g+go}{nall : [ 9160 10280 0 0 1120 0]}
\PYG{g+go}{flag\PYGZus{}cooling : 1}
\PYG{g+go}{num\PYGZus{}files : 1}
\PYG{g+go}{boxsize : 100000.0}
\PYG{g+go}{omega0 : 0.3}
\PYG{g+go}{omegalambda : 0.7}
\PYG{g+go}{hubbleparam : 0.7}
\PYG{g+go}{flag\PYGZus{}age : 0}
\PYG{g+go}{flag\PYGZus{}metals : 0}
\PYG{g+go}{nallhw : [0 0 0 0 0 0]}
\PYG{g+go}{flag\PYGZus{}entr\PYGZus{}ic : 0}
\PYG{g+go}{critical\PYGZus{}energy\PYGZus{}spec: 0.0}
\PYG{g+go}{len u : 20560}
\PYG{g+go}{u[0] : 6606.63037109}
\PYG{g+go}{u[-1] : 0.0}
\PYG{g+go}{len rho : 20560}
\PYG{g+go}{rho[0] : 7.05811936674e-11}
\PYG{g+go}{rho[-1] : 0.0}
\PYG{g+go}{len rsp : 20560}
\PYG{g+go}{rsp[0] : 909.027587891}
\PYG{g+go}{rsp[-1] : 0.0}
\PYG{g+go}{len opt : 20560}
\PYG{g+go}{opt[0] : 446292.5625}
\PYG{g+go}{opt[-1] : 0.0}
\end{Verbatim}
You can obtain informations on physical values, like the center of mass
or the total angular momentum vector by typing:
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb}\PYG{o}{.}\PYG{n}{cm}\PYG{p}{(}\PYG{p}{)}
\PYG{g+go}{array([-1649.92651346, 609.98256428, -1689.04011033])}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb}\PYG{o}{.}\PYG{n}{Ltot}\PYG{p}{(}\PYG{p}{)}
\PYG{g+go}{array([-1112078.125 , -755964.1875, -1536667.125 ], dtype=float32)}
\end{Verbatim}
In order to visualise the model in position space, it is possible to
generate a surface density map of it using the display instance:
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb}\PYG{o}{.}\PYG{n}{display}\PYG{p}{(}\PYG{n}{size}\PYG{o}{=}\PYG{p}{(}\PYG{l+m+mi}{10000}\PYG{p}{,}\PYG{l+m+mi}{10000}\PYG{p}{)}\PYG{p}{,}\PYG{n}{shape}\PYG{o}{=}\PYG{p}{(}\PYG{l+m+mi}{256}\PYG{p}{,}\PYG{l+m+mi}{256}\PYG{p}{)}\PYG{p}{,}\PYG{n}{palette}\PYG{o}{=}\PYG{l+s}{'}\PYG{l+s}{light}\PYG{l+s}{'}\PYG{p}{)}
\end{Verbatim}
You can now performe some operations on the model in order to explore a specific
region. First, translate the model in position space:
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb}\PYG{o}{.}\PYG{n}{translate}\PYG{p}{(}\PYG{p}{[}\PYG{l+m+mi}{3125}\PYG{p}{,}\PYG{o}{-}\PYG{l+m+mi}{4690}\PYG{p}{,}\PYG{l+m+mi}{1720}\PYG{p}{]}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb}\PYG{o}{.}\PYG{n}{display}\PYG{p}{(}\PYG{n}{size}\PYG{o}{=}\PYG{p}{(}\PYG{l+m+mi}{10000}\PYG{p}{,}\PYG{l+m+mi}{10000}\PYG{p}{)}\PYG{p}{,}\PYG{n}{shape}\PYG{o}{=}\PYG{p}{(}\PYG{l+m+mi}{256}\PYG{p}{,}\PYG{l+m+mi}{256}\PYG{p}{)}\PYG{p}{,}\PYG{n}{palette}\PYG{o}{=}\PYG{l+s}{'}\PYG{l+s}{light}\PYG{l+s}{'}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb}\PYG{o}{.}\PYG{n}{display}\PYG{p}{(}\PYG{n}{size}\PYG{o}{=}\PYG{p}{(}\PYG{l+m+mi}{1000}\PYG{p}{,}\PYG{l+m+mi}{1000}\PYG{p}{)}\PYG{p}{,}\PYG{n}{shape}\PYG{o}{=}\PYG{p}{(}\PYG{l+m+mi}{256}\PYG{p}{,}\PYG{l+m+mi}{256}\PYG{p}{)}\PYG{p}{,}\PYG{n}{palette}\PYG{o}{=}\PYG{l+s}{'}\PYG{l+s}{light}\PYG{l+s}{'}\PYG{p}{)}
\end{Verbatim}
Ou can now rotate around:
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb}\PYG{o}{.}\PYG{n}{rotate}\PYG{p}{(}\PYG{n}{angle}\PYG{o}{=}\PYG{n}{pi}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb}\PYG{o}{.}\PYG{n}{display}\PYG{p}{(}\PYG{n}{size}\PYG{o}{=}\PYG{p}{(}\PYG{l+m+mi}{1000}\PYG{p}{,}\PYG{l+m+mi}{1000}\PYG{p}{)}\PYG{p}{,}\PYG{n}{shape}\PYG{o}{=}\PYG{p}{(}\PYG{l+m+mi}{256}\PYG{p}{,}\PYG{l+m+mi}{256}\PYG{p}{)}\PYG{p}{,}\PYG{n}{palette}\PYG{o}{=}\PYG{l+s}{'}\PYG{l+s}{light}\PYG{l+s}{'}\PYG{p}{)}
\end{Verbatim}
You can now display a temperature map of the model. First,
create a new object with only the gas particles:
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb\PYGZus{}gas} \PYG{o}{=} \PYG{n}{nb}\PYG{o}{.}\PYG{n}{select}\PYG{p}{(}\PYG{l+s}{'}\PYG{l+s}{gas}\PYG{l+s}{'}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb\PYGZus{}gas}\PYG{o}{.}\PYG{n}{display}\PYG{p}{(}\PYG{n}{size}\PYG{o}{=}\PYG{p}{(}\PYG{l+m+mi}{1000}\PYG{p}{,}\PYG{l+m+mi}{1000}\PYG{p}{)}\PYG{p}{,}\PYG{n}{shape}\PYG{o}{=}\PYG{p}{(}\PYG{l+m+mi}{256}\PYG{p}{,}\PYG{l+m+mi}{256}\PYG{p}{)}\PYG{p}{,}\PYG{n}{palette}\PYG{o}{=}\PYG{l+s}{'}\PYG{l+s}{light}\PYG{l+s}{'}\PYG{p}{)}
\end{Verbatim}
now, display the temperture mass-weighted map:
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb\PYGZus{}gas}\PYG{o}{.}\PYG{n}{display}\PYG{p}{(}\PYG{n}{size}\PYG{o}{=}\PYG{p}{(}\PYG{l+m+mi}{1000}\PYG{p}{,}\PYG{l+m+mi}{1000}\PYG{p}{)}\PYG{p}{,}\PYG{n}{shape}\PYG{o}{=}\PYG{p}{(}\PYG{l+m+mi}{256}\PYG{p}{,}\PYG{l+m+mi}{256}\PYG{p}{)}\PYG{p}{,}\PYG{n}{palette}\PYG{o}{=}\PYG{l+s}{'}\PYG{l+s}{rainbow4}\PYG{l+s}{'}\PYG{p}{,}\PYG{n}{mode}\PYG{o}{=}\PYG{l+s}{'}\PYG{l+s}{T}\PYG{l+s}{'}\PYG{p}{,}\PYG{n}{filter\PYGZus{}name}\PYG{o}{=}\PYG{l+s}{'}\PYG{l+s}{gaussian}\PYG{l+s}{'}\PYG{p}{)}
\end{Verbatim}
\subsection{Selection of particles}
\label{rst/Tutorial_interpreter:selection-of-particles}
You can select only particles within a radius smaller tha 500 (in user units)
with respect to the center:
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb\PYGZus{}sub} \PYG{o}{=} \PYG{n}{nb}\PYG{o}{.}\PYG{n}{selectc}\PYG{p}{(}\PYG{p}{(}\PYG{n}{nb}\PYG{o}{.}\PYG{n}{rxyz}\PYG{p}{(}\PYG{p}{)}\PYG{o}{\textless{}}\PYG{l+m+mi}{500}\PYG{p}{)}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb\PYGZus{}sub}\PYG{o}{.}\PYG{n}{display}\PYG{p}{(}\PYG{n}{size}\PYG{o}{=}\PYG{p}{(}\PYG{l+m+mi}{1000}\PYG{p}{,}\PYG{l+m+mi}{1000}\PYG{p}{)}\PYG{p}{,}\PYG{n}{shape}\PYG{o}{=}\PYG{p}{(}\PYG{l+m+mi}{256}\PYG{p}{,}\PYG{l+m+mi}{256}\PYG{p}{)}\PYG{p}{,}\PYG{n}{palette}\PYG{o}{=}\PYG{l+s}{'}\PYG{l+s}{light}\PYG{l+s}{'}\PYG{p}{)}
\end{Verbatim}
Now, rename the new model and save it:
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb\PYGZus{}sub}\PYG{o}{.}\PYG{n}{rename}\PYG{p}{(}\PYG{l+s}{'}\PYG{l+s}{gadget\PYGZus{}z00\PYGZus{}sub.dat}\PYG{l+s}{'}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb\PYGZus{}sub}\PYG{o}{.}\PYG{n}{write}\PYG{p}{(}\PYG{p}{)}
\end{Verbatim}
A new gadget file has been created and saved in the current directory.
We can now select particles as a function of the temperature.
First, display the maximum temperature among all gas particles,
then selectc particles and finally save in `T11.num' the identifier (variable num) of these particles:
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{log10}\PYG{p}{(}\PYG{n+nb}{max}\PYG{p}{(}\PYG{n}{nb\PYGZus{}gas}\PYG{o}{.}\PYG{n}{T}\PYG{p}{(}\PYG{p}{)}\PYG{p}{)}\PYG{p}{)}
\PYG{g+go}{12.8707923889}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb\PYGZus{}sub} \PYG{o}{=} \PYG{n}{nb\PYGZus{}gas}\PYG{o}{.}\PYG{n}{selectc}\PYG{p}{(} \PYG{p}{(}\PYG{n}{nb\PYGZus{}gas}\PYG{o}{.}\PYG{n}{T}\PYG{p}{(}\PYG{p}{)}\PYG{o}{\textgreater{}}\PYG{l+m+mf}{1e11}\PYG{p}{)} \PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb\PYGZus{}sub}\PYG{o}{.}\PYG{n}{write\PYGZus{}num}\PYG{p}{(}\PYG{l+s}{'}\PYG{l+s}{T11.num}\PYG{l+s}{'}\PYG{p}{)}
\end{Verbatim}
Now open a new snapshot, from the same simulation, but at different redshift and find the
particles in previous snapshot with temperature higher than \$10\textasciicircum{}\{11\}\$:
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb} \PYG{o}{=} \PYG{n}{Nbody}\PYG{p}{(}\PYG{l+s}{'}\PYG{l+s}{gadget\PYGZus{}z40.dat}\PYG{l+s}{'}\PYG{p}{,}\PYG{n}{ftype}\PYG{o}{=}\PYG{l+s}{'}\PYG{l+s}{gadget}\PYG{l+s}{'}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb}\PYG{o}{.}\PYG{n}{display}\PYG{p}{(}\PYG{n}{size}\PYG{o}{=}\PYG{p}{(}\PYG{l+m+mi}{10000}\PYG{p}{,}\PYG{l+m+mi}{10000}\PYG{p}{)}\PYG{p}{,}\PYG{n}{shape}\PYG{o}{=}\PYG{p}{(}\PYG{l+m+mi}{256}\PYG{p}{,}\PYG{l+m+mi}{256}\PYG{p}{)}\PYG{p}{,}\PYG{n}{palette}\PYG{o}{=}\PYG{l+s}{'}\PYG{l+s}{light}\PYG{l+s}{'}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb\PYGZus{}sub} \PYG{o}{=} \PYG{n}{nb}\PYG{o}{.}\PYG{n}{selectp}\PYG{p}{(}\PYG{n+nb}{file}\PYG{o}{=}\PYG{l+s}{'}\PYG{l+s}{T11.num}\PYG{l+s}{'}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb\PYGZus{}sub}\PYG{o}{.}\PYG{n}{display}\PYG{p}{(}\PYG{n}{size}\PYG{o}{=}\PYG{p}{(}\PYG{l+m+mi}{10000}\PYG{p}{,}\PYG{l+m+mi}{10000}\PYG{p}{)}\PYG{p}{,}\PYG{n}{shape}\PYG{o}{=}\PYG{p}{(}\PYG{l+m+mi}{256}\PYG{p}{,}\PYG{l+m+mi}{256}\PYG{p}{)}\PYG{p}{,}\PYG{n}{palette}\PYG{o}{=}\PYG{l+s}{'}\PYG{l+s}{light}\PYG{l+s}{'}\PYG{p}{)}
\end{Verbatim}
Now, instead of saving it in a gadget file, save it in a binary file type.
You simply need to call the set\_ftype instance before saving it:
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb} \PYG{o}{=} \PYG{n}{nb}\PYG{o}{.}\PYG{n}{set\PYGZus{}ftype}\PYG{p}{(}\PYG{l+s}{'}\PYG{l+s}{binary}\PYG{l+s}{'}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb}\PYG{o}{.}\PYG{n}{rename}\PYG{p}{(}\PYG{l+s}{'}\PYG{l+s}{binary.dat}\PYG{l+s}{'}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb}\PYG{o}{.}\PYG{n}{write}\PYG{p}{(}\PYG{p}{)}
\end{Verbatim}
\subsection{Merging two models}
\label{rst/Tutorial_interpreter:merging-two-models}
As a last example, we show how two \textbf{pNbody} models can be easyly merged with only 11 lines:
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb1} \PYG{o}{=} \PYG{n}{Nbody}\PYG{p}{(}\PYG{l+s}{'}\PYG{l+s}{disk.dat}\PYG{l+s}{'}\PYG{p}{,}\PYG{n}{ftype}\PYG{o}{=}\PYG{l+s}{'}\PYG{l+s}{gadget}\PYG{l+s}{'}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb2} \PYG{o}{=} \PYG{n}{Nbody}\PYG{p}{(}\PYG{l+s}{'}\PYG{l+s}{disk.dat}\PYG{l+s}{'}\PYG{p}{,}\PYG{n}{ftype}\PYG{o}{=}\PYG{l+s}{'}\PYG{l+s}{gadget}\PYG{l+s}{'}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb1}\PYG{o}{.}\PYG{n}{rotate}\PYG{p}{(}\PYG{n}{angle}\PYG{o}{=}\PYG{n}{pi}\PYG{o}{/}\PYG{l+m+mi}{4}\PYG{p}{,}\PYG{n}{axis}\PYG{o}{=}\PYG{p}{[}\PYG{l+m+mi}{0}\PYG{p}{,}\PYG{l+m+mi}{1}\PYG{p}{,}\PYG{l+m+mi}{0}\PYG{p}{]}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb1}\PYG{o}{.}\PYG{n}{translate}\PYG{p}{(}\PYG{p}{[}\PYG{o}{-}\PYG{l+m+mi}{150}\PYG{p}{,}\PYG{l+m+mi}{0}\PYG{p}{,}\PYG{l+m+mi}{0}\PYG{p}{]}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb1}\PYG{o}{.}\PYG{n}{vel} \PYG{o}{=} \PYG{n}{nb1}\PYG{o}{.}\PYG{n}{vel} \PYG{o}{+} \PYG{p}{[}\PYG{l+m+mi}{50}\PYG{p}{,}\PYG{l+m+mi}{0}\PYG{p}{,}\PYG{l+m+mi}{0}\PYG{p}{]}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb2}\PYG{o}{.}\PYG{n}{rotate}\PYG{p}{(}\PYG{n}{angle}\PYG{o}{=}\PYG{n}{pi}\PYG{o}{/}\PYG{l+m+mi}{4}\PYG{p}{,}\PYG{n}{axis}\PYG{o}{=}\PYG{p}{[}\PYG{l+m+mi}{1}\PYG{p}{,}\PYG{l+m+mi}{0}\PYG{p}{,}\PYG{l+m+mi}{0}\PYG{p}{]}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb2}\PYG{o}{.}\PYG{n}{translate}\PYG{p}{(}\PYG{p}{[}\PYG{o}{+}\PYG{l+m+mi}{150}\PYG{p}{,}\PYG{l+m+mi}{0}\PYG{p}{,}\PYG{l+m+mi}{50}\PYG{p}{]}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb2}\PYG{o}{.}\PYG{n}{vel} \PYG{o}{=} \PYG{n}{nb2}\PYG{o}{.}\PYG{n}{vel} \PYG{o}{-} \PYG{p}{[}\PYG{l+m+mi}{50}\PYG{p}{,}\PYG{l+m+mi}{0}\PYG{p}{,}\PYG{l+m+mi}{0}\PYG{p}{]}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb3} \PYG{o}{=} \PYG{n}{nb1} \PYG{o}{+} \PYG{n}{nb2}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb3}\PYG{o}{.}\PYG{n}{rename}\PYG{p}{(}\PYG{l+s}{'}\PYG{l+s}{merge.dat}\PYG{l+s}{'}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb3}\PYG{o}{.}\PYG{n}{write}\PYG{p}{(}\PYG{p}{)}
\end{Verbatim}
Now display the result from different point of view:
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb3}\PYG{o}{.}\PYG{n}{display}\PYG{p}{(}\PYG{n}{size}\PYG{o}{=}\PYG{p}{(}\PYG{l+m+mi}{300}\PYG{p}{,}\PYG{l+m+mi}{300}\PYG{p}{)}\PYG{p}{,}\PYG{n}{shape}\PYG{o}{=}\PYG{p}{(}\PYG{l+m+mi}{256}\PYG{p}{,}\PYG{l+m+mi}{256}\PYG{p}{)}\PYG{p}{,}\PYG{n}{palette}\PYG{o}{=}\PYG{l+s}{'}\PYG{l+s}{lut2}\PYG{l+s}{'}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb3} \PYG{o}{=} \PYG{n}{nb3}\PYG{o}{.}\PYG{n}{select}\PYG{p}{(}\PYG{l+s}{'}\PYG{l+s}{disk}\PYG{l+s}{'}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb3}\PYG{o}{.}\PYG{n}{display}\PYG{p}{(}\PYG{n}{size}\PYG{o}{=}\PYG{p}{(}\PYG{l+m+mi}{300}\PYG{p}{,}\PYG{l+m+mi}{300}\PYG{p}{)}\PYG{p}{,}\PYG{n}{shape}\PYG{o}{=}\PYG{p}{(}\PYG{l+m+mi}{256}\PYG{p}{,}\PYG{l+m+mi}{256}\PYG{p}{)}\PYG{p}{,}\PYG{n}{palette}\PYG{o}{=}\PYG{l+s}{'}\PYG{l+s}{lut2}\PYG{l+s}{'}\PYG{p}{,}\PYG{n}{view}\PYG{o}{=}\PYG{l+s}{'}\PYG{l+s}{xz}\PYG{l+s}{'}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb3}\PYG{o}{.}\PYG{n}{display}\PYG{p}{(}\PYG{n}{size}\PYG{o}{=}\PYG{p}{(}\PYG{l+m+mi}{300}\PYG{p}{,}\PYG{l+m+mi}{300}\PYG{p}{)}\PYG{p}{,}\PYG{n}{shape}\PYG{o}{=}\PYG{p}{(}\PYG{l+m+mi}{256}\PYG{p}{,}\PYG{l+m+mi}{256}\PYG{p}{)}\PYG{p}{,}\PYG{n}{palette}\PYG{o}{=}\PYG{l+s}{'}\PYG{l+s}{lut2}\PYG{l+s}{'}\PYG{p}{,}\PYG{n}{view}\PYG{o}{=}\PYG{l+s}{'}\PYG{l+s}{xy}\PYG{l+s}{'}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb3}\PYG{o}{.}\PYG{n}{display}\PYG{p}{(}\PYG{n}{size}\PYG{o}{=}\PYG{p}{(}\PYG{l+m+mi}{300}\PYG{p}{,}\PYG{l+m+mi}{300}\PYG{p}{)}\PYG{p}{,}\PYG{n}{shape}\PYG{o}{=}\PYG{p}{(}\PYG{l+m+mi}{256}\PYG{p}{,}\PYG{l+m+mi}{256}\PYG{p}{)}\PYG{p}{,}\PYG{n}{palette}\PYG{o}{=}\PYG{l+s}{'}\PYG{l+s}{lut2}\PYG{l+s}{'}\PYG{p}{,}\PYG{n}{view}\PYG{o}{=}\PYG{l+s}{'}\PYG{l+s}{yz}\PYG{l+s}{'}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb3}\PYG{o}{.}\PYG{n}{display}\PYG{p}{(}\PYG{n}{size}\PYG{o}{=}\PYG{p}{(}\PYG{l+m+mi}{300}\PYG{p}{,}\PYG{l+m+mi}{300}\PYG{p}{)}\PYG{p}{,}\PYG{n}{shape}\PYG{o}{=}\PYG{p}{(}\PYG{l+m+mi}{256}\PYG{p}{,}\PYG{l+m+mi}{256}\PYG{p}{)}\PYG{p}{,}\PYG{n}{palette}\PYG{o}{=}\PYG{l+s}{'}\PYG{l+s}{lut2}\PYG{l+s}{'}\PYG{p}{,}\PYG{n}{xp}\PYG{o}{=}\PYG{p}{[}\PYG{o}{-}\PYG{l+m+mi}{100}\PYG{p}{,}\PYG{l+m+mi}{0}\PYG{p}{,}\PYG{l+m+mi}{0}\PYG{p}{]}\PYG{p}{)}
\end{Verbatim}
or save it into a gif file:
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb3}\PYG{o}{.}\PYG{n}{display}\PYG{p}{(}\PYG{n}{size}\PYG{o}{=}\PYG{p}{(}\PYG{l+m+mi}{300}\PYG{p}{,}\PYG{l+m+mi}{300}\PYG{p}{)}\PYG{p}{,}\PYG{n}{shape}\PYG{o}{=}\PYG{p}{(}\PYG{l+m+mi}{256}\PYG{p}{,}\PYG{l+m+mi}{256}\PYG{p}{)}\PYG{p}{,}\PYG{n}{palette}\PYG{o}{=}\PYG{l+s}{'}\PYG{l+s}{lut2}\PYG{l+s}{'}\PYG{p}{,}\PYG{n}{xp}\PYG{o}{=}\PYG{p}{[}\PYG{o}{-}\PYG{l+m+mi}{100}\PYG{p}{,}\PYG{l+m+mi}{0}\PYG{p}{,}\PYG{l+m+mi}{0}\PYG{p}{]}\PYG{p}{,}\PYG{n}{save}\PYG{o}{=}\PYG{l+s}{'}\PYG{l+s}{image.gif}\PYG{l+s}{'}\PYG{p}{)}
\end{Verbatim}
\section{Using pNbody with scripts}
\label{rst/Tutorial_scripts:using-pnbody-with-scripts}\label{rst/Tutorial_scripts::doc}
In addition to using \textbf{pNbody} in the python interpreter,
it is very useful to use \textbf{pNbody} in python scripts. Usually a python script
begin by the line \#!/usr/bin/env python and must be executable:
\begin{Verbatim}[commandchars=@\[\]]
chmod a+x file.py
\end{Verbatim}
The following example (slice.py), we show how to write a script that opens a gadget file,
select gas particles and cut a thin slice
\begin{gather}
\begin{split}-1000<y<1000\end{split}\notag\\\begin{split}\end{split}\notag
\end{gather}
The new files are saved using the extension .slice.
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{c}{\#!/usr/bin/env python}
\PYG{k+kn}{import} \PYG{n+nn}{sys}
\PYG{k+kn}{from} \PYG{n+nn}{pNbody} \PYG{k+kn}{import} \PYG{o}{*}
\PYG{n}{files} \PYG{o}{=} \PYG{n}{sys}\PYG{o}{.}\PYG{n}{argv}\PYG{p}{[}\PYG{l+m+mi}{1}\PYG{p}{:}\PYG{p}{]}
\PYG{k}{for} \PYG{n+nb}{file} \PYG{o+ow}{in} \PYG{n}{files}\PYG{p}{:}
\PYG{k}{print} \PYG{l+s}{"}\PYG{l+s}{slicing}\PYG{l+s}{"}\PYG{p}{,}\PYG{n+nb}{file}
\PYG{n}{nb} \PYG{o}{=} \PYG{n}{Nbody}\PYG{p}{(}\PYG{n+nb}{file}\PYG{p}{,}\PYG{n}{ftype}\PYG{o}{=}\PYG{l+s}{'}\PYG{l+s}{gadget}\PYG{l+s}{'}\PYG{p}{,}\PYG{n}{pio}\PYG{o}{=}\PYG{l+s}{'}\PYG{l+s}{yes}\PYG{l+s}{'}\PYG{p}{)}
\PYG{n}{nb} \PYG{o}{=} \PYG{n}{nb}\PYG{o}{.}\PYG{n}{select}\PYG{p}{(}\PYG{l+s}{'}\PYG{l+s}{gas}\PYG{l+s}{'}\PYG{p}{)}
\PYG{n}{nb} \PYG{o}{=} \PYG{n}{nb}\PYG{o}{.}\PYG{n}{selectc}\PYG{p}{(}\PYG{p}{(}\PYG{n}{fabs}\PYG{p}{(}\PYG{n}{nb}\PYG{o}{.}\PYG{n}{pos}\PYG{p}{[}\PYG{p}{:}\PYG{p}{,}\PYG{l+m+mi}{1}\PYG{p}{]}\PYG{p}{)}\PYG{o}{\textless{}}\PYG{l+m+mi}{1000}\PYG{p}{)}\PYG{p}{)}
\PYG{n}{nb}\PYG{o}{.}\PYG{n}{rename}\PYG{p}{(}\PYG{n+nb}{file}\PYG{o}{+}\PYG{l+s}{'}\PYG{l+s}{.slice}\PYG{l+s}{'}\PYG{p}{)}
\PYG{n}{nb}\PYG{o}{.}\PYG{n}{write}\PYG{p}{(}\PYG{p}{)}
\end{Verbatim}
In your \code{pnbody\_example} directory, you can run this script with the command:
\begin{Verbatim}[commandchars=@\[\]]
./scripts/slice.py gadget@_z*0.dat
\end{Verbatim}
or:
\begin{Verbatim}[commandchars=@\[\]]
python ./scripts/slice.py gadget@_z*0.dat
\end{Verbatim}
\section{Using pNbody in parallel}
\label{rst/Tutorial_parallel:using-pnbody-in-parallel}\label{rst/Tutorial_parallel::doc}
With \textbf{pNbody}, it is possible to run scripts in parallel, using the \code{mpi} libary.
You need to have of course \code{mpi} and \code{mpi4py} installed.
To check your installation, try:
\begin{Verbatim}[commandchars=@\[\]]
mpirun -np 2 pNbody@_mpi
\end{Verbatim}
you should get:
\begin{Verbatim}[commandchars=@\[\]]
This is task 0 over 2
This is task 1 over 2
\end{Verbatim}
but if you get:
\begin{Verbatim}[commandchars=@\[\]]
This is task 0 over 1
This is task 0 over 1
\end{Verbatim}
this means that something is not working correctly, and you should check your path or \code{mpi} and \code{mpi4py} installation
before reading further.
The prevous scripts \code{scripts/slice.py} can diretely be run in paralle.
This is simply obtained by calling the \code{mpirun} command:
\begin{Verbatim}[commandchars=@\[\]]
mpirun -np 2 scripts/slice.py gadget@_z*0.dat
\end{Verbatim}
In this simple script, only the processus of rank 0 (the master) open the file.
The content of the file (particles) is then distributed among all the other processors.
Eeach processor recives a fraction of the particles.
Then, the selection of gas gas particles and the slice are preformed by all processors on
their local particles.
Finally, the \code{nb.write()} command, run by the master, gather all particles and write the output file.
\subsection{Parallel output}
\label{rst/Tutorial_parallel:parallel-output}
With \textbf{pNbody}, its possible to write files in parallel, i.e., each task write its own file.
We can do this in the previous script simply by adding the line \code{nb.set\_pio('yes')}. This
tells \textbf{pNbody} to write files in parallel when \code{nb.write()} is called.
The content of the new scripts \code{scripts/slice-p1.py} is:
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{c}{\#!/usr/bin/env python}
\PYG{k+kn}{import} \PYG{n+nn}{sys}
\PYG{k+kn}{from} \PYG{n+nn}{pNbody} \PYG{k+kn}{import} \PYG{o}{*}
\PYG{n}{files} \PYG{o}{=} \PYG{n}{sys}\PYG{o}{.}\PYG{n}{argv}\PYG{p}{[}\PYG{l+m+mi}{1}\PYG{p}{:}\PYG{p}{]}
\PYG{k}{for} \PYG{n+nb}{file} \PYG{o+ow}{in} \PYG{n}{files}\PYG{p}{:}
\PYG{k}{print} \PYG{l+s}{"}\PYG{l+s}{slicing}\PYG{l+s}{"}\PYG{p}{,}\PYG{n+nb}{file}
\PYG{n}{nb} \PYG{o}{=} \PYG{n}{Nbody}\PYG{p}{(}\PYG{n+nb}{file}\PYG{p}{,}\PYG{n}{ftype}\PYG{o}{=}\PYG{l+s}{'}\PYG{l+s}{gadget}\PYG{l+s}{'}\PYG{p}{)}
\PYG{n}{nb} \PYG{o}{=} \PYG{n}{nb}\PYG{o}{.}\PYG{n}{select}\PYG{p}{(}\PYG{l+s}{'}\PYG{l+s}{gas}\PYG{l+s}{'}\PYG{p}{)}
\PYG{n}{nb} \PYG{o}{=} \PYG{n}{nb}\PYG{o}{.}\PYG{n}{selectc}\PYG{p}{(}\PYG{p}{(}\PYG{n}{fabs}\PYG{p}{(}\PYG{n}{nb}\PYG{o}{.}\PYG{n}{pos}\PYG{p}{[}\PYG{p}{:}\PYG{p}{,}\PYG{l+m+mi}{1}\PYG{p}{]}\PYG{p}{)}\PYG{o}{\textless{}}\PYG{l+m+mi}{1000}\PYG{p}{)}\PYG{p}{)}
\PYG{n}{nb}\PYG{o}{.}\PYG{n}{rename}\PYG{p}{(}\PYG{n+nb}{file}\PYG{o}{+}\PYG{l+s}{'}\PYG{l+s}{.slice}\PYG{l+s}{'}\PYG{p}{)}
\PYG{n}{nb}\PYG{o}{.}\PYG{n}{set\PYGZus{}pio}\PYG{o}{=}\PYG{l+s}{'}\PYG{l+s}{yes}\PYG{l+s}{'}
\PYG{n}{nb}\PYG{o}{.}\PYG{n}{write}\PYG{p}{(}\PYG{p}{)}
\end{Verbatim}
We can now run it:
\begin{Verbatim}[commandchars=@\[\]]
mpirun -np 2 scripts/slice-p1.py gadget@_z00.dat
\end{Verbatim}
This creates two new files:
\begin{Verbatim}[commandchars=@\[\]]
gadget@_z00.dat.slice.1
gadget@_z00.dat.slice.0
\end{Verbatim}
The files have the same name than the initial name given in \code{Nbody()} with an extention \code{.i} where \code{i}
corresponds to the processus rank. Each file contains the particles attributed to the corresponding task.
\subsection{Parallel input}
\label{rst/Tutorial_parallel:parallel-input}
Now, it possible to start by reading these two files in parallel instead of asking only the master to read one file::
In our script, we add the optional argument \code{pio='yes'} when creating the object with \code{Nbody()}:
Note also that we have used \code{nb.set\_pio('no')}. This force at the end the file te be written only by the master.
\begin{quote}
\#!/usr/bin/env python
import sys
from pNbody import *
files = sys.argv{[}1:{]}
\begin{description}
\item[{for file in files:}] \leavevmode
print ``slicing'',file
nb = Nbody(file,ftype='gadget',pio='yes')
nb = nb.select(`gas')
nb = nb.selectc((fabs(nb.pos{[}:,1{]})\textless{}1000))
nb.rename(file+'.slice.new')
nb.set\_pio(`no')
nb.write()
\end{description}
\end{quote}
When we lunch it:
\begin{Verbatim}[commandchars=@\[\]]
mpirun -np 2 scripts/slice-p2.py gadget@_z00.dat.slice
\end{Verbatim}
the two files \code{gadget\_z00.dat.slice.0} and \code{gadget\_z00.dat.slice.1} are read
each by one task, processed but at the end only the master write the final output : \emph{gadget\_z00.dat.slice.slice.new{}`}.
\subsection{More on parallelisme}
\label{rst/Tutorial_parallel:more-on-parallelisme}
Lets try two other scripts. The first one (\code{findmax.py}) try to find the radial maximum distance among
all particles and the center. It illustrate the difference between using \code{max()}
wich gives the local maximum (maximum among particles of the node) and \code{mpi.mpi\_max()}
which gives the global maximum among all particles:
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{c}{\#!/usr/bin/env python}
\PYG{k+kn}{import} \PYG{n+nn}{sys}
\PYG{k+kn}{from} \PYG{n+nn}{pNbody} \PYG{k+kn}{import} \PYG{o}{*}
\PYG{n+nb}{file} \PYG{o}{=} \PYG{n}{sys}\PYG{o}{.}\PYG{n}{argv}\PYG{p}{[}\PYG{l+m+mi}{1}\PYG{p}{]}
\PYG{n}{nb} \PYG{o}{=} \PYG{n}{Nbody}\PYG{p}{(}\PYG{n+nb}{file}\PYG{p}{,}\PYG{n}{ftype}\PYG{o}{=}\PYG{l+s}{'}\PYG{l+s}{gadget}\PYG{l+s}{'}\PYG{p}{,}\PYG{n}{pio}\PYG{o}{=}\PYG{l+s}{'}\PYG{l+s}{yes}\PYG{l+s}{'}\PYG{p}{)}
\PYG{n}{local\PYGZus{}max} \PYG{o}{=} \PYG{n+nb}{max}\PYG{p}{(}\PYG{n}{nb}\PYG{o}{.}\PYG{n}{rxyz}\PYG{p}{(}\PYG{p}{)}\PYG{p}{)}
\PYG{n}{global\PYGZus{}max} \PYG{o}{=} \PYG{n}{mpi}\PYG{o}{.}\PYG{n}{mpi\PYGZus{}max}\PYG{p}{(}\PYG{n}{nb}\PYG{o}{.}\PYG{n}{rxyz}\PYG{p}{(}\PYG{p}{)}\PYG{p}{)}
\PYG{k}{print} \PYG{l+s}{"}\PYG{l+s}{proc }\PYG{l+s+si}{\%d}\PYG{l+s}{ local\PYGZus{}max = }\PYG{l+s+si}{\%f}\PYG{l+s}{ global\PYGZus{}max = }\PYG{l+s+si}{\%f}\PYG{l+s}{"}\PYG{o}{\%}\PYG{p}{(}\PYG{n}{mpi}\PYG{o}{.}\PYG{n}{ThisTask}\PYG{p}{,}\PYG{n}{local\PYGZus{}max}\PYG{p}{,}\PYG{n}{global\PYGZus{}max}\PYG{p}{)}
\end{Verbatim}
When running it, you should get:
\begin{Verbatim}[commandchars=@\[\]]
mpirun -np 2 ./scripts/findmax.py gadget@_z00.dat.slice
proc 1 local@_max = 8109.682129 global@_max = 8109.682129
proc 0 local@_max = 7733.846680 global@_max = 8109.682129
\end{Verbatim}
which illustrate clearly the point. Finally, the latter script shows that even graphical
functions support parallelisme. The script \code{showmap.py} illustrate this point by computing
a map of the model:
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{c}{\#!/usr/bin/env python}
\PYG{k+kn}{import} \PYG{n+nn}{sys}
\PYG{k+kn}{from} \PYG{n+nn}{pNbody} \PYG{k+kn}{import} \PYG{o}{*}
\PYG{n+nb}{file} \PYG{o}{=} \PYG{n}{sys}\PYG{o}{.}\PYG{n}{argv}\PYG{p}{[}\PYG{l+m+mi}{1}\PYG{p}{]}
\PYG{n}{nb} \PYG{o}{=} \PYG{n}{Nbody}\PYG{p}{(}\PYG{n+nb}{file}\PYG{p}{,}\PYG{n}{ftype}\PYG{o}{=}\PYG{l+s}{'}\PYG{l+s}{gadget}\PYG{l+s}{'}\PYG{p}{,}\PYG{n}{pio}\PYG{o}{=}\PYG{l+s}{'}\PYG{l+s}{yes}\PYG{l+s}{'}\PYG{p}{)}
\PYG{n}{nb}\PYG{o}{.}\PYG{n}{display}\PYG{p}{(}\PYG{n}{size}\PYG{o}{=}\PYG{p}{(}\PYG{l+m+mi}{10000}\PYG{p}{,}\PYG{l+m+mi}{10000}\PYG{p}{)}\PYG{p}{,}\PYG{n}{shape}\PYG{o}{=}\PYG{p}{(}\PYG{l+m+mi}{256}\PYG{p}{,}\PYG{l+m+mi}{256}\PYG{p}{)}\PYG{p}{,}\PYG{n}{palette}\PYG{o}{=}\PYG{l+s}{'}\PYG{l+s}{light}\PYG{l+s}{'}\PYG{p}{)}
\end{Verbatim}
When running
\begin{Verbatim}[commandchars=@\[\]]
mpirun -np 2 ./scripts/showmap.py gadget@_z00.dat.slice
\end{Verbatim}
you get an image of the model. The mapping has been performed independently by two processors.
\chapter{Setting a format file}
\label{rst/Formats:setting-a-format-file}\label{rst/Formats::doc}
\chapter{Display Models}
\label{rst/Display:display-models}\label{rst/Display::doc}
\chapter{Generating initial conditions}
\label{rst/InitialConditions:generating-initial-conditions}\label{rst/InitialConditions::doc}
\textbf{pNbody} provides a lots of different way
to generatin initial conditions, ready to be
run with evolution codes.
The generation of initial conditions is devided into
two parts. First, the generation of a mass profile by
distributing particles in space. Secondly, the determination
of the velocities for each of these particles.
\section{Generating mass profiles}
\label{rst/GeneratingMassProfiles:generating-mass-profiles}\label{rst/GeneratingMassProfiles::doc}
A serie of routines dedictated to the generation of mass profiles
are provided by {\hyperref[rst/IcModule::doc]{\emph{the ic module}}}.
They can be devided according to their geometry:
\begin{threeparttable}
\capstart\caption{cubic distribution}
\begin{tabulary}{\linewidth}{|L|L|}
\hline
\textbf{
function name
} & \textbf{
description
}\\
\hline
box
&
particles in a box
\\
\hline
\end{tabulary}
\end{threeparttable}
\begin{threeparttable}
\capstart\caption{axi-symetrical (disk) distribution}
\begin{tabulary}{\linewidth}{|L|L|}
\hline
\textbf{
function name
} & \textbf{
description
}\\
\hline
homodisk
&
homogeneous disk
\\
kuzmin
&
kuzmin disk
\\
expd
&
exponnential disk
\\
miyamoto\_nagai
&
Miyamoto-Nagai disk
\\
\hline
\end{tabulary}
\end{threeparttable}
\begin{threeparttable}
\capstart\caption{spherical distribution}
\begin{tabulary}{\linewidth}{|L|L|}
\hline
\textbf{
function name
} & \textbf{
description
}\\
\hline
homosphere
&
homogeneous sphere
\\
plummer
&
phlummer sphere
\\
nfw
&
Navarro-Frenk-White profile
\\
hernquist
&
Hernquist profile
\\
dl2
& \begin{gather}
\begin{split}\rho \sim (1-\epsilon (r/r_{\rm{max}})^2)\end{split}\notag\\\begin{split}\end{split}\notag
\end{gather}\\
isothm
&
Isothermal profile
\\
pisothm
&
Pseudo-Isothermal profile
\\
shell
&
shell
\\
burkert
&
Burkert profile
\\
nfwg
&
Modified Navarro-Frenk-White profile
\\
generic2c
&
generic two slope model
\\
generic\_alpha
& \begin{gather}
\begin{split}\rho \sim (r+e)^a\end{split}\notag\\\begin{split}\end{split}\notag
\end{gather}\\
generic\_Mr
&
spherical generic model
\\
\hline
\end{tabulary}
\end{threeparttable}
Finally, some routines generate special object used
for rendering:
\begin{threeparttable}
\capstart\caption{primer objects}
\begin{tabulary}{\linewidth}{|L|L|}
\hline
\textbf{
function name
} & \textbf{
description
}\\
\hline
line
&
a simple line
\\
square
&
a square
\\
circle
&
a circle
\\
grid
&
a 2d grid
\\
cube
&
a cube
\\
sphere
&
a sphere
\\
\hline
\end{tabulary}
\end{threeparttable}
Each of these routines returns an \textbf{Nbody} object.
\subsection{Examples:}
\label{rst/GeneratingMassProfiles:examples}
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{k+kn}{from} \PYG{n+nn}{pNbody} \PYG{k+kn}{import} \PYG{n}{ic}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb}\PYG{o}{=}\PYG{n}{ic}\PYG{o}{.}\PYG{n}{box}\PYG{p}{(}\PYG{l+m+mi}{1000}\PYG{p}{,}\PYG{l+m+mi}{1}\PYG{p}{,}\PYG{l+m+mi}{1}\PYG{p}{,}\PYG{l+m+mi}{1}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb}\PYG{o}{.}\PYG{n}{info}\PYG{p}{(}\PYG{p}{)}
\PYG{g+go}{-----------------------------------}
\PYG{g+go}{particle file : ['box.dat']}
\PYG{g+go}{ftype : 'Nbody\PYGZus{}binary'}
\PYG{g+go}{mxntpe : 6}
\PYG{g+go}{nbody : 1000}
\PYG{g+go}{nbody\PYGZus{}tot : 1000}
\PYG{g+go}{npart : [1000, 0, 0, 0, 0, 0]}
\PYG{g+go}{npart\PYGZus{}tot : [1000, 0, 0, 0, 0, 0]}
\PYG{g+go}{mass\PYGZus{}tot : 0.9999907}
\PYG{g+go}{byteorder : 'little'}
\PYG{g+go}{pio : 'no'}
\PYG{g+go}{len pos : 1000}
\PYG{g+go}{pos[0] : array([ 0.78348911, 0.03045347, 0.34180355], dtype=float32)}
\PYG{g+go}{pos[-1] : array([ 0.14677997, -0.05187676, 0.11189017], dtype=float32)}
\PYG{g+go}{len vel : 1000}
\PYG{g+go}{vel[0] : array([ 0., 0., 0.], dtype=float32)}
\PYG{g+go}{vel[-1] : array([ 0., 0., 0.], dtype=float32)}
\PYG{g+go}{len mass : 1000}
\PYG{g+go}{mass[0] : 0.001}
\PYG{g+go}{mass[-1] : 0.001}
\PYG{g+go}{len num : 1000}
\PYG{g+go}{num[0] : 0}
\PYG{g+go}{num[-1] : 999}
\PYG{g+go}{len tpe : 1000}
\PYG{g+go}{tpe[0] : 0}
\PYG{g+go}{tpe[-1] : 0}
\PYG{g+go}{tnow : 0.0}
\PYG{g+go}{label : binary}
\PYG{g+go}{dt : 0.0}
\PYG{g+go}{\textgreater{}\textgreater{}\textgreater{}}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb}\PYG{o}{.}\PYG{n}{display}\PYG{p}{(}\PYG{p}{)}
\end{Verbatim}
\subsection{Generic spherical distributions:}
\label{rst/GeneratingMassProfiles:generic-spherical-distributions}
In spherical cases, its possible to generate any mass profile, using a
generic function ({\hyperref[rst/IcModule:pNbody.ic.generic_Mr]{\code{generic\_Mr()}}}). The function takes as argument a vector that
defines the cumulative mass as a function of the radius:
\begin{gather}
\begin{split}M(r)=4\pi\int_0^r \rho(r')r'^2 dr'\end{split}\notag\\\begin{split}\end{split}\notag
\end{gather}
for example, an homogeneous sphere may be obtained by:
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{k+kn}{from} \PYG{n+nn}{pNbody} \PYG{k+kn}{import} \PYG{n}{ic}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{k+kn}{from} \PYG{n+nn}{numpy} \PYG{k+kn}{import} \PYG{o}{*}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{rmax}\PYG{o}{=}\PYG{l+m+mi}{10}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{dr}\PYG{o}{=}\PYG{l+m+mf}{0.01}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{n} \PYG{o}{=} \PYG{l+m+mi}{10000}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{rs} \PYG{o}{=} \PYG{n}{arange}\PYG{p}{(}\PYG{l+m+mi}{0}\PYG{p}{,}\PYG{n}{rmax}\PYG{p}{,}\PYG{n}{dr}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{Mrs} \PYG{o}{=} \PYG{n}{rs}\PYG{o}{*}\PYG{o}{*}\PYG{l+m+mi}{3}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb} \PYG{o}{=} \PYG{n}{ic}\PYG{o}{.}\PYG{n}{generic\PYGZus{}Mr}\PYG{p}{(}\PYG{n}{n}\PYG{p}{,}\PYG{n}{rmax}\PYG{o}{=}\PYG{n}{rmax}\PYG{p}{,}\PYG{n}{R}\PYG{o}{=}\PYG{n}{rs}\PYG{p}{,}\PYG{n}{Mr}\PYG{o}{=}\PYG{n}{Mrs}\PYG{p}{,}\PYG{n}{ftype}\PYG{o}{=}\PYG{l+s}{'}\PYG{l+s}{gadget}\PYG{l+s}{'}\PYG{p}{)}
\end{Verbatim}
The verctor \code{rs} is not necessary linear. This is usefull
to avoid resolution problems, if for example, the mass profile is steep
in some regions. There, intervals between radial bins may be reduced.
In this more funny example, we generate a radial profile corresponding to the following function:
\begin{gather}
\begin{split}\rho(r) \sim \frac{1}{2}\left[1+\cos(4r) \right] \exp(-r)\end{split}\notag\\\begin{split}\end{split}\notag
\end{gather}
As before, we use the function {\hyperref[rst/IcModule:pNbody.ic.generic_Mr]{\code{generic\_Mr()}}}:
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{k+kn}{from} \PYG{n+nn}{pNbody} \PYG{k+kn}{import} \PYG{n}{ic}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{k+kn}{from} \PYG{n+nn}{numpy} \PYG{k+kn}{import} \PYG{o}{*}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{n} \PYG{o}{=} \PYG{l+m+mi}{1000000}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{rmax} \PYG{o}{=} \PYG{l+m+mf}{10.}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{dr} \PYG{o}{=} \PYG{l+m+mf}{0.01}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{rs} \PYG{o}{=} \PYG{n}{arange}\PYG{p}{(}\PYG{l+m+mi}{0}\PYG{p}{,}\PYG{n}{rmax}\PYG{p}{,}\PYG{n}{dr}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{rho} \PYG{o}{=} \PYG{l+m+mf}{0.5}\PYG{o}{*}\PYG{p}{(}\PYG{l+m+mi}{1}\PYG{o}{+}\PYG{n}{cos}\PYG{p}{(}\PYG{l+m+mi}{4}\PYG{o}{*}\PYG{n}{rs}\PYG{p}{)} \PYG{p}{)}\PYG{o}{*}\PYG{n}{exp}\PYG{p}{(}\PYG{o}{-}\PYG{n}{rs}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{Mrs} \PYG{o}{=} \PYG{n}{add}\PYG{o}{.}\PYG{n}{accumulate}\PYG{p}{(}\PYG{n}{rho}\PYG{o}{*}\PYG{n}{rs}\PYG{o}{*}\PYG{o}{*}\PYG{l+m+mi}{2} \PYG{o}{*} \PYG{n}{dr}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb} \PYG{o}{=} \PYG{n}{ic}\PYG{o}{.}\PYG{n}{generic\PYGZus{}Mr}\PYG{p}{(}\PYG{n}{n}\PYG{p}{,}\PYG{n}{rmax}\PYG{o}{=}\PYG{n}{rmax}\PYG{p}{,}\PYG{n}{R}\PYG{o}{=}\PYG{n}{rs}\PYG{p}{,}\PYG{n}{Mr}\PYG{o}{=}\PYG{n}{Mrs}\PYG{p}{,}\PYG{n}{ftype}\PYG{o}{=}\PYG{l+s}{'}\PYG{l+s}{gadget}\PYG{l+s}{'}\PYG{p}{)}
\end{Verbatim}
It is possible to check the result by extractig the accumulated mass directely from the \textbf{Nbody} object,
using {\hyperref[rst/LibgridModule::doc]{\emph{the libgrid module}}}:
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{k+kn}{from} \PYG{n+nn}{pNbody} \PYG{k+kn}{import} \PYG{n}{libgrid}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{c}{\# create a grid object and extract density and mass profile}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{G} \PYG{o}{=} \PYG{n}{libgrid}\PYG{o}{.}\PYG{n}{Spherical\PYGZus{}1d\PYGZus{}Grid}\PYG{p}{(}\PYG{n}{rmin}\PYG{o}{=}\PYG{l+m+mi}{0}\PYG{p}{,}\PYG{n}{rmax}\PYG{o}{=}\PYG{n}{rmax}\PYG{p}{,}\PYG{n}{nr}\PYG{o}{=}\PYG{l+m+mi}{512}\PYG{p}{,}\PYG{n}{g}\PYG{o}{=}\PYG{n+nb+bp}{None}\PYG{p}{,}\PYG{n}{gm}\PYG{o}{=}\PYG{n+nb+bp}{None}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{r} \PYG{o}{=} \PYG{n}{G}\PYG{o}{.}\PYG{n}{get\PYGZus{}r}\PYG{p}{(}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{rho} \PYG{o}{=} \PYG{n}{G}\PYG{o}{.}\PYG{n}{get\PYGZus{}DensityMap}\PYG{p}{(}\PYG{n}{nb}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{mr} \PYG{o}{=} \PYG{n}{add}\PYG{o}{.}\PYG{n}{accumulate}\PYG{p}{(}\PYG{n}{G}\PYG{o}{.}\PYG{n}{get\PYGZus{}MassMap}\PYG{p}{(}\PYG{n}{nb}\PYG{p}{)}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{c}{\# plot results}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{k+kn}{import} \PYG{n+nn}{pylab} \PYG{k+kn}{as} \PYG{n+nn}{pt}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{pt}\PYG{o}{.}\PYG{n}{plot}\PYG{p}{(}\PYG{n}{rs}\PYG{p}{,}\PYG{n}{Mrs}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{pt}\PYG{o}{.}\PYG{n}{plot}\PYG{p}{(}\PYG{n}{r}\PYG{p}{,}\PYG{n}{mr}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{pt}\PYG{o}{.}\PYG{n}{xlabel}\PYG{p}{(}\PYG{l+s}{"}\PYG{l+s}{radius}\PYG{l+s}{"}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{pt}\PYG{o}{.}\PYG{n}{ylabel}\PYG{p}{(}\PYG{l+s}{"}\PYG{l+s}{accumulated mass}\PYG{l+s}{"}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{pt}\PYG{o}{.}\PYG{n}{show}\PYG{p}{(}\PYG{p}{)}
\end{Verbatim}
If everything goes well, we obtain a nice correspondance between the imposed and
the computed mass profile, as seen in the graph below.
\includegraphics{mass_profile.png}
\subsection{Generic cubic distributions:}
\label{rst/GeneratingMassProfiles:generic-cubic-distributions}
Its possible generate a cubic box with the density varying along one axix. This is obtained
by using the {\hyperref[rst/IcModule:pNbody.ic.generic_Mx]{\code{generic\_Mx()}}} function. As for {\hyperref[rst/IcModule:pNbody.ic.generic_Mr]{\code{generic\_Mr()}}}, we have to define
the variation of the cumulative mass, in this case, the x axis. In the following example,
we set a two level transition along the x axis, following the function:
\begin{gather}
\begin{split}\rho(x) = \rho_1 + \frac{\rho_2-\rho_1}{ (1+\exp(-2(x-x_1)/\sigma))(1+\exp(2(x-x_2)/\sigma)) }\end{split}\notag\\\begin{split}\end{split}\notag
\end{gather}
This gives:
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{k+kn}{from} \PYG{n+nn}{pNbody} \PYG{k+kn}{import} \PYG{n}{ic}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{k+kn}{from} \PYG{n+nn}{numpy} \PYG{k+kn}{import} \PYG{o}{*}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{xs} \PYG{o}{=} \PYG{n}{arange}\PYG{p}{(}\PYG{l+m+mi}{0}\PYG{p}{,}\PYG{l+m+mi}{1}\PYG{p}{,}\PYG{l+m+mf}{1.}\PYG{o}{/}\PYG{l+m+mf}{10000.}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{n} \PYG{o}{=} \PYG{l+m+mi}{100000}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{rho1} \PYG{o}{=} \PYG{l+m+mi}{1}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{rho2} \PYG{o}{=} \PYG{l+m+mi}{10}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{x1} \PYG{o}{=} \PYG{l+m+mf}{0.25}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{x2} \PYG{o}{=} \PYG{l+m+mf}{0.75}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{sigma} \PYG{o}{=} \PYG{l+m+mf}{0.025}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{rho} \PYG{o}{=} \PYG{n}{rho1} \PYG{o}{+} \PYG{p}{(}\PYG{n}{rho2}\PYG{o}{-}\PYG{n}{rho1}\PYG{p}{)}\PYG{o}{/}\PYG{p}{(} \PYG{p}{(}\PYG{l+m+mi}{1}\PYG{o}{+}\PYG{n}{exp}\PYG{p}{(}\PYG{o}{-}\PYG{l+m+mf}{2.}\PYG{o}{*}\PYG{p}{(}\PYG{n}{xs}\PYG{o}{-}\PYG{n}{x1}\PYG{p}{)}\PYG{o}{/}\PYG{n}{sigma}\PYG{p}{)}\PYG{p}{)}\PYG{o}{*}\PYG{p}{(}\PYG{l+m+mi}{1}\PYG{o}{+}\PYG{n}{exp}\PYG{p}{(}\PYG{l+m+mf}{2.}\PYG{o}{*}\PYG{p}{(}\PYG{n}{xs}\PYG{o}{-}\PYG{n}{x2}\PYG{p}{)}\PYG{o}{/}\PYG{n}{sigma}\PYG{p}{)}\PYG{p}{)}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{Mxs} \PYG{o}{=} \PYG{n}{add}\PYG{o}{.}\PYG{n}{accumulate}\PYG{p}{(}\PYG{n}{rho}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb} \PYG{o}{=} \PYG{n}{ic}\PYG{o}{.}\PYG{n}{generic\PYGZus{}Mx}\PYG{p}{(}\PYG{n}{n}\PYG{p}{,}\PYG{l+m+mf}{1.0}\PYG{p}{,}\PYG{n}{x}\PYG{o}{=}\PYG{n}{xs}\PYG{p}{,}\PYG{n}{Mx}\PYG{o}{=}\PYG{n}{Mxs}\PYG{p}{,}\PYG{n}{name}\PYG{o}{=}\PYG{l+s}{'}\PYG{l+s}{tbox.dat}\PYG{l+s}{'}\PYG{p}{,}\PYG{n}{ftype}\PYG{o}{=}\PYG{l+s}{'}\PYG{l+s}{gadget}\PYG{l+s}{'}\PYG{p}{)}
\end{Verbatim}
Let's display now the model:
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb}\PYG{o}{.}\PYG{n}{translate}\PYG{p}{(}\PYG{p}{[}\PYG{o}{-}\PYG{l+m+mf}{0.5}\PYG{p}{,}\PYG{o}{-}\PYG{l+m+mf}{0.5}\PYG{p}{,}\PYG{o}{-}\PYG{l+m+mf}{0.5}\PYG{p}{]}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb}\PYG{o}{.}\PYG{n}{show}\PYG{p}{(}\PYG{n}{view}\PYG{o}{=}\PYG{l+s}{'}\PYG{l+s}{xy}\PYG{l+s}{'}\PYG{p}{,}\PYG{n}{size}\PYG{o}{=}\PYG{p}{(}\PYG{l+m+mf}{0.6}\PYG{p}{,}\PYG{l+m+mf}{0.6}\PYG{p}{)}\PYG{p}{)}
\end{Verbatim}
The two density levels are well seen in projection.
\includegraphics{two_levels.png}
\subsection{Spherical distribution with variable resolution:}
\label{rst/GeneratingMassProfiles:spherical-distribution-with-variable-resolution}
In some circumstances, it may be insterested to generate a profile, with
a variable resolution. In all previous examples, the mass of the particles where
identical. Here, we show a case where the mass of the particles varies with the radius.
This allows to increase the number of particles in the central regrions, where resolution
is needed, and to decrease it in the outer regions.
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb\PYGZus{}halo} \PYG{o}{=} \PYG{n}{GenericDistribution}\PYG{p}{(}\PYG{n}{n\PYGZus{}halo}\PYG{p}{,}\PYG{n}{dmdr\PYGZus{}fct\PYGZus{}halo}\PYG{p}{,}\PYG{p}{(}\PYG{n}{rs\PYGZus{}halo}\PYG{p}{,}\PYG{n}{gamma\PYGZus{}halo}\PYG{p}{)}\PYG{p}{,}\PYG{n}{rmax\PYGZus{}halo}\PYG{p}{,}\PYG{n}{ftype}\PYG{o}{=}\PYG{l+s}{'}\PYG{l+s}{gadget}\PYG{l+s}{'}\PYG{p}{)}
\end{Verbatim}
\section{Generating velocities}
\label{rst/GeneratingVelocities:generating-velocities}\label{rst/GeneratingVelocities::doc}
Setting initial velocities may be trivial or very complex, depending
on the aim. Of course, its allways possible to directely set the
variable `'nb.vel'' to some values. However, in galactic dynamics, this
is usually nor the right way to do.
\textbf{pNbody} offers different methods to set the velocities in order to ensure
the system to be in a resonably good equilibrium.
\begin{tabulary}{\linewidth}{|L|L|L|}
\hline
\textbf{
method name
} & \textbf{
geometry
} & \textbf{
method
}\\
\hline
{\hyperref[rst/MainModule:pNbody.main.NbodyDefault.Get_Velocities_From_AdaptativeSpherical_Grid]{\code{NbodyDefault.Get\_Velocities\_From\_AdaptativeSpherical\_Grid()}}}
&
spherical
&
jeans equation+self-adaptative grid
\\
{\hyperref[rst/MainModule:pNbody.main.NbodyDefault.Get_Velocities_From_Spherical_Grid]{\code{NbodyDefault.Get\_Velocities\_From\_Spherical\_Grid()}}}
&
spherical
&
jeans equation
\\
{\hyperref[rst/MainModule:pNbody.main.NbodyDefault.Get_Velocities_From_Cylindrical_Grid]{\code{NbodyDefault.Get\_Velocities\_From\_Cylindrical\_Grid()}}}
&
cylindrical
&
jeans equation
\\
\hline
\end{tabulary}
Some examples showing how to set the initial velocities for spherical or axi-symetric models are provided in the
example directory. To get it, type:
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{n}{pNbody\PYGZus{}copy}\PYG{o}{-}\PYG{n}{examples}
\end{Verbatim}
by default, this create a directory in your home \code{\textasciitilde{}/pnbody\_examples}.
The scripts are in the \code{\textasciitilde{}/pnbody\_examples/ic} directory.
\subsection{Spherical coordinate}
\label{rst/GeneratingVelocities:spherical-coordinate}
In spherical coordinates, supposing that the velocities are isotropics. the Jeans equations is reduced to one integral,
giving the value of the velocity dispertion of a component $i$ :
\begin{gather}
\begin{split}\sigma_{i}^2(r) = \frac{1}{\rho_{i}(r)}\int_r^\infty\! dr' \,\rho_{i}(r')\, \partial_{r'} \Phi(r').\end{split}\notag\\\begin{split}\end{split}\notag
\end{gather}
\subsection{Example : Set a Plummer sphere to the jeans equilibrium}
\label{rst/GeneratingVelocities:example-set-a-plummer-sphere-to-the-jeans-equilibrium}
First, generate the Plummer sphere:
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{k+kn}{from} \PYG{n+nn}{pNbody} \PYG{k+kn}{import} \PYG{n}{ic}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{k+kn}{from} \PYG{n+nn}{numpy} \PYG{k+kn}{import} \PYG{o}{*}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{n} \PYG{o}{=} \PYG{l+m+mi}{100000}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{a} \PYG{o}{=} \PYG{l+m+mf}{1.}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{rmax} \PYG{o}{=} \PYG{l+m+mf}{10.}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb} \PYG{o}{=} \PYG{n}{ic}\PYG{o}{.}\PYG{n}{plummer}\PYG{p}{(}\PYG{n}{n}\PYG{p}{,}\PYG{l+m+mi}{1}\PYG{p}{,}\PYG{l+m+mi}{1}\PYG{p}{,}\PYG{l+m+mi}{1}\PYG{p}{,}\PYG{n}{eps}\PYG{o}{=}\PYG{n}{a}\PYG{p}{,}\PYG{n}{rmax}\PYG{o}{=}\PYG{n}{rmax}\PYG{p}{,}\PYG{n}{name}\PYG{o}{=}\PYG{l+s}{'}\PYG{l+s}{plummer.dat}\PYG{l+s}{'}\PYG{p}{,}\PYG{n}{ftype}\PYG{o}{=}\PYG{l+s}{'}\PYG{l+s}{gadget}\PYG{l+s}{'}\PYG{p}{)}
\end{Verbatim}
Then, we need to create a 1D grid wraping the model:
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{grmin} \PYG{o}{=} \PYG{l+m+mi}{0} \PYG{c}{\# grid minimal radius}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{grmax} \PYG{o}{=} \PYG{n}{rmax}\PYG{o}{*}\PYG{l+m+mf}{1.05} \PYG{c}{\# grid maximal radius}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nr} \PYG{o}{=} \PYG{l+m+mi}{128} \PYG{c}{\# number of radial bins}
\end{Verbatim}
Now, in order to decrease the noise in outer regions, it is usefull to
use a non linear grid. In this purpose, we need to define a function that
defines the new nodes of the grid. Here, we set it logarithmic. The inverse function
is also needed:
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{rc} \PYG{o}{=} \PYG{n}{a}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{g} \PYG{o}{=} \PYG{k}{lambda} \PYG{n}{r}\PYG{p}{:}\PYG{n}{log}\PYG{p}{(}\PYG{n}{r}\PYG{o}{/}\PYG{n}{rc}\PYG{o}{+}\PYG{l+m+mi}{1}\PYG{p}{)} \PYG{c}{\# the function}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{gm} \PYG{o}{=} \PYG{k}{lambda} \PYG{n}{r}\PYG{p}{:}\PYG{n}{rc}\PYG{o}{*}\PYG{p}{(}\PYG{n}{exp}\PYG{p}{(}\PYG{n}{r}\PYG{p}{)}\PYG{o}{-}\PYG{l+m+mi}{1}\PYG{p}{)} \PYG{c}{\# and its inverse}
\end{Verbatim}
Now it possible to invoque the magic function:
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{eps} \PYG{o}{=} \PYG{l+m+mf}{0.01} \PYG{c}{\# gravitational softening}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb}\PYG{p}{,}\PYG{n}{phi}\PYG{p}{,}\PYG{n}{stats} \PYG{o}{=} \PYG{n}{nb}\PYG{o}{.}\PYG{n}{Get\PYGZus{}Velocities\PYGZus{}From\PYGZus{}Spherical\PYGZus{}Grid}\PYG{p}{(}\PYG{n}{eps}\PYG{o}{=}\PYG{n}{eps}\PYG{p}{,}\PYG{n}{nr}\PYG{o}{=}\PYG{n}{nr}\PYG{p}{,}\PYG{n}{rmax}\PYG{o}{=}\PYG{n}{grmax}\PYG{p}{,}\PYG{n}{phi}\PYG{o}{=}\PYG{n+nb+bp}{None}\PYG{p}{,}\PYG{n}{g}\PYG{o}{=}\PYG{n}{g}\PYG{p}{,}\PYG{n}{gm}\PYG{o}{=}\PYG{n}{gm}\PYG{p}{,}\PYG{n}{UseTree}\PYG{o}{=}\PYG{n+nb+bp}{True}\PYG{p}{,}\PYG{n}{ErrTolTheta}\PYG{o}{=}\PYG{l+m+mf}{0.5}\PYG{p}{)}
\end{Verbatim}
If \code{UseTree=True} the function uses a \code{treecode} to compute the potential at each node.
A new \code{nb} object with velocities computed from the Jeans equation is returned. We also get the potential in each node
and some statistics. The potential \code{phi} is usefull if we need to run the method for another component.
Using the \code{stats} variable, it is possible to plot some interesting values used during the computation, like the velocity dispertion as a function of the radius:
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{k+kn}{import} \PYG{n+nn}{pylab} \PYG{k+kn}{as} \PYG{n+nn}{pt}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{pt}\PYG{o}{.}\PYG{n}{plot}\PYG{p}{(}\PYG{n}{stats}\PYG{p}{[}\PYG{l+s}{'}\PYG{l+s}{r}\PYG{l+s}{'}\PYG{p}{]}\PYG{p}{,}\PYG{n}{stats}\PYG{p}{[}\PYG{l+s}{'}\PYG{l+s}{sigma}\PYG{l+s}{'}\PYG{p}{]}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{pt}\PYG{o}{.}\PYG{n}{show}\PYG{p}{(}\PYG{p}{)}
\end{Verbatim}
\includegraphics{r-sigma.png}
or the density profile:
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{pt}\PYG{o}{.}\PYG{n}{plot}\PYG{p}{(}\PYG{n}{stats}\PYG{p}{[}\PYG{l+s}{'}\PYG{l+s}{r}\PYG{l+s}{'}\PYG{p}{]}\PYG{p}{,}\PYG{n}{stats}\PYG{p}{[}\PYG{l+s}{'}\PYG{l+s}{rho}\PYG{l+s}{'}\PYG{p}{]}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{pt}\PYG{o}{.}\PYG{n}{loglog}\PYG{p}{(}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{pt}\PYG{o}{.}\PYG{n}{show}\PYG{p}{(}\PYG{p}{)}
\end{Verbatim}
\includegraphics{r-rho.png}
It is possible to check the velocity dispertion along the line of sight directely
by mesuring it using a grid object:
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{k+kn}{from} \PYG{n+nn}{pNbody} \PYG{k+kn}{import} \PYG{n}{libgrid}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{G} \PYG{o}{=} \PYG{n}{libgrid}\PYG{o}{.}\PYG{n}{Spherical\PYGZus{}1d\PYGZus{}Grid}\PYG{p}{(}\PYG{n}{rmin}\PYG{o}{=}\PYG{l+m+mi}{0}\PYG{p}{,}\PYG{n}{rmax}\PYG{o}{=}\PYG{n}{rmax}\PYG{p}{,}\PYG{n}{nr}\PYG{o}{=}\PYG{l+m+mi}{128}\PYG{p}{,}\PYG{n}{g}\PYG{o}{=}\PYG{n+nb+bp}{None}\PYG{p}{,}\PYG{n}{gm}\PYG{o}{=}\PYG{n+nb+bp}{None}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{r} \PYG{o}{=} \PYG{n}{G}\PYG{o}{.}\PYG{n}{get\PYGZus{}r}\PYG{p}{(}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{sigma} \PYG{o}{=} \PYG{n}{G}\PYG{o}{.}\PYG{n}{get\PYGZus{}SigmaValMap}\PYG{p}{(}\PYG{n}{nb}\PYG{p}{,}\PYG{n}{nb}\PYG{o}{.}\PYG{n}{vz}\PYG{p}{(}\PYG{p}{)}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{pt}\PYG{o}{.}\PYG{n}{plot}\PYG{p}{(}\PYG{n}{r}\PYG{p}{,}\PYG{n}{sigma}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{pt}\PYG{o}{.}\PYG{n}{xlabel}\PYG{p}{(}\PYG{l+s}{"}\PYG{l+s}{radius}\PYG{l+s}{"}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{pt}\PYG{o}{.}\PYG{n}{ylabel}\PYG{p}{(}\PYG{l+s}{"}\PYG{l+s}{velocity dispertion}\PYG{l+s}{"}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{pt}\PYG{o}{.}\PYG{n}{show}\PYG{p}{(}\PYG{p}{)}
\end{Verbatim}
\includegraphics{r-sigma-mes.png}
\subsection{Cylindrical coordinate}
\label{rst/GeneratingVelocities:cylindrical-coordinate}
As in spherical geometry, we use the Jeans equations to get an approximation of the velocity dispertions.
\subsubsection{Vertical velocity dispersion}
\label{rst/GeneratingVelocities:vertical-velocity-dispersion}
The resolution of these equations in cylindrical coordinates gives directely the dispersion along the z axis:
\begin{gather}
\begin{split}{\sigma_z}_i^2 = \frac{1}{\rho_i(z)}\int_z^\infty\! dz' \,\rho_i(z')\, \partial_{z'} \Phi(z').\end{split}\notag\\\begin{split}\end{split}\notag
\end{gather}
and the mean azimuthal velocity:
\subsubsection{Radial velocity dispersion}
\label{rst/GeneratingVelocities:radial-velocity-dispersion}\begin{enumerate}
\item {}
if \code{mode\_sigma\_r{[}'name'{]}='epicyclic\_approximation'}, we use the epicyclic approximation which hold:
\end{enumerate}
\begin{gather}
\begin{split}\sigma_R^2 = \sigma_z^2 \frac{1}{\beta^2} \frac{\nu^2}{\kappa^2}\end{split}\notag\\\begin{split}\end{split}\notag
\end{gather}
the parameter $\beta^2$ is set by the variable \code{mode\_sigma\_r{[}'param'{]}} and takes usually a value around 1.
\begin{enumerate}
\setcounter{enumi}{1}
\item {}
if \code{mode\_sigma\_r{[}'name'{]}='isothropic'}, the value is simply:
\end{enumerate}
\begin{gather}
\begin{split}\sigma_R^2 = \sigma_z^2\end{split}\notag\\\begin{split}\end{split}\notag
\end{gather}\begin{enumerate}
\setcounter{enumi}{2}
\item {}
if \code{mode\_sigma\_r{[}'name'{]}='toomre'}, we determine the velocity dispersion uses the Safronov-Toomre parameter $Q$:
\begin{gather}
\begin{split}\sigma_R = \frac{3.36 Q G \Sigma_i}{\kappa}\end{split}\notag\\\begin{split}\end{split}\notag
\end{gather}
$Q$ is set with the variable \code{mode\_sigma\_r{[}'param'{]}}.
\item {}
if \code{mode\_sigma\_r{[}'name'{]}='constant'}, the value is simply constant, given by the variable \code{mode\_sigma\_r{[}'param'{]}}:
\end{enumerate}
\begin{gather}
\begin{split}\sigma_R = cte\end{split}\notag\\\begin{split}\end{split}\notag
\end{gather}
\subsubsection{Azimuthal velocity dispersion}
\label{rst/GeneratingVelocities:azimuthal-velocity-dispersion}\begin{enumerate}
\item {}
if \code{mode\_sigma\_p{[}'name'{]}='epicyclic\_approximation'}, we use the epicyclic approximation which hold:
\end{enumerate}
\begin{gather}
\begin{split}\sigma_\phi^2 = \sigma_r^2 \frac{1}{4} \frac{\kappa^2}{\Omega^2}\end{split}\notag\\\begin{split}\end{split}\notag
\end{gather}\begin{enumerate}
\setcounter{enumi}{1}
\item {}
if \code{mode\_sigma\_p{[}'name'{]}='isothropic'}, the value is simply:
\end{enumerate}
\begin{gather}
\begin{split}\sigma_\phi^2 = \sigma_z^2\end{split}\notag\\\begin{split}\end{split}\notag
\end{gather}
\subsubsection{Mean azimuthal velocity}
\label{rst/GeneratingVelocities:mean-azimuthal-velocity}
Finally, the mean azimuthal velocity is also derived directely from the Jeans equations:
\begin{gather}
\begin{split}\langle v_{\phi}^2 \rangle = R\,\partial_{R} \Phi(R,z) + \sigma_R^2 - \sigma_\phi^2 + \frac{R}{\rho_i} \partial_R \left( \rho_i \sigma_R^2 \right),\end{split}\notag\\\begin{split}\end{split}\notag
\end{gather}
\subsection{Example : Set an exponnential disk to the jeans equilibrium}
\label{rst/GeneratingVelocities:example-set-an-exponnential-disk-to-the-jeans-equilibrium}
Lest try to put an exponnential disk at the Jeans equilibrium.
First, we generate the disk:
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{k+kn}{from} \PYG{n+nn}{pNbody} \PYG{k+kn}{import} \PYG{n}{ic}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{k+kn}{from} \PYG{n+nn}{numpy} \PYG{k+kn}{import} \PYG{o}{*}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{n} \PYG{o}{=} \PYG{l+m+mi}{100000}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{Hz} \PYG{o}{=} \PYG{l+m+mf}{0.3}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{Hr} \PYG{o}{=} \PYG{l+m+mf}{3.}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{Rmax} \PYG{o}{=} \PYG{l+m+mf}{30.}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{Zmax} \PYG{o}{=} \PYG{l+m+mf}{3.}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb} \PYG{o}{=} \PYG{n}{ic}\PYG{o}{.}\PYG{n}{expd}\PYG{p}{(}\PYG{n}{n}\PYG{p}{,}\PYG{n}{Hr}\PYG{p}{,}\PYG{n}{Hz}\PYG{p}{,}\PYG{n}{Rmax}\PYG{p}{,}\PYG{n}{Zmax}\PYG{p}{,}\PYG{n}{irand}\PYG{o}{=}\PYG{l+m+mi}{1}\PYG{p}{,}\PYG{n}{name}\PYG{o}{=}\PYG{l+s}{'}\PYG{l+s}{expd.dat}\PYG{l+s}{'}\PYG{p}{,}\PYG{n}{ftype}\PYG{o}{=}\PYG{l+s}{'}\PYG{l+s}{gadget}\PYG{l+s}{'}\PYG{p}{)}
\end{Verbatim}
Then, we need to set the parameters for the cylindrical grid:
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{grmin} \PYG{o}{=} \PYG{l+m+mf}{0.} \PYG{c}{\# minimal grid radius}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{grmax} \PYG{o}{=} \PYG{l+m+mf}{1.1}\PYG{o}{*}\PYG{n}{Rmax} \PYG{c}{\# maximal grid radius}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{gzmin} \PYG{o}{=} \PYG{o}{-}\PYG{l+m+mf}{1.1}\PYG{o}{*}\PYG{n}{Zmax} \PYG{c}{\# minimal grid z}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{gzmax} \PYG{o}{=} \PYG{l+m+mf}{1.1}\PYG{o}{*}\PYG{n}{Zmax} \PYG{c}{\# maximal grid z}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nr} \PYG{o}{=} \PYG{l+m+mi}{32} \PYG{c}{\# number of bins in r}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nt} \PYG{o}{=} \PYG{l+m+mi}{2} \PYG{c}{\# number of bins in t}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nz} \PYG{o}{=} \PYG{l+m+mi}{64}\PYG{o}{+}\PYG{l+m+mi}{1} \PYG{c}{\# number of bins in z}
\end{Verbatim}
\begin{description}
\item[{Set some functions used to distort the grid along the radius::}] \leavevmode
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{rc} \PYG{o}{=} \PYG{n}{Hr}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{g} \PYG{o}{=} \PYG{k}{lambda} \PYG{n}{r}\PYG{p}{:}\PYG{n}{log}\PYG{p}{(}\PYG{n}{r}\PYG{o}{/}\PYG{n}{rc}\PYG{o}{+}\PYG{l+m+mf}{1.}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{gm} \PYG{o}{=} \PYG{k}{lambda} \PYG{n}{r}\PYG{p}{:}\PYG{n}{rc}\PYG{o}{*}\PYG{p}{(}\PYG{n}{exp}\PYG{p}{(}\PYG{n}{r}\PYG{p}{)}\PYG{o}{-}\PYG{l+m+mf}{1.}\PYG{p}{)}
\end{Verbatim}
\end{description}
Set some options on how to compute velocity dispertions:
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{mode\PYGZus{}sigma\PYGZus{}z} \PYG{o}{=} \PYG{p}{\PYGZob{}}\PYG{l+s}{"}\PYG{l+s}{name}\PYG{l+s}{"}\PYG{p}{:}\PYG{l+s}{"}\PYG{l+s}{jeans}\PYG{l+s}{"}\PYG{p}{,}\PYG{l+s}{"}\PYG{l+s}{param}\PYG{l+s}{"}\PYG{p}{:}\PYG{n+nb+bp}{None}\PYG{p}{\PYGZcb{}}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{mode\PYGZus{}sigma\PYGZus{}r} \PYG{o}{=} \PYG{p}{\PYGZob{}}\PYG{l+s}{"}\PYG{l+s}{name}\PYG{l+s}{"}\PYG{p}{:}\PYG{l+s}{"}\PYG{l+s}{toomre}\PYG{l+s}{"}\PYG{p}{,}\PYG{l+s}{"}\PYG{l+s}{param}\PYG{l+s}{"}\PYG{p}{:}\PYG{l+m+mf}{1.0}\PYG{p}{\PYGZcb{}}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{mode\PYGZus{}sigma\PYGZus{}p} \PYG{o}{=} \PYG{p}{\PYGZob{}}\PYG{l+s}{"}\PYG{l+s}{name}\PYG{l+s}{"}\PYG{p}{:}\PYG{l+s}{"}\PYG{l+s}{epicyclic\PYGZus{}approximation}\PYG{l+s}{"}\PYG{p}{,}\PYG{l+s}{"}\PYG{l+s}{param}\PYG{l+s}{"}\PYG{p}{:}\PYG{n+nb+bp}{None}\PYG{p}{\PYGZcb{}}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{params} \PYG{o}{=} \PYG{p}{[}\PYG{n}{mode\PYGZus{}sigma\PYGZus{}z}\PYG{p}{,}\PYG{n}{mode\PYGZus{}sigma\PYGZus{}r}\PYG{p}{,}\PYG{n}{mode\PYGZus{}sigma\PYGZus{}p}\PYG{p}{]}
\end{Verbatim}
Set the gravitational softening:
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{eps}\PYG{o}{=}\PYG{l+m+mf}{0.1}
\end{Verbatim}
And finally, lunch the magic function:
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb}\PYG{p}{,}\PYG{n}{phi}\PYG{p}{,}\PYG{n}{stats} \PYG{o}{=} \PYG{n}{nb}\PYG{o}{.}\PYG{n}{Get\PYGZus{}Velocities\PYGZus{}From\PYGZus{}Cylindrical\PYGZus{}Grid}\PYG{p}{(}\PYG{n}{select}\PYG{o}{=}\PYG{l+s}{'}\PYG{l+s}{0}\PYG{l+s}{'}\PYG{p}{,}\PYG{n}{disk}\PYG{o}{=}\PYG{p}{(}\PYG{l+m+mi}{0}\PYG{p}{)}\PYG{p}{,}\PYG{n}{eps}\PYG{o}{=}\PYG{n}{eps}\PYG{p}{,}\PYG{n}{nR}\PYG{o}{=}\PYG{n}{nr}\PYG{p}{,}\PYG{n}{nz}\PYG{o}{=}\PYG{n}{nz}\PYG{p}{,}\PYG{n}{nt}\PYG{o}{=}\PYG{n}{nt}\PYG{p}{,}\PYG{n}{Rmax}\PYG{o}{=}\PYG{n}{grmax}\PYG{p}{,}\PYG{n}{zmin}\PYG{o}{=}\PYG{n}{gzmin}\PYG{p}{,}\PYG{n}{zmax}\PYG{o}{=}\PYG{n}{gzmax}\PYG{p}{,}\PYG{n}{params}\PYG{o}{=}\PYG{n}{params}\PYG{p}{,}\PYG{n}{Phi}\PYG{o}{=}\PYG{n+nb+bp}{None}\PYG{p}{,}\PYG{n}{g}\PYG{o}{=}\PYG{n}{g}\PYG{p}{,}\PYG{n}{gm}\PYG{o}{=}\PYG{n}{gm}\PYG{p}{)}
\end{Verbatim}
The parameter \code{select='0'} tells that we want to compute the velocities on particles of type 0, while
\code{disk=0} tells that what we considere as the disk is only the particles 0. This is usefull when dealing with
multi-component models.
The latter function return \code{nb} with the new velocities, a matrix \code{phi} containing the potential at each node of the grid,
and a dictrionary \code{stats} containing some physical usefull quantities. Lets plot some of them:
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{k+kn}{import} \PYG{n+nn}{pylab} \PYG{k+kn}{as} \PYG{n+nn}{pt}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{pt}\PYG{o}{.}\PYG{n}{plot}\PYG{p}{(}\PYG{n}{stats}\PYG{p}{[}\PYG{l+s}{'}\PYG{l+s}{R}\PYG{l+s}{'}\PYG{p}{]}\PYG{p}{,}\PYG{n}{stats}\PYG{p}{[}\PYG{l+s}{'}\PYG{l+s}{vc}\PYG{l+s}{'}\PYG{p}{]}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{pt}\PYG{o}{.}\PYG{n}{plot}\PYG{p}{(}\PYG{n}{stats}\PYG{p}{[}\PYG{l+s}{'}\PYG{l+s}{R}\PYG{l+s}{'}\PYG{p}{]}\PYG{p}{,}\PYG{n}{stats}\PYG{p}{[}\PYG{l+s}{'}\PYG{l+s}{vm}\PYG{l+s}{'}\PYG{p}{]}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{pt}\PYG{o}{.}\PYG{n}{plot}\PYG{p}{(}\PYG{n}{stats}\PYG{p}{[}\PYG{l+s}{'}\PYG{l+s}{R}\PYG{l+s}{'}\PYG{p}{]}\PYG{p}{,}\PYG{n}{stats}\PYG{p}{[}\PYG{l+s}{'}\PYG{l+s}{sr}\PYG{l+s}{'}\PYG{p}{]}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{pt}\PYG{o}{.}\PYG{n}{plot}\PYG{p}{(}\PYG{n}{stats}\PYG{p}{[}\PYG{l+s}{'}\PYG{l+s}{R}\PYG{l+s}{'}\PYG{p}{]}\PYG{p}{,}\PYG{n}{stats}\PYG{p}{[}\PYG{l+s}{'}\PYG{l+s}{sz}\PYG{l+s}{'}\PYG{p}{]}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{pt}\PYG{o}{.}\PYG{n}{plot}\PYG{p}{(}\PYG{n}{stats}\PYG{p}{[}\PYG{l+s}{'}\PYG{l+s}{R}\PYG{l+s}{'}\PYG{p}{]}\PYG{p}{,}\PYG{n}{stats}\PYG{p}{[}\PYG{l+s}{'}\PYG{l+s}{sp}\PYG{l+s}{'}\PYG{p}{]}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{pt}\PYG{o}{.}\PYG{n}{xlabel}\PYG{p}{(}\PYG{l+s}{'}\PYG{l+s}{Radius}\PYG{l+s}{'}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{pt}\PYG{o}{.}\PYG{n}{ylabel}\PYG{p}{(}\PYG{l+s}{'}\PYG{l+s}{velocity}\PYG{l+s}{'}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{pt}\PYG{o}{.}\PYG{n}{show}\PYG{p}{(}\PYG{p}{)}
\end{Verbatim}
\includegraphics{jean_cyl1.png}
Lets try instead of fixing the Tomre parameter, to use for the radial velocity dispertion
the epicyclic approximation.
This is done by using the following parameters:
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{mode\PYGZus{}sigma\PYGZus{}z} \PYG{o}{=} \PYG{p}{\PYGZob{}}\PYG{l+s}{"}\PYG{l+s}{name}\PYG{l+s}{"}\PYG{p}{:}\PYG{l+s}{"}\PYG{l+s}{jeans}\PYG{l+s}{"}\PYG{p}{,}\PYG{l+s}{"}\PYG{l+s}{param}\PYG{l+s}{"}\PYG{p}{:}\PYG{n+nb+bp}{None}\PYG{p}{\PYGZcb{}}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{mode\PYGZus{}sigma\PYGZus{}r} \PYG{o}{=} \PYG{p}{\PYGZob{}}\PYG{l+s}{"}\PYG{l+s}{name}\PYG{l+s}{"}\PYG{p}{:}\PYG{l+s}{"}\PYG{l+s}{epicyclic\PYGZus{}approximation}\PYG{l+s}{"}\PYG{p}{,}\PYG{l+s}{"}\PYG{l+s}{param}\PYG{l+s}{"}\PYG{p}{:}\PYG{l+m+mi}{1}\PYG{p}{\PYGZcb{}}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{mode\PYGZus{}sigma\PYGZus{}p} \PYG{o}{=} \PYG{p}{\PYGZob{}}\PYG{l+s}{"}\PYG{l+s}{name}\PYG{l+s}{"}\PYG{p}{:}\PYG{l+s}{"}\PYG{l+s}{epicyclic\PYGZus{}approximation}\PYG{l+s}{"}\PYG{p}{,}\PYG{l+s}{"}\PYG{l+s}{param}\PYG{l+s}{"}\PYG{p}{:}\PYG{n+nb+bp}{None}\PYG{p}{\PYGZcb{}}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{params} \PYG{o}{=} \PYG{p}{[}\PYG{n}{mode\PYGZus{}sigma\PYGZus{}z}\PYG{p}{,}\PYG{n}{mode\PYGZus{}sigma\PYGZus{}r}\PYG{p}{,}\PYG{n}{mode\PYGZus{}sigma\PYGZus{}p}\PYG{p}{]}
\end{Verbatim}
again, run the magic function:
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{nb}\PYG{p}{,}\PYG{n}{phi}\PYG{p}{,}\PYG{n}{stats} \PYG{o}{=} \PYG{n}{nb}\PYG{o}{.}\PYG{n}{Get\PYGZus{}Velocities\PYGZus{}From\PYGZus{}Cylindrical\PYGZus{}Grid}\PYG{p}{(}\PYG{n}{select}\PYG{o}{=}\PYG{l+s}{'}\PYG{l+s}{0}\PYG{l+s}{'}\PYG{p}{,}\PYG{n}{disk}\PYG{o}{=}\PYG{p}{(}\PYG{l+m+mi}{0}\PYG{p}{)}\PYG{p}{,}\PYG{n}{eps}\PYG{o}{=}\PYG{n}{eps}\PYG{p}{,}\PYG{n}{nR}\PYG{o}{=}\PYG{n}{nr}\PYG{p}{,}\PYG{n}{nz}\PYG{o}{=}\PYG{n}{nz}\PYG{p}{,}\PYG{n}{nt}\PYG{o}{=}\PYG{n}{nt}\PYG{p}{,}\PYG{n}{Rmax}\PYG{o}{=}\PYG{n}{grmax}\PYG{p}{,}\PYG{n}{zmin}\PYG{o}{=}\PYG{n}{gzmin}\PYG{p}{,}\PYG{n}{zmax}\PYG{o}{=}\PYG{n}{gzmax}\PYG{p}{,}\PYG{n}{params}\PYG{o}{=}\PYG{n}{params}\PYG{p}{,}\PYG{n}{Phi}\PYG{o}{=}\PYG{n+nb+bp}{None}\PYG{p}{,}\PYG{n}{g}\PYG{o}{=}\PYG{n}{g}\PYG{p}{,}\PYG{n}{gm}\PYG{o}{=}\PYG{n}{gm}\PYG{p}{)}
\end{Verbatim}
Now lets plot the Tommre parameter:
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{pt}\PYG{o}{.}\PYG{n}{plot}\PYG{p}{(}\PYG{n}{stats}\PYG{p}{[}\PYG{l+s}{'}\PYG{l+s}{R}\PYG{l+s}{'}\PYG{p}{]}\PYG{p}{,}\PYG{n}{stats}\PYG{p}{[}\PYG{l+s}{'}\PYG{l+s}{Q}\PYG{l+s}{'}\PYG{p}{]}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{pt}\PYG{o}{.}\PYG{n}{xlabel}\PYG{p}{(}\PYG{l+s}{'}\PYG{l+s}{Radius}\PYG{l+s}{'}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{pt}\PYG{o}{.}\PYG{n}{ylabel}\PYG{p}{(}\PYG{l+s}{'}\PYG{l+s}{Q}\PYG{l+s}{'}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{pt}\PYG{o}{.}\PYG{n}{show}\PYG{p}{(}\PYG{p}{)}
\end{Verbatim}
\includegraphics{jean_cyl2.png}
\chapter{How to deal with units ?}
\label{rst/Units:how-to-deal-with-units}\label{rst/Units::doc}
\chapter{Generating grids}
\label{rst/Grids:generating-grids}\label{rst/Grids::doc}
\chapter{Reference}
\label{rst/Reference::doc}\label{rst/Reference:reference}
Contents:
\section{the main module}
\label{rst/MainModule:module-pNbody.main}\label{rst/MainModule::doc}\label{rst/MainModule:the-main-module}\index{pNbody.main (module)}\index{Nbody() (in module pNbody.main)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.Nbody}\pysiglinewithargsret{\code{pNbody.main.}\bfcode{Nbody}}{\emph{*arg}, \emph{**kw}}{}
The aim of this function is simply to return to the right class
\end{fulllineitems}
\index{NbodyDefault (class in pNbody.main)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault}\pysiglinewithargsret{\strong{class }\code{pNbody.main.}\bfcode{NbodyDefault}}{\emph{p\_name=None}, \emph{pos=None}, \emph{vel=None}, \emph{mass=None}, \emph{num=None}, \emph{tpe=None}, \emph{ftype=None}, \emph{status='old'}, \emph{byteorder='little'}, \emph{pio='no'}, \emph{local=False}, \emph{log=None}, \emph{unitsfile=None}}{}
This is the reference Nbody class.
This is the constructor for the \textbf{Nbody} object. Optional arguments are:
\begin{description}
\item[{p\_name}] \leavevmode{[}name of the file{]}
in case of multiple files, files must be included in a list {[}''file1'',''file2''{]}
\end{description}
pos : positions (3xN array)
vel : positions (3xN array)
mass : positions (1x array)
num : id of particles (1xN array)
tpe : type of particles (1xN array)
ftype : type of input file (binary,ascii)
\begin{description}
\item[{status}] \leavevmode{[}`old'{]}{[}open an old file{]}
`new' : create a new object
\end{description}
byteorder : `little' or `big'
pio : parallel io : `yes' or `no'
local : True=local object, False=global object (paralellized) Not implemeted Yet
log : log file
unitsfile : define the type of units
by default this class initialize the following variables :
\begin{quote}
self.p\_name : name of the file(s) to read or write
self.pos : array of positions
self.vel : array of velocities
self.mass : array of masses
self.num : array of id
self.tpe : array of types
self.ftype : type of the file
self.status : object status (`old' or `new')
self.byteorder : byter order (`little' or `big')
self.pio : parallel io (`yes' or `no')
self.log : log object
\# new variables
self.nbody : local number of particles
self.nbody\_tot : total number of particles
self.mass\_tot : total mass
self.npart : number of particles of each type
self.npart\_tot : total number of particles of each type
self.spec\_vars : dictionary of variables specific for the format used
self.spec\_vect : dictionary of vector specific for the format used
\end{quote}
\paragraph{Methods}
\index{A() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.A}\pysiglinewithargsret{\bfcode{A}}{}{}
Return the gas entropy of the model.
The output is an nx1 float array.
\end{fulllineitems}
\index{Accel() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.Accel}\pysiglinewithargsret{\bfcode{Accel}}{\emph{x}, \emph{eps}}{}
Return the acceleration at a given position, using the softening lenght eps.
x : position (array vector)
eps : softening
\end{fulllineitems}
\index{CombiMap() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.CombiMap}\pysiglinewithargsret{\bfcode{CombiMap}}{\emph{*arg}, \emph{**kw}}{}
Return an image in form of a matrix (nx x ny float array).
Contrary to ComputeMap, CombiMap compose different output of ComputeMap.
pos : position of particles (moment 0)
sr : dispertion in r (with respect to xp)
svr : dispertion in vr
vxyr : mean velocity in the plane
svxyr: dispertion in vxy
vtr : mean tangential velocity in the plane
svtr : dispertion in vt
szr : ratio sigma z/sigma r
\end{fulllineitems}
\index{ComputeDensityAndHsml() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.ComputeDensityAndHsml}\pysiglinewithargsret{\bfcode{ComputeDensityAndHsml}}{\emph{pos=None}, \emph{Hsml=None}, \emph{DesNumNgb=None}, \emph{MaxNumNgbDeviation=None}, \emph{Tree=None}}{}
Compute Density and Hsml (for a specific place)
\end{fulllineitems}
\index{ComputeHisto() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.ComputeHisto}\pysiglinewithargsret{\bfcode{ComputeHisto}}{\emph{bins}, \emph{mode}, \emph{space}}{}
Compute and histogram
\end{fulllineitems}
\index{ComputeMap() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.ComputeMap}\pysiglinewithargsret{\bfcode{ComputeMap}}{\emph{*arg}, \emph{**kw}}{}
Return an image in form of a matrix (nx x ny float array)
obs : position of observer
x0 : eye position
xp : focal position
alpha : angle of the head
view : `xy' `xz' `yz'
eye : `right' `left'
dist\_eye : distance between eyes
mode : mode of map
space : pos or vel
persp : `on' `off'
clip : (near,far)
size : (maxx,maxy)
cut : `yes' `no'
frsp : factor for rsp
shape : shape of the map
\end{fulllineitems}
\index{ComputeMeanHisto() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.ComputeMeanHisto}\pysiglinewithargsret{\bfcode{ComputeMeanHisto}}{\emph{bins}, \emph{mode1}, \emph{space}}{}
Compute the mean map of an observable.
\end{fulllineitems}
\index{ComputeMeanMap() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.ComputeMeanMap}\pysiglinewithargsret{\bfcode{ComputeMeanMap}}{\emph{*arg}, \emph{**kw}}{}
Compute the mean map of an observable.
\end{fulllineitems}
\index{ComputeObjectMap() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.ComputeObjectMap}\pysiglinewithargsret{\bfcode{ComputeObjectMap}}{\emph{*arg}, \emph{**kw}}{}~\begin{itemize}
\item {} \begin{itemize}
\item {} \begin{itemize}
\item {}
IN DEVELOPPEMENT : allow to draw an object like a box, a grid... * * *
\end{itemize}
\end{itemize}
\end{itemize}
Return an image in form of a matrix (nx x ny float array)
obs : position of observer
x0 : eye position
xp : focal position
alpha : angle of the head
view : `xy' `xz' `yz'
eye : `right' `left'
dist\_eye : distance between eyes
mode : mode of map
space : pos or vel
persp : `on' `off'
clip : (near,far)
size : (maxx,maxy)
cut : `yes' `no'
frsp : factor for rsp
shape : shape of the map
\end{fulllineitems}
\index{ComputeSigmaHisto() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.ComputeSigmaHisto}\pysiglinewithargsret{\bfcode{ComputeSigmaHisto}}{\emph{bins}, \emph{mode1}, \emph{mode2}, \emph{space}}{}
Compute the histogram of an observable.
\end{fulllineitems}
\index{ComputeSigmaMap() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.ComputeSigmaMap}\pysiglinewithargsret{\bfcode{ComputeSigmaMap}}{\emph{*arg}, \emph{**kw}}{}
Compute the sigma map of an observable.
\end{fulllineitems}
\index{ComputeSph() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.ComputeSph}\pysiglinewithargsret{\bfcode{ComputeSph}}{\emph{DesNumNgb=None}, \emph{MaxNumNgbDeviation=None}, \emph{Tree=None}}{}
Compute self.Density and self.Hsml using sph approximation
\end{fulllineitems}
\index{Ekin() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.Ekin}\pysiglinewithargsret{\bfcode{Ekin}}{}{}
Return the total kinetic energy
\end{fulllineitems}
\index{Epot() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.Epot}\pysiglinewithargsret{\bfcode{Epot}}{\emph{eps}}{}
Return the total potential energy using the softening lenght eps.
eps : softening
WARNING : THIS FUNCTION DO NOT WORK IN MPI MODE
\end{fulllineitems}
\index{ExchangeParticles() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.ExchangeParticles}\pysiglinewithargsret{\bfcode{ExchangeParticles}}{}{}
Exchange particles betwee procs, using peano-hilbert decomposition computed in ptree
\end{fulllineitems}
\index{Get\_Velocities\_From\_AdaptativeSpherical\_Grid() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.Get_Velocities_From_AdaptativeSpherical_Grid}\pysiglinewithargsret{\bfcode{Get\_Velocities\_From\_AdaptativeSpherical\_Grid}}{\emph{select=None}, \emph{eps=0.10000000000000001}, \emph{n=1000}, \emph{UseTree=True}, \emph{Tree=None}, \emph{phi=None}, \emph{ErrTolTheta=0.5}}{}
Computes velocities using the jeans equation in spherical coordinates.
An adaptative grid is set automatically.
\end{fulllineitems}
\index{Get\_Velocities\_From\_Cylindrical\_Grid() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.Get_Velocities_From_Cylindrical_Grid}\pysiglinewithargsret{\bfcode{Get\_Velocities\_From\_Cylindrical\_Grid}}{\emph{select='disk', disk=(`gas', `disk'), eps=0.10000000000000001, nR=32, nz=32, nt=2, Rmax=100, zmin=-10, zmax=10, params={[}None, None, None{]}, UseTree=True, Tree=None, Phi=None, ErrTolTheta=0.5, AdaptativeSoftenning=False, g=None, gm=None}}{}
Computes velocities using the jeans equation in cylindrical coordinates.
\end{fulllineitems}
\index{Get\_Velocities\_From\_Spherical\_Grid() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.Get_Velocities_From_Spherical_Grid}\pysiglinewithargsret{\bfcode{Get\_Velocities\_From\_Spherical\_Grid}}{\emph{select=None}, \emph{eps=0.10000000000000001}, \emph{nr=128}, \emph{rmax=100.0}, \emph{UseTree=True}, \emph{Tree=None}, \emph{phi=None}, \emph{ErrTolTheta=0.5}, \emph{g=None}, \emph{gm=None}, \emph{NoDispertion=False}, \emph{omega=None}}{}
Computes velocities using the jeans equation in spherical coordinates.
\end{fulllineitems}
\index{Get\_Velocities\_From\_Virial\_Approximation() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.Get_Velocities_From_Virial_Approximation}\pysiglinewithargsret{\bfcode{Get\_Velocities\_From\_Virial\_Approximation}}{\emph{select=None}, \emph{vf=1.0}, \emph{eps=0.10000000000000001}, \emph{UseTree=True}, \emph{Tree=None}, \emph{ErrTolTheta=0.5}}{}
This routine does not work ! Do not use it, or check !
\end{fulllineitems}
\index{InitSpec() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.InitSpec}\pysiglinewithargsret{\bfcode{InitSpec}}{}{}
This function allows to initialize specific parameters.
It must be defined in format files.
\end{fulllineitems}
\index{IntegrateUsingRK() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.IntegrateUsingRK}\pysiglinewithargsret{\bfcode{IntegrateUsingRK}}{\emph{tstart=0}, \emph{dt=1}, \emph{dt0=1.0000000000000001e-05}, \emph{epsx=1e-13}, \emph{epsv=1e-13}}{}
Integrate the equation of motion using RK78 integrator.
tstart : initial time
dt : interval time
dt0 : inital dt
epsx : position precision
epsv : velocity precision
tmin,tmax,dt,dtout,epsx,epsv,filename
\end{fulllineitems}
\index{L() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.L}\pysiglinewithargsret{\bfcode{L}}{}{}
Return the angular momentum in x,y,z of all particles.
The output is an 3xn float array.
\end{fulllineitems}
\index{Ltot() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.Ltot}\pysiglinewithargsret{\bfcode{Ltot}}{}{}
Return the total angular momentum.
The output is an 3x1 float array.
\end{fulllineitems}
\index{Lum() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.Lum}\pysiglinewithargsret{\bfcode{Lum}}{}{}
Return the luminosty of the model, defined as
Lum = m*u/Tcool = m*Lambda/rho
The output is an nx1 float array.
\end{fulllineitems}
\index{Map() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.Map}\pysiglinewithargsret{\bfcode{Map}}{\emph{*arg}, \emph{**kw}}{}
Return 2 final images (float and int)
\end{fulllineitems}
\index{MeanWeight() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.MeanWeight}\pysiglinewithargsret{\bfcode{MeanWeight}}{}{}
Return the mean weight of a model, taking into account
heating by UV source.
The output is an nx1 float array.
\end{fulllineitems}
\index{Mr\_Spherical() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.Mr_Spherical}\pysiglinewithargsret{\bfcode{Mr\_Spherical}}{\emph{nr=25}, \emph{rmin=0}, \emph{rmax=50}}{}
Return the mass inside radius r (supposing a spherical density distribution).
The output is 2 n x 1 float arrays.
nr : number of bins (size of the output)
rmin : minimal radius (this must be zero, instead it is wrong...)
rmax : maximal radius
\end{fulllineitems}
\index{Ne() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.Ne}\pysiglinewithargsret{\bfcode{Ne}}{}{}
Return the electron density of the model.
The output is an nx1 float array.
\end{fulllineitems}
\index{P() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.P}\pysiglinewithargsret{\bfcode{P}}{}{}
Return the gas pressure of the model.
The output is an nx1 float array.
\end{fulllineitems}
\index{Pot() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.Pot}\pysiglinewithargsret{\bfcode{Pot}}{\emph{x}, \emph{eps}}{}
Return the potential at a given position, using the softening lenght eps.
x : position (array vector)
eps : softening
\end{fulllineitems}
\index{R() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.R}\pysiglinewithargsret{\bfcode{R}}{}{}
Return a 1xn float array that corresponds to
the projected distance from the center of each particle.
\end{fulllineitems}
\index{Rho() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.Rho}\pysiglinewithargsret{\bfcode{Rho}}{}{}
Return the gas density of the model.
The output is an nx1 float array.
\end{fulllineitems}
\index{S() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.S}\pysiglinewithargsret{\bfcode{S}}{}{}
Return the \emph{entropy} of the model, defined as
S = T * Ne\textasciicircum{}(1-gamma)
The output is an nx1 float array.
\end{fulllineitems}
\index{SendAllToAll() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.SendAllToAll}\pysiglinewithargsret{\bfcode{SendAllToAll}}{}{}
Send all particles to all nodes
at the end of the day, all nodes have the same nbody object
\end{fulllineitems}
\index{SphEvaluate() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.SphEvaluate}\pysiglinewithargsret{\bfcode{SphEvaluate}}{\emph{val}, \emph{pos=None}, \emph{vel=None}, \emph{hsml=None}, \emph{DesNumNgb=None}, \emph{MaxNumNgbDeviation=None}, \emph{Tree=None}}{}
Return an sph evaluation of the variable var
\end{fulllineitems}
\index{T() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.T}\pysiglinewithargsret{\bfcode{T}}{}{}
Return the gas temperature of the model.
The output is an nx1 float array.
\end{fulllineitems}
\index{Tcool() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.Tcool}\pysiglinewithargsret{\bfcode{Tcool}}{\emph{coolingfile=None}}{}
Return the cooling time of the model.
The output is an nx1 float array.
\end{fulllineitems}
\index{Tmu() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.Tmu}\pysiglinewithargsret{\bfcode{Tmu}}{}{}
Return the gas temperature of the model.
The output is an nx1 float array.
\end{fulllineitems}
\index{TreeAccel() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.TreeAccel}\pysiglinewithargsret{\bfcode{TreeAccel}}{\emph{pos}, \emph{eps}, \emph{Tree=None}}{}
Return the acceleration at a given position, using the softening lenght eps
and using a tree.
pos : position (array vector)
eps : softening
Tree: gravitational tree if already computed
WARNING : this function do not work in parallel
\end{fulllineitems}
\index{TreePot() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.TreePot}\pysiglinewithargsret{\bfcode{TreePot}}{\emph{pos}, \emph{eps}, \emph{Tree=None}}{}
Return the potential at a given position, using the softening lenght eps
and using a tree.
pos : position (array vector)
eps : softening
Tree: gravitational tree if already computed
WARNING : this function do not work in parallel
\end{fulllineitems}
\index{U() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.U}\pysiglinewithargsret{\bfcode{U}}{}{}
Return the gas specific energy of the model.
The output is an nx1 float array.
\end{fulllineitems}
\index{Vr() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.Vr}\pysiglinewithargsret{\bfcode{Vr}}{}{}
Return the radial velocies of particles
The output is an 3xn float array.
\end{fulllineitems}
\index{Vt() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.Vt}\pysiglinewithargsret{\bfcode{Vt}}{}{}
Return the tangential velocies of particles
The output is an 3xn float array.
\end{fulllineitems}
\index{Vz() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.Vz}\pysiglinewithargsret{\bfcode{Vz}}{}{}
Return a 1xn float array containing z velocity
\end{fulllineitems}
\index{align() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.align}\pysiglinewithargsret{\bfcode{align}}{\emph{axis}, \emph{mode='a'}, \emph{sgn='+'}, \emph{fact=None}}{}
Rotate the object in order to align the axis `axis' with the z axis.
axis : {[}x,y,z{]}
mode : `p' : only position
\begin{quote}
`v' : only velocities
`a' : both (default)
\end{quote}
\begin{description}
\item[{sgn}] \leavevmode{[}`+'{]}{[}normal rotation{]}
`-` : reverse sense of rotation
\end{description}
fact : int : factor to increase the angle
\end{fulllineitems}
\index{align2() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.align2}\pysiglinewithargsret{\bfcode{align2}}{\emph{axis1={[}1, 0, 0{]}, axis2={[}0, 0, 1{]}, point={[}0, 0, 0{]}}}{}
Rotate the object in order to align the axis `axis' with the z axis.
axis1 : {[}x,y,z{]}
axis2 : {[}x,y,z{]}
point : {[}x,y,z{]}
\end{fulllineitems}
\index{align\_with\_main\_axis() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.align_with_main_axis}\pysiglinewithargsret{\bfcode{align\_with\_main\_axis}}{\emph{mode='a'}}{}
Rotate the object in order to align it's major axis with
the axis of its inertial tensor.
\begin{description}
\item[{mode}] \leavevmode{[}`p'{]}{[}only position {]}
`v' : only velocities
`a' : both (default)
\end{description}
\end{fulllineitems}
\index{append() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.append}\pysiglinewithargsret{\bfcode{append}}{\emph{solf}, \emph{do\_not\_sort=False}}{}
Add to the current N-body object, particles form the
N-body object ``new''.
solf : Nbody object
\end{fulllineitems}
\index{cart2sph() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.cart2sph}\pysiglinewithargsret{\bfcode{cart2sph}}{\emph{pos=None}}{}
Transform carthesian coodinates x,y,z into spherical
coordinates r,p,t
Return a 3xn float array.
\end{fulllineitems}
\index{check\_arrays() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.check_arrays}\pysiglinewithargsret{\bfcode{check\_arrays}}{}{}
check if the array contains special values like NaN or Inf
\end{fulllineitems}
\index{cm() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.cm}\pysiglinewithargsret{\bfcode{cm}}{}{}
Return the mass center of the model.
The output is an 3x1 float array.
\end{fulllineitems}
\index{cmcenter() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.cmcenter}\pysiglinewithargsret{\bfcode{cmcenter}}{}{}
Move the N-body object in order
to center the mass center at the origin.
\end{fulllineitems}
\index{cv() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.cv}\pysiglinewithargsret{\bfcode{cv}}{}{}
Return the center of the velocities of the model.
The output is an 3x1 float array.
\end{fulllineitems}
\index{cvcenter() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.cvcenter}\pysiglinewithargsret{\bfcode{cvcenter}}{}{}
Center the center of velocities at the origin.
\end{fulllineitems}
\index{dens() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.dens}\pysiglinewithargsret{\bfcode{dens}}{\emph{r=None}, \emph{nb=25}, \emph{rm=50}}{}
Return the number density at radius r (supposing a spherical density distribution).
If r is not specified, it is computed with nb and rm.
The output is an n x 1 float array.
!!! This routine do not use masses !!!
r : radius
nb : number of bins (size of the output)
rm : maximal radius
\end{fulllineitems}
\index{display() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.display}\pysiglinewithargsret{\bfcode{display}}{\emph{*arg}, \emph{**kw}}{}
Display the model
\end{fulllineitems}
\index{dmodes() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.dmodes}\pysiglinewithargsret{\bfcode{dmodes}}{\emph{nr=32}, \emph{nm=16}, \emph{rm=32}}{}
Compute the density modes of a model
nm = 16 : number of modes
nr = 32 : number of radius
rm = 50 : max radius
return
r : the radius used
m : the modes computed
m1 : the matrix of the amplitude
m2 : the matrix of the phases
\end{fulllineitems}
\index{dv\_mean() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.dv_mean}\pysiglinewithargsret{\bfcode{dv\_mean}}{}{}
Return the average relative speed between particles.
\end{fulllineitems}
\index{dx\_mean() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.dx_mean}\pysiglinewithargsret{\bfcode{dx\_mean}}{}{}
Return the average distance between particles.
\end{fulllineitems}
\index{ekin() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.ekin}\pysiglinewithargsret{\bfcode{ekin}}{}{}
Return the total specific kinetic energy
\end{fulllineitems}
\index{epot() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.epot}\pysiglinewithargsret{\bfcode{epot}}{\emph{eps}}{}
Return the total specific potential energy using the softening lenght eps.
eps : softening
WARNING : THIS FUNCTION DO NOT WORK IN MPI MODE
\end{fulllineitems}
\index{expose() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.expose}\pysiglinewithargsret{\bfcode{expose}}{\emph{obs}, \emph{eye=None}, \emph{dist\_eye=None}, \emph{foc=None}, \emph{space='pos'}, \emph{pos=None}, \emph{vel=None}}{}
Rotate and translate the object in order to be seen as if the
observer was in x0, looking at a point in xp.
obs : observer matrix
eye : `right' or `left'
dist\_eye : distance between eyes (separation = angle)
space : pos or vel
foc : focal
\end{fulllineitems}
\index{find\_vars() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.find_vars}\pysiglinewithargsret{\bfcode{find\_vars}}{}{}
This function return a list of variables defined in the current object
\end{fulllineitems}
\index{gather\_mass() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.gather_mass}\pysiglinewithargsret{\bfcode{gather\_mass}}{}{}
Gather in a unique array all mass of all nodes.
\end{fulllineitems}
\index{gather\_num() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.gather_num}\pysiglinewithargsret{\bfcode{gather\_num}}{}{}
Gather in a unique array all num of all nodes.
\end{fulllineitems}
\index{gather\_pos() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.gather_pos}\pysiglinewithargsret{\bfcode{gather\_pos}}{}{}
Gather in a unique array all positions of all nodes.
\end{fulllineitems}
\index{gather\_vec() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.gather_vec}\pysiglinewithargsret{\bfcode{gather\_vec}}{\emph{vec}}{}
Gather in a unique array all vectors vec of all nodes.
\end{fulllineitems}
\index{gather\_vel() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.gather_vel}\pysiglinewithargsret{\bfcode{gather\_vel}}{}{}
Gather in a unique array all velocites of all nodes.
\end{fulllineitems}
\index{getAccelerationInCylindricalGrid() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.getAccelerationInCylindricalGrid}\pysiglinewithargsret{\bfcode{getAccelerationInCylindricalGrid}}{\emph{eps}, \emph{z}, \emph{Rmax}, \emph{nr=32}, \emph{nt=32}, \emph{UseTree=False}}{}
Compute the Acceleration in cells of a cylindrical grid
\end{fulllineitems}
\index{getNumberParticlesInCylindricalGrid() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.getNumberParticlesInCylindricalGrid}\pysiglinewithargsret{\bfcode{getNumberParticlesInCylindricalGrid}}{\emph{Rmax}, \emph{nr=32}, \emph{nt=32}}{}
Compute the number of particles in cells of a cylindrical grid
\end{fulllineitems}
\index{getPotentialInCylindricalGrid() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.getPotentialInCylindricalGrid}\pysiglinewithargsret{\bfcode{getPotentialInCylindricalGrid}}{\emph{eps}, \emph{z}, \emph{Rmax}, \emph{nr=32}, \emph{nt=32}, \emph{UseTree=False}}{}
Compute the potential in cells of a cylindrical grid
\end{fulllineitems}
\index{getRadialVelocityDispersionInCylindricalGrid() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.getRadialVelocityDispersionInCylindricalGrid}\pysiglinewithargsret{\bfcode{getRadialVelocityDispersionInCylindricalGrid}}{\emph{Rmax}, \emph{nr=32}, \emph{nt=32}}{}
Compute the radial velocity dispersion in cells of a cylindrical grid
\end{fulllineitems}
\index{getRadiusInCylindricalGrid() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.getRadiusInCylindricalGrid}\pysiglinewithargsret{\bfcode{getRadiusInCylindricalGrid}}{\emph{z}, \emph{Rmax}, \emph{nr=32}, \emph{nt=32}}{}
Compute the radius in cells of a cylindrical grid
\end{fulllineitems}
\index{getSurfaceDensityInCylindricalGrid() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.getSurfaceDensityInCylindricalGrid}\pysiglinewithargsret{\bfcode{getSurfaceDensityInCylindricalGrid}}{\emph{Rmax}, \emph{nr=32}, \emph{nt=32}}{}
Compute the surface density in cells of a cylindrical grid
\end{fulllineitems}
\index{getTree() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.getTree}\pysiglinewithargsret{\bfcode{getTree}}{\emph{force\_computation=False}, \emph{ErrTolTheta=0.80000000000000004}}{}
Return a Tree object
\end{fulllineitems}
\index{get\_default\_spec\_vars() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.get_default_spec_vars}\pysiglinewithargsret{\bfcode{get\_default\_spec\_vars}}{}{}
return specific variables default values for the class
\end{fulllineitems}
\index{get\_default\_spec\_vect() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.get_default_spec_vect}\pysiglinewithargsret{\bfcode{get\_default\_spec\_vect}}{}{}
return specific vector default values for the class
\end{fulllineitems}
\index{get\_histocenter() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.get_histocenter}\pysiglinewithargsret{\bfcode{get\_histocenter}}{\emph{rbox=50}, \emph{nb=500}}{}
Return the position of the higher density region
in x,y,z (not good)
found by the function ``histocenter''.
rbox : size of the box
nb : number of bins in each dimension
\end{fulllineitems}
\index{get\_histocenter2() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.get_histocenter2}\pysiglinewithargsret{\bfcode{get\_histocenter2}}{\emph{rbox=50}, \emph{nb=64}}{}
Return the position of the higher density region
in x,y,z (not good)
found by the function ``histocenter''.
rbox : size of the box
nb : number of bins in each dimension
\end{fulllineitems}
\index{get\_list\_of\_array() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.get_list_of_array}\pysiglinewithargsret{\bfcode{get\_list\_of\_array}}{}{}
Return the list of numpy vectors of size nbody.
\end{fulllineitems}
\index{get\_list\_of\_method() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.get_list_of_method}\pysiglinewithargsret{\bfcode{get\_list\_of\_method}}{}{}
Return the list of instance methods (functions).
\end{fulllineitems}
\index{get\_list\_of\_vars() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.get_list_of_vars}\pysiglinewithargsret{\bfcode{get\_list\_of\_vars}}{}{}
Get the list of vars that are linked to the model
\end{fulllineitems}
\index{get\_mass\_tot() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.get_mass_tot}\pysiglinewithargsret{\bfcode{get\_mass\_tot}}{}{}
Return the total mass of system.
\end{fulllineitems}
\index{get\_mxntpe() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.get_mxntpe}\pysiglinewithargsret{\bfcode{get\_mxntpe}}{}{}
Return the max number of type for this format
\end{fulllineitems}
\index{get\_nbody() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.get_nbody}\pysiglinewithargsret{\bfcode{get\_nbody}}{}{}
Return the local number of particles.
\end{fulllineitems}
\index{get\_nbody\_tot() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.get_nbody_tot}\pysiglinewithargsret{\bfcode{get\_nbody\_tot}}{}{}
Return the total number of particles.
\end{fulllineitems}
\index{get\_npart() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.get_npart}\pysiglinewithargsret{\bfcode{get\_npart}}{}{}
Return the local number of particles of each types,
based on the variable tpe
\end{fulllineitems}
\index{get\_npart\_all() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.get_npart_all}\pysiglinewithargsret{\bfcode{get\_npart\_all}}{\emph{npart\_tot}, \emph{NTask}}{}
From npart\_tot, the total number of particles per type,
return npart\_per\_proc, an array where each element corresponds
to the value of npart of each process.
\end{fulllineitems}
\index{get\_npart\_and\_npart\_all() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.get_npart_and_npart_all}\pysiglinewithargsret{\bfcode{get\_npart\_and\_npart\_all}}{\emph{npart}}{}
From npart (usually read for the header of a file), compute :
npart : number of particles in each type
npart\_tot : total number of particles in each type
npart\_all : npart for each process.
\end{fulllineitems}
\index{get\_npart\_tot() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.get_npart_tot}\pysiglinewithargsret{\bfcode{get\_npart\_tot}}{}{}
Return the total number of particles of each types.
\end{fulllineitems}
\index{get\_ns() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.get_ns}\pysiglinewithargsret{\bfcode{get\_ns}}{}{}
Return in an array the number of particles of each node.
\end{fulllineitems}
\index{get\_ntype() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.get_ntype}\pysiglinewithargsret{\bfcode{get\_ntype}}{}{}
return the number of paticles types
\end{fulllineitems}
\index{get\_num() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.get_num}\pysiglinewithargsret{\bfcode{get\_num}}{}{}
Compute the num variable in order to be consistent with particles types
\end{fulllineitems}
\index{get\_rotation\_matrix\_to\_align\_with\_main\_axis() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.get_rotation_matrix_to_align_with_main_axis}\pysiglinewithargsret{\bfcode{get\_rotation\_matrix\_to\_align\_with\_main\_axis}}{}{}
Get the rotation matrix used to rotate the object in order to align
it's main axis with the axis of its inertial tensor.
\end{fulllineitems}
\index{get\_rsp\_approximation() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.get_rsp_approximation}\pysiglinewithargsret{\bfcode{get\_rsp\_approximation}}{\emph{DesNumNgb=None}, \emph{MaxNumNgbDeviation=None}, \emph{Tree=None}}{}
Return an aproximation of rsp, based on the tree.
\end{fulllineitems}
\index{getindex() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.getindex}\pysiglinewithargsret{\bfcode{getindex}}{\emph{num}}{}
Return an array of index of a particle from its specific number id.
The array is empty if no particle corresponds to the specific number id.
num : Id of the particle
\end{fulllineitems}
\index{has\_array() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.has_array}\pysiglinewithargsret{\bfcode{has\_array}}{\emph{name}}{}
Return true if the object pNbody has
an array called self.name
\end{fulllineitems}
\index{has\_var() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.has_var}\pysiglinewithargsret{\bfcode{has\_var}}{\emph{name}}{}
Return true if the object pNbody has
a variable called self.name
\end{fulllineitems}
\index{hdcenter() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.hdcenter}\pysiglinewithargsret{\bfcode{hdcenter}}{}{}
Move the N-body object in order to center the higher
density region found.
\end{fulllineitems}
\index{histocenter() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.histocenter}\pysiglinewithargsret{\bfcode{histocenter}}{\emph{rbox=50}, \emph{nb=500}}{}
Move the N-body object in order to center the higher
density region found near the mass center.
The higher density region is determined whith density histograms.
rbox : box dimension, where to compute the histograms
nb : number of bins for the histograms
\end{fulllineitems}
\index{histocenter2() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.histocenter2}\pysiglinewithargsret{\bfcode{histocenter2}}{\emph{rbox=50}, \emph{nb=64}}{}
Move the N-body object in order to center the higher
density region found near the mass center.
The higher density region is determined whith density histograms.
rbox : box dimension, where to compute the histograms
nb : number of bins for the histograms
\end{fulllineitems}
\index{histovel() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.histovel}\pysiglinewithargsret{\bfcode{histovel}}{\emph{nb=100}, \emph{vmin=None}, \emph{vmax=None}, \emph{mode='n'}}{}
Return or plot the histrogram of the norm of velocities or of the radial velocities.
The output is a list (r,h) of 2 nx1 float arrays,
where r is the radius and h the values of the histogram.
nb : number of bins (size of the output)
vmax : maximum velocity
vmin : minimum velocity
mode : `n' (norme of the velocities)
\begin{quote}
`r' (radial velocities)
\end{quote}
\end{fulllineitems}
\index{inertial\_tensor() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.inertial_tensor}\pysiglinewithargsret{\bfcode{inertial\_tensor}}{}{}
Return the inertial tensor.
\end{fulllineitems}
\index{info() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.info}\pysiglinewithargsret{\bfcode{info}}{}{}
Write info
\end{fulllineitems}
\index{init() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.init}\pysiglinewithargsret{\bfcode{init}}{}{}
Initialize normal and specific class variables
\end{fulllineitems}
\index{init\_units() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.init_units}\pysiglinewithargsret{\bfcode{init\_units}}{}{}
This function is responsible for the units initialization.
It will create :
\begin{quote}
self.unitsparameters
\begin{quote}
\begin{description}
\item[{that contains parameters like }] \leavevmode\begin{itemize}
\item {}
the hydrogen mass fraction,
\item {}
the metalicity ionisation flag
\item {}
the adiabatic index
\item {}
...
\end{itemize}
\end{description}
\end{quote}
\end{quote}
and
\begin{quote}
self.localsystem\_of\_units
\begin{quote}
a UnitSystem object that really defines the system of units
in the Nbody object. It uses the values :
\begin{quote}
UnitLength\_in\_cm
UnitMass\_in\_g
UnitVelocity\_in\_cm\_per\_s
\end{quote}
\end{quote}
\end{quote}
All physical values computed in pNbody should use self.localsystem\_of\_units to
be converted in other units.
self.unitsparameters is usefull if other parameters needs to be known, like
the adiabatic index, etc.
\end{fulllineitems}
\index{l() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.l}\pysiglinewithargsret{\bfcode{l}}{}{}
Return the specific angular momentum in x,y,z of all particles.
The output is an 3xn float array.
\end{fulllineitems}
\index{ltot() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.ltot}\pysiglinewithargsret{\bfcode{ltot}}{}{}
Return the specific total angular momentum.
The output is an 3x1 float array.
\end{fulllineitems}
\index{make\_default\_vars\_global() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.make_default_vars_global}\pysiglinewithargsret{\bfcode{make\_default\_vars\_global}}{}{}
Make specific variables global
\end{fulllineitems}
\index{mdens() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.mdens}\pysiglinewithargsret{\bfcode{mdens}}{\emph{r=None}, \emph{nb=25}, \emph{rm=50}}{}
Return the density at radius r (supposing a spherical density distribution).
If r is not specified, it is computed with nb and rm.
The output is an n x 1 float array.
r : radius
nb : number of bins (size of the output)
rm : maximal radius
\end{fulllineitems}
\index{memory\_info() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.memory_info}\pysiglinewithargsret{\bfcode{memory\_info}}{}{}
Write info on memory size of the current object (only counting arrays size)
\end{fulllineitems}
\index{minert() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.minert}\pysiglinewithargsret{\bfcode{minert}}{}{}
Return the diagonal of the intertial momentum.
\end{fulllineitems}
\index{mr() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.mr}\pysiglinewithargsret{\bfcode{mr}}{\emph{r=None}, \emph{nb=25}, \emph{rm=50}}{}
Return the mass inside radius r (supposing a spherical density distribution).
If r is not specified, it is computed with nb and rm.
The output is an n x 1 float array.
r : radius
nb : number of bins (size of the output)
rm : maximal radius
\end{fulllineitems}
\index{msdens() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.msdens}\pysiglinewithargsret{\bfcode{msdens}}{\emph{r=None}, \emph{nb=25}, \emph{rm=50}}{}
Return the mass surface density at radius r.
If r is not specified, it is computed with nb and rm.
The output is an nx1 float array.
r : radius
nb : number of bins (size of the output)
rm : maximal radius
\end{fulllineitems}
\index{nodes\_info() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.nodes_info}\pysiglinewithargsret{\bfcode{nodes\_info}}{}{}
Write info on nodes
\end{fulllineitems}
\index{object\_info() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.object_info}\pysiglinewithargsret{\bfcode{object\_info}}{}{}
Write class(object) info
\end{fulllineitems}
\index{open\_and\_read() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.open_and_read}\pysiglinewithargsret{\bfcode{open\_and\_read}}{\emph{name}, \emph{readfct}}{}
open and read file name
name : name of the input
readfct : function used to read the file
\end{fulllineitems}
\index{open\_and\_write() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.open_and_write}\pysiglinewithargsret{\bfcode{open\_and\_write}}{\emph{name}, \emph{writefct}}{}
Open and write file
name : name of the output
writefct : function used to write the file
\end{fulllineitems}
\index{phi\_xy() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.phi_xy}\pysiglinewithargsret{\bfcode{phi\_xy}}{}{}
Return a 1xn float array that corresponds to
the azimuth in cylindrical coordinate of each particle.
\end{fulllineitems}
\index{phi\_xyz() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.phi_xyz}\pysiglinewithargsret{\bfcode{phi\_xyz}}{}{}
Return a 1xn float array that corresponds to
the azimuth in spherical coordinate of each particle.
\end{fulllineitems}
\index{print\_filenames() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.print_filenames}\pysiglinewithargsret{\bfcode{print\_filenames}}{}{}
Print files names
\end{fulllineitems}
\index{r() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.r}\pysiglinewithargsret{\bfcode{r}}{\emph{center=None}}{}
Return a 1xn float array that corresponds to
the distance from the center of each particle.
\end{fulllineitems}
\index{read() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.read}\pysiglinewithargsret{\bfcode{read}}{}{}
Read the particle file(s)
\end{fulllineitems}
\index{read\_num() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.read_num}\pysiglinewithargsret{\bfcode{read\_num}}{\emph{name}}{}
Read a num file
name : name of the input
\end{fulllineitems}
\index{real\_numngb() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.real_numngb}\pysiglinewithargsret{\bfcode{real\_numngb}}{\emph{num}}{}
number of particles wor wich r\textless{}h
\end{fulllineitems}
\index{rebox() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.rebox}\pysiglinewithargsret{\bfcode{rebox}}{\emph{boxsize=None}, \emph{mode=None}}{}
Translate the positions of the object in order that all particles
being contained in a box of size boxsize.
\begin{description}
\item[{boxsize}] \leavevmode{[}size of the box{]}
if boxsize is not defined, we try first to see if self.boxsize
is defined.
\item[{mode}] \leavevmode{[}type of reboxing{]}
None : -\textgreater{} {[}0,boxsize{]}
centred : -\textgreater{} {[}-boxsize/2,boxsize/2{]}
{[}x,y,z{]} :
\end{description}
\end{fulllineitems}
\index{redistribute() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.redistribute}\pysiglinewithargsret{\bfcode{redistribute}}{}{}
This function redistribute particles amoung all nodes in order to
have a similar number of particles per nodes
\end{fulllineitems}
\index{reduc() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.reduc}\pysiglinewithargsret{\bfcode{reduc}}{\emph{n}, \emph{mass=False}}{}
Return an N-body object that contain a fraction 1/n of particles.
n : inverse of the fraction of particule to be returned
\end{fulllineitems}
\index{rename() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.rename}\pysiglinewithargsret{\bfcode{rename}}{\emph{p\_name=None}}{}
Rename the files
p\_name : new name(s)
\end{fulllineitems}
\index{rotate() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.rotate}\pysiglinewithargsret{\bfcode{rotate}}{\emph{angle=0, axis={[}1, 0, 0{]}, point={[}0, 0, 0{]}, mode='a'}}{}
Rotate the positions and/or the velocities of the object around a specific axis
defined by a vector and an point.
angle : rotation angle in radian
axis : direction of the axis
point : center of the rotation
\begin{description}
\item[{mode}] \leavevmode{[}`p'{]}{[}rotate only position{]}
`v' : rotate only velocities
`a' : rotate both (default)
\end{description}
\end{fulllineitems}
\index{rotateR() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.rotateR}\pysiglinewithargsret{\bfcode{rotateR}}{\emph{R}, \emph{mode='a'}}{}
Rotate the model using the matrix R
\begin{description}
\item[{mode}] \leavevmode{[}`p'{]}{[}only position {]}
`v' : only velocities
`a' : both (default)
\end{description}
\end{fulllineitems}
\index{rotate\_old() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.rotate_old}\pysiglinewithargsret{\bfcode{rotate\_old}}{\emph{angle=0}, \emph{mode='a'}, \emph{axis='x'}}{}
Rotate the positions and/or the velocities of the object around a specific axis.
angle : rotation angle in radian
axis : `x' : around x
\begin{quote}
\begin{quote}
`y' : around y
`z' : around z
\end{quote}
: {[}x,y,z{]} : around this axis
\end{quote}
\begin{description}
\item[{mode}] \leavevmode{[}`p'{]}{[}rotate only position{]}
`v' : rotate only velocities
`a' : rotate both (default)
\end{description}
\end{fulllineitems}
\index{rxy() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.rxy}\pysiglinewithargsret{\bfcode{rxy}}{}{}
Return a 1xn float array that corresponds to
the projected distance from the center of each particle.
\end{fulllineitems}
\index{rxyz() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.rxyz}\pysiglinewithargsret{\bfcode{rxyz}}{\emph{center=None}}{}
Return a 1xn float array that corresponds to
the distance from the center of each particle.
\end{fulllineitems}
\index{sdens() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.sdens}\pysiglinewithargsret{\bfcode{sdens}}{\emph{r=None}, \emph{nb=25}, \emph{rm=50}}{}
Return the surface density at radius r.
If r is not specified, it is computed with nb and rm.
The output is an nx1 float array.
!!! This routine do not uses masses !!!
r : radius
nb : number of bins (size of the output)
rm : maximal radius
\end{fulllineitems}
\index{select() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.select}\pysiglinewithargsret{\bfcode{select}}{\emph{i=0}}{}
Return an N-body object that contain only particles of type i
\end{fulllineitems}
\index{selectc() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.selectc}\pysiglinewithargsret{\bfcode{selectc}}{\emph{c}, \emph{local=False}}{}
Return an N-body object that contain only particles where the
corresponding value in c is not zero.
c is a nx1 Nbody array.
c : the condition vector
local : local selection (True) or global selection (False)
\end{fulllineitems}
\index{selecti() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.selecti}\pysiglinewithargsret{\bfcode{selecti}}{\emph{i}, \emph{local=False}}{}
Return an N-body object that contain only particles having
their index (not id) in i.
i : vector containing indexes
local : local selection (True) or global selection (False)
\end{fulllineitems}
\index{selectp() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.selectp}\pysiglinewithargsret{\bfcode{selectp}}{\emph{lst=None}, \emph{file=None}, \emph{reject=False}, \emph{local=False}, \emph{from\_num=True}}{}
Return an N-body object that contain only particles with specific number id.
The list of id's is given either by lst (nx1 int array) or
by the name (``file'') of a file containing the list of id's.
lst : vector list (integer)
reject : True/False : if True, reject particles in lst (default = False)
local : local selection (True) or global selection (False)
\begin{description}
\item[{frum\_num}] \leavevmode{[}if True, use self.num to select particules{]}
if False, use arange(self.nbody)
\end{description}
\end{fulllineitems}
\index{set\_filenames() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.set_filenames}\pysiglinewithargsret{\bfcode{set\_filenames}}{\emph{p\_name}, \emph{pio=None}}{}
Set the local and global names
p\_name : new name(s)
pio : `yes' or `no'
\end{fulllineitems}
\index{set\_ftype() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.set_ftype}\pysiglinewithargsret{\bfcode{set\_ftype}}{\emph{ftype='binary'}}{}
Change the type of the file
ftype : type of the file
\end{fulllineitems}
\index{set\_local\_system\_of\_units() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.set_local_system_of_units}\pysiglinewithargsret{\bfcode{set\_local\_system\_of\_units}}{\emph{params=None}, \emph{UnitLength\_in\_cm=None}, \emph{UnitVelocity\_in\_cm\_per\_s=None}, \emph{UnitMass\_in\_g=None}, \emph{unitparameterfile=None}, \emph{gadgetparameterfile=None}}{}
Set local system of units using UnitLength\_in\_cm,UnitVelocity\_in\_cm\_per\_s,UnitMass\_in\_g
\begin{enumerate}
\item {}
if nothing is given, we use self.unitsparameters to obtain these values
\item {} \begin{description}
\item[{if UnitLength\_in\_cm}] \leavevmode
UnitVelocity\_in\_cm\_per\_s
UnitMass\_in\_g
\end{description}
are given, we use them
\end{enumerate}
\begin{description}
\item[{2b) if UnitLength\_in\_cm,UnitVelocity\_in\_cm\_per\_s,UnitMass\_in\_g}] \leavevmode
are given in a dictionary
\end{description}
\begin{enumerate}
\setcounter{enumi}{2}
\item {}
if unitparameterfile is given we read the parameters from the file (units parameter format)
\item {}
if gadgetparameterfile is given we read the parameters from the file (gadget param format)
\end{enumerate}
\end{fulllineitems}
\index{set\_npart() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.set_npart}\pysiglinewithargsret{\bfcode{set\_npart}}{\emph{npart}}{}
Set the local number of particles of each types.
This function modifies the variable self.tpe
\end{fulllineitems}
\index{set\_parameters() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.set_parameters}\pysiglinewithargsret{\bfcode{set\_parameters}}{\emph{params}}{}
Set parameters for the class
\end{fulllineitems}
\index{set\_pio() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.set_pio}\pysiglinewithargsret{\bfcode{set\_pio}}{\emph{pio}}{}
Set parallel input/output or not io
pio : `yes' or `no'
\end{fulllineitems}
\index{set\_tpe() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.set_tpe}\pysiglinewithargsret{\bfcode{set\_tpe}}{\emph{tpe}}{}
Set all particles to the type tpe
\end{fulllineitems}
\index{set\_unitsparameters() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.set_unitsparameters}\pysiglinewithargsret{\bfcode{set\_unitsparameters}}{\emph{unitsparams}}{}
Set units parameters for the class.
\end{fulllineitems}
\index{show() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.show}\pysiglinewithargsret{\bfcode{show}}{\emph{*arg}, \emph{**kw}}{}
Display the model
this is an alias to display
\end{fulllineitems}
\index{sigma() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.sigma}\pysiglinewithargsret{\bfcode{sigma}}{\emph{r=None}, \emph{nb=25.0}, \emph{rm=50.0}}{}
Return the 3 velocity dispersion (in cylindrical coordinates) and the mean azimuthal velocity curve.
If r is not specified, it is computed with nb and rm.
The output is a list (r,sr,st,sz,mt) of 5 \$n imes 1\$ float arrays,
where r is the radius, sr the radial velocity dispersion, st, the azimuthal velocity dispersion,
sz, the vertical velocity dispersion and mt, the mean azimuthal velocity curve.
!!! This routine works only if particles have equal masses !!!
r : radius where to compute the values
nb : number of bins (size of the output)
rm : maximal radius
return : r,sr,st,sz,mt
\end{fulllineitems}
\index{sigma\_vz() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.sigma_vz}\pysiglinewithargsret{\bfcode{sigma\_vz}}{\emph{r=None}, \emph{nb=25}, \emph{rm=50}}{}
Return the vertical dispertion in z at radius r.
If r is not specified, it is computed with nb and rm.
The output is an nx1 float array.
r : radius
nb : number of bins (size of the output)
rm : maximal radius
\end{fulllineitems}
\index{sigma\_z() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.sigma_z}\pysiglinewithargsret{\bfcode{sigma\_z}}{\emph{r=None}, \emph{nb=25}, \emph{rm=50}}{}
Return the vertical dispertion in z at radius r.
If r is not specified, it is computed with nb and rm.
The output is an nx1 float array.
r : radius
nb : number of bins (size of the output)
rm : maximal radius
\end{fulllineitems}
\index{size() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.size}\pysiglinewithargsret{\bfcode{size}}{}{}
Estimate the model size, using the inertial momentum
\end{fulllineitems}
\index{sort() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.sort}\pysiglinewithargsret{\bfcode{sort}}{}{}
sort particles according to their num variable
\end{fulllineitems}
\index{sort\_type() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.sort_type}\pysiglinewithargsret{\bfcode{sort\_type}}{}{}
Contrary to sort, this fonction sort particles
respecting their type.
\end{fulllineitems}
\index{spec\_info() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.spec_info}\pysiglinewithargsret{\bfcode{spec\_info}}{}{}
Write specific info
\end{fulllineitems}
\index{sph2cart() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.sph2cart}\pysiglinewithargsret{\bfcode{sph2cart}}{\emph{pos=None}}{}
Transform spherical coordinates r,p,t into carthesian
coodinates x,y,z
Return a 3xn float array.
\end{fulllineitems}
\index{spin() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.spin}\pysiglinewithargsret{\bfcode{spin}}{\emph{omega=None}, \emph{L=None}, \emph{j=None}, \emph{E=None}}{}
Spin the object with angular velocity ``omega'' (rigid rotation).
Omega is a 1 x 3 array object
If L (total angular momentum) is explicitely given, compute Omega from L (1 x 3 array object).
omega : angular speed (array vector)
L : desired angular momentum
j : desired energy fraction in rotation
E : Total energy (without rotation)
\end{fulllineitems}
\index{sub() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.sub}\pysiglinewithargsret{\bfcode{sub}}{\emph{n1=0}, \emph{n2=None}}{}
Return an N-body object that have particles whith indicies in the range {[}n1:n2{]}.
n1 : number of the first particule
n2 : number of the last particule
Note : the first particle is 0
\end{fulllineitems}
\index{theta\_xyz() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.theta_xyz}\pysiglinewithargsret{\bfcode{theta\_xyz}}{}{}
Return a 1xn float array that corresponds to
the elevation angle in spherical coordinate of each particle.
\end{fulllineitems}
\index{tork() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.tork}\pysiglinewithargsret{\bfcode{tork}}{\emph{acc}}{}
Return the total tork on the system due to the force
acting on each particle (acc).
The output is an 3xn float array.
acc : 3xn float array
\end{fulllineitems}
\index{translate() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.translate}\pysiglinewithargsret{\bfcode{translate}}{\emph{dx}, \emph{mode='p'}}{}
Translate the positions or the velocities of the object.
dx : shift (array vector)
mode : `p' : translate positions
\begin{quote}
`v' : translate velocities
\end{quote}
\end{fulllineitems}
\index{usual\_numngb() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.usual_numngb}\pysiglinewithargsret{\bfcode{usual\_numngb}}{\emph{num}}{}
usual way to compute the number of neighbors
\end{fulllineitems}
\index{v\_sigma() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.v_sigma}\pysiglinewithargsret{\bfcode{v\_sigma}}{}{}
Return the norm of the velocity dispersions.
\end{fulllineitems}
\index{vel\_cart2cyl() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.vel_cart2cyl}\pysiglinewithargsret{\bfcode{vel\_cart2cyl}}{}{}
Transform velocities in carthesian coordinates vx,vy,vz into cylindrical
coodinates vr,vz,vz.
Pos is the position of particles in cart. coord.
Vel is the velocity in cart. coord.
Return a 3xn float array.
\end{fulllineitems}
\index{vel\_cyl2cart() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.vel_cyl2cart}\pysiglinewithargsret{\bfcode{vel\_cyl2cart}}{\emph{pos=None}, \emph{vel=None}}{}
Transform velocities in cylindrical coordinates vr,vt,vz into carthesian
coodinates vx,vy,vz.
Pos is the position of particles in cart. coord.
Vel is the velocity in cylindrical coord.
Return a 3xn float array.
\end{fulllineitems}
\index{vn() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.vn}\pysiglinewithargsret{\bfcode{vn}}{}{}
Return a 1xn float array that corresponds to
the norm of velocities
\end{fulllineitems}
\index{vrxyz() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.vrxyz}\pysiglinewithargsret{\bfcode{vrxyz}}{}{}
Return a 1xn float array that corresponds to
the radial velocity in spherical system
\end{fulllineitems}
\index{vx() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.vx}\pysiglinewithargsret{\bfcode{vx}}{}{}
Return a 1xn float array containing x velocity
\end{fulllineitems}
\index{vy() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.vy}\pysiglinewithargsret{\bfcode{vy}}{}{}
Return a 1xn float array containing y velocity
\end{fulllineitems}
\index{vz() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.vz}\pysiglinewithargsret{\bfcode{vz}}{}{}
Return a 1xn float array containing z velocity
\end{fulllineitems}
\index{weighted\_numngb() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.weighted_numngb}\pysiglinewithargsret{\bfcode{weighted\_numngb}}{\emph{num}}{}
num = particle where to compute weighted\_numngb
see Springel 05
\end{fulllineitems}
\index{write() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.write}\pysiglinewithargsret{\bfcode{write}}{}{}
Write the particle file(s)
\end{fulllineitems}
\index{write\_num() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.write_num}\pysiglinewithargsret{\bfcode{write\_num}}{\emph{name}}{}
Write a num file
name : name of the output
\end{fulllineitems}
\index{x() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.x}\pysiglinewithargsret{\bfcode{x}}{}{}
Return a 1xn float array containing x coordinate
\end{fulllineitems}
\index{x\_sigma() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.x_sigma}\pysiglinewithargsret{\bfcode{x\_sigma}}{}{}
Return the norm of the position dispersions.
\end{fulllineitems}
\index{y() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.y}\pysiglinewithargsret{\bfcode{y}}{}{}
Return a 1xn float array containing y coordinate
\end{fulllineitems}
\index{z() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.z}\pysiglinewithargsret{\bfcode{z}}{}{}
Return a 1xn float array containing z coordinate
\end{fulllineitems}
\index{zmodes() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.zmodes}\pysiglinewithargsret{\bfcode{zmodes}}{\emph{nr=32}, \emph{nm=16}, \emph{rm=32}}{}
Compute the vertical modes of a model
nm = 16 : number of modes
nr = 32 : number of radius
rm = 50 : max radius
return
r : the radius used
m : the modes computed
m1 : the matrix of the amplitude
m2 : the matrix of the phases
\end{fulllineitems}
\index{zprof() (pNbody.main.NbodyDefault method)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.NbodyDefault.zprof}\pysiglinewithargsret{\bfcode{zprof}}{\emph{z=None}, \emph{r=2.5}, \emph{dr=0.5}, \emph{nb=25}, \emph{zm=5.0}}{}
Return the z-profile in a vector for a given radius
!!! This routine works only if particles have equal masses !!!
z : bins in z (optional)
r : radius of the cut
dr : width in r of the cut
nb : number of bins (size of the output)
zm : maximal height
\end{fulllineitems}
\end{fulllineitems}
\index{Nbody\_default (class in pNbody.main)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.Nbody_default}\pysiglinewithargsret{\strong{class }\code{pNbody.main.}\bfcode{Nbody\_default}}{\emph{p\_name=None}, \emph{pos=None}, \emph{vel=None}, \emph{mass=None}, \emph{num=None}, \emph{tpe=None}, \emph{ftype=None}, \emph{status='old'}, \emph{byteorder='little'}, \emph{pio='no'}, \emph{local=False}, \emph{log=None}, \emph{unitsfile=None}}{}
This class is usefull to create an empty Nbody object
\paragraph{Methods}
\end{fulllineitems}
\index{get\_known\_formats() (in module pNbody.main)}
\begin{fulllineitems}
\phantomsection\label{rst/MainModule:pNbody.main.get_known_formats}\pysiglinewithargsret{\code{pNbody.main.}\bfcode{get\_known\_formats}}{}{}
return the name of known Nbody formats
\end{fulllineitems}
\section{the ic module}
\label{rst/IcModule::doc}\label{rst/IcModule:the-ic-module}\label{rst/IcModule:module-pNbody.ic}\index{pNbody.ic (module)}\index{ComputeGridParameters() (in module pNbody.ic)}
\begin{fulllineitems}
\phantomsection\label{rst/IcModule:pNbody.ic.ComputeGridParameters}\pysiglinewithargsret{\code{pNbody.ic.}\bfcode{ComputeGridParameters}}{\emph{n}, \emph{args}, \emph{rmax}, \emph{M}, \emph{pr\_fct}, \emph{mr\_fct}, \emph{Neps\_des}, \emph{rc}, \emph{ng}}{}
This function computes dR, the appropriate grid used to approximate Mr.
The grid is set in order to have ``Neps\_des'' particles
in the first division of the grid. Then, the radius of the grid
follows an exponnential distribution up to rmax.
\begin{enumerate}
\item {}
from the density distribution, the total mass and the number of particles,
using a newton algorithm, it computes eps, the radius that will contains ``Neps\_des'' particles
\item {}
once eps is set, we determine rc (the grid scale length) from eps and ng, in order to
have a grid with the a first cell equal to eps.
if the computation of rc fails, we use the default value of rc
\end{enumerate}
The function takes the following arguments
n : number of particles
M : total mass
rmax : max radius
args : list of args for the profile
pr\_fct : profile function
mr\_fct : mass-radius function
Neps\_des : desired number of point in the first beam
rc : default size of the first beam
ng : number of grid divisions
it returns :
Rs : grid points
eps : radius containing about Neps\_des particles
Neps : number of particles in eps
\end{fulllineitems}
\index{ComputeGridParameters2() (in module pNbody.ic)}
\begin{fulllineitems}
\phantomsection\label{rst/IcModule:pNbody.ic.ComputeGridParameters2}\pysiglinewithargsret{\code{pNbody.ic.}\bfcode{ComputeGridParameters2}}{\emph{eps}, \emph{nmax}, \emph{args}, \emph{rmax}, \emph{M}, \emph{pr\_fct}, \emph{mr\_fct}, \emph{Neps\_des}, \emph{rc}, \emph{ng}}{}
This function computes dR, the appropriate grid used to approximate Mr.
The number of particle of the model is set in order to have ``Neps\_des'' particles
in the first division of the grid. Then, the radius of the grid
follows an exponnential distribution up to rmax.
\begin{enumerate}
\item {}
n is set from the total mass and Neps\_des
\item {}
once n is set, we determine rc (the grid scale length) from eps and ng, in order to
have a grid with the a first cell equal to eps.
if the computation of rc fails, we use the default value of rc
\end{enumerate}
The function takes the following arguments
eps : the desired grid resolution
nmax : max number of particles
M : total mass
rmax : max radius
args : list of args for the profile
pr\_fct : profile function
mr\_fct : mass-radius function
Neps\_des : desired number of point in the first beam
rc : default size of the first beam
ng : number of grid divisions
it returns :
n : number of particles
Rs : grid points
rc : parameter of the scaling fct
g : scaling fct
gm : inverse of scaling fct
\end{fulllineitems}
\index{box() (in module pNbody.ic)}
\begin{fulllineitems}
\phantomsection\label{rst/IcModule:pNbody.ic.box}\pysiglinewithargsret{\code{pNbody.ic.}\bfcode{box}}{\emph{n}, \emph{a}, \emph{b}, \emph{c}, \emph{name='box.dat'}, \emph{ftype='binary'}, \emph{verbose=False}}{}
Return an Nbody object that contains n particules distributed
in an homogeneous box of dimension a,b,c, centred at the origin
radius rmax.
\end{fulllineitems}
\index{burkert() (in module pNbody.ic)}
\begin{fulllineitems}
\phantomsection\label{rst/IcModule:pNbody.ic.burkert}\pysiglinewithargsret{\code{pNbody.ic.}\bfcode{burkert}}{\emph{n}, \emph{rs}, \emph{Rmax}, \emph{dR}, \emph{Rs=None}, \emph{name='burkert.dat'}, \emph{ftype='binary'}, \emph{verbose=False}}{}
Return an Nbody object that contains n particules following
a burkert profile.
rhob = 1 / ( ( 1 + r/rs ) * ( 1 + (r/rs)**2 ) )
\end{fulllineitems}
\index{dl2() (in module pNbody.ic)}
\begin{fulllineitems}
\phantomsection\label{rst/IcModule:pNbody.ic.dl2}\pysiglinewithargsret{\code{pNbody.ic.}\bfcode{dl2}}{\emph{n}, \emph{a}, \emph{b}, \emph{c}, \emph{eps}, \emph{rmax}, \emph{name='dl2.dat'}, \emph{ftype='binary'}, \emph{verbose=False}}{}
Return an Nbody object that contains n particules distributed as
rho = (1.-eps*(r/rmax)**2)
\end{fulllineitems}
\index{dl2\_mr() (in module pNbody.ic)}
\begin{fulllineitems}
\phantomsection\label{rst/IcModule:pNbody.ic.dl2_mr}\pysiglinewithargsret{\code{pNbody.ic.}\bfcode{dl2\_mr}}{\emph{r}, \emph{args}}{}
Mass in the radius r for the distribution
rho = (1.-eps*(r/rmax)**2)
\end{fulllineitems}
\index{expd() (in module pNbody.ic)}
\begin{fulllineitems}
\phantomsection\label{rst/IcModule:pNbody.ic.expd}\pysiglinewithargsret{\code{pNbody.ic.}\bfcode{expd}}{\emph{n}, \emph{Hr}, \emph{Hz}, \emph{Rmax}, \emph{Zmax}, \emph{irand=1}, \emph{name='expd.dat'}, \emph{ftype='binary'}, \emph{verbose=False}}{}
Exonential disk
rho = 1/(1+(r/rc)**2)
\end{fulllineitems}
\index{expd\_mr() (in module pNbody.ic)}
\begin{fulllineitems}
\phantomsection\label{rst/IcModule:pNbody.ic.expd_mr}\pysiglinewithargsret{\code{pNbody.ic.}\bfcode{expd\_mr}}{\emph{r}, \emph{args}}{}
Mass in the radius r for the distribution
Sigma = epx(-r)
\end{fulllineitems}
\index{generic2c() (in module pNbody.ic)}
\begin{fulllineitems}
\phantomsection\label{rst/IcModule:pNbody.ic.generic2c}\pysiglinewithargsret{\code{pNbody.ic.}\bfcode{generic2c}}{\emph{n}, \emph{rs}, \emph{a}, \emph{b}, \emph{Rmax}, \emph{dR}, \emph{Rs=None}, \emph{name='nfwg.dat'}, \emph{ftype='binary'}, \emph{verbose=False}}{}
Return an Nbody object that contains n particules following
an nfw modifed profile.
rho = 1/( (r/rs)**a * (1+r/rs)**(b-a) )
\end{fulllineitems}
\index{generic\_Mr() (in module pNbody.ic)}
\begin{fulllineitems}
\phantomsection\label{rst/IcModule:pNbody.ic.generic_Mr}\pysiglinewithargsret{\code{pNbody.ic.}\bfcode{generic\_Mr}}{\emph{n}, \emph{rmax}, \emph{R=None}, \emph{Mr=None}, \emph{name='sphere\_Mr.dat'}, \emph{ftype='binary'}, \emph{verbose=False}}{}
Distribute particles in order to reproduce M(R) given by Mr
\end{fulllineitems}
\index{generic\_Mx() (in module pNbody.ic)}
\begin{fulllineitems}
\phantomsection\label{rst/IcModule:pNbody.ic.generic_Mx}\pysiglinewithargsret{\code{pNbody.ic.}\bfcode{generic\_Mx}}{\emph{n}, \emph{xmax}, \emph{x=None}, \emph{Mx=None}, \emph{name='box\_Mx.dat'}, \emph{ftype='binary'}, \emph{verbose=False}}{}
Distribute particles in a box. The density in x is defined in order to reproduce M(x) given by Mx
\end{fulllineitems}
\index{generic\_alpha() (in module pNbody.ic)}
\begin{fulllineitems}
\phantomsection\label{rst/IcModule:pNbody.ic.generic_alpha}\pysiglinewithargsret{\code{pNbody.ic.}\bfcode{generic\_alpha}}{\emph{n}, \emph{a}, \emph{e}, \emph{rmax}, \emph{irand=1}, \emph{fct=None}, \emph{name='generic\_alpha.dat'}, \emph{ftype='binary'}, \emph{verbose=False}}{}
Generic alpha distribution : rho \textasciitilde{} (r+e)\textasciicircum{}a
\end{fulllineitems}
\index{hernquist() (in module pNbody.ic)}
\begin{fulllineitems}
\phantomsection\label{rst/IcModule:pNbody.ic.hernquist}\pysiglinewithargsret{\code{pNbody.ic.}\bfcode{hernquist}}{\emph{n}, \emph{rs}, \emph{Rmax}, \emph{dR}, \emph{Rs=None}, \emph{name='hernquist.dat'}, \emph{ftype='binary'}, \emph{verbose=False}}{}
Return an Nbody object that contains n particules following
a hernquist modifed profile.
rho = 1/( (r/rs) * (1+r/rs)**3 )
\end{fulllineitems}
\index{homodisk() (in module pNbody.ic)}
\begin{fulllineitems}
\phantomsection\label{rst/IcModule:pNbody.ic.homodisk}\pysiglinewithargsret{\code{pNbody.ic.}\bfcode{homodisk}}{\emph{n}, \emph{a}, \emph{b}, \emph{dz}, \emph{name='homodisk.dat'}, \emph{ftype='binary'}, \emph{verbose=False}}{}
Return an Nbody object that contains n particules distributed
in an homogeneous oval of radius a and b, and of thickness dz.
\end{fulllineitems}
\index{homosphere() (in module pNbody.ic)}
\begin{fulllineitems}
\phantomsection\label{rst/IcModule:pNbody.ic.homosphere}\pysiglinewithargsret{\code{pNbody.ic.}\bfcode{homosphere}}{\emph{n}, \emph{a}, \emph{b}, \emph{c}, \emph{name='homosphere.dat'}, \emph{ftype='binary'}, \emph{verbose=False}}{}
Return an Nbody object that contains n particules distributed
in an homogeneous triaxial sphere of axis a,b,c.
\end{fulllineitems}
\index{invert() (in module pNbody.ic)}
\begin{fulllineitems}
\phantomsection\label{rst/IcModule:pNbody.ic.invert}\pysiglinewithargsret{\code{pNbody.ic.}\bfcode{invert}}{\emph{x}, \emph{rmin}, \emph{rmax}, \emph{fct}, \emph{args}, \emph{eps=1e-10}}{}
return vector r that corresponds to
fct(r,args)=x
This routine uses a simple bissector algorithm
\end{fulllineitems}
\index{isothm() (in module pNbody.ic)}
\begin{fulllineitems}
\phantomsection\label{rst/IcModule:pNbody.ic.isothm}\pysiglinewithargsret{\code{pNbody.ic.}\bfcode{isothm}}{\emph{n}, \emph{rc}, \emph{rmax}, \emph{name='isothm.dat'}, \emph{ftype='binary'}, \emph{verbose=False}}{}
Return an Nbody object that contains n particules distributed as
rho = 1/(1+r/rc)**2
\end{fulllineitems}
\index{isothm\_mr() (in module pNbody.ic)}
\begin{fulllineitems}
\phantomsection\label{rst/IcModule:pNbody.ic.isothm_mr}\pysiglinewithargsret{\code{pNbody.ic.}\bfcode{isothm\_mr}}{\emph{r}, \emph{args}}{}
Mass in the radius r for the distribution
rho = 1/(1+r/rc)**2
\end{fulllineitems}
\index{kuzmin() (in module pNbody.ic)}
\begin{fulllineitems}
\phantomsection\label{rst/IcModule:pNbody.ic.kuzmin}\pysiglinewithargsret{\code{pNbody.ic.}\bfcode{kuzmin}}{\emph{n}, \emph{eps}, \emph{dz}, \emph{name='kuzmin.dat'}, \emph{ftype='binary'}, \emph{verbose=False}}{}
Return an Nbody object that contains n particules distributed
in a kuzmin (infinitely thin) disk
rho = eps*M/(2*pi*(R**2+eps**2)**(3/2))
\end{fulllineitems}
\index{miyamoto\_nagai() (in module pNbody.ic)}
\begin{fulllineitems}
\phantomsection\label{rst/IcModule:pNbody.ic.miyamoto_nagai}\pysiglinewithargsret{\code{pNbody.ic.}\bfcode{miyamoto\_nagai}}{\emph{n}, \emph{a}, \emph{b}, \emph{Rmax}, \emph{Zmax}, \emph{irand=1}, \emph{fct=None}, \emph{fRmax=0}, \emph{name='miyamoto.dat'}, \emph{ftype='binary'}, \emph{verbose=False}}{}
Miyamoto Nagai distribution
\end{fulllineitems}
\index{nfw() (in module pNbody.ic)}
\begin{fulllineitems}
\phantomsection\label{rst/IcModule:pNbody.ic.nfw}\pysiglinewithargsret{\code{pNbody.ic.}\bfcode{nfw}}{\emph{n}, \emph{rs}, \emph{Rmax}, \emph{dR}, \emph{Rs=None}, \emph{name='nfw.dat'}, \emph{ftype='binary'}, \emph{verbose=False}}{}
Return an Nbody object that contains n particules following
an nfw profile.
rho = 1/{[} (r/rs)(1+r/rs)\textasciicircum{}2 {]}
\end{fulllineitems}
\index{nfw\_mr() (in module pNbody.ic)}
\begin{fulllineitems}
\phantomsection\label{rst/IcModule:pNbody.ic.nfw_mr}\pysiglinewithargsret{\code{pNbody.ic.}\bfcode{nfw\_mr}}{\emph{r}, \emph{args}}{}
Mass in the radius r for the nfw distribution
rho = rhos/{[} (r/rs)(1+r/rs)\textasciicircum{}2 {]}
mr = 4*pi*rhos*rs**3 {\color{red}\bfseries{}*}(log(1+r/rs)-r/(rs+r))
\end{fulllineitems}
\index{nfwg() (in module pNbody.ic)}
\begin{fulllineitems}
\phantomsection\label{rst/IcModule:pNbody.ic.nfwg}\pysiglinewithargsret{\code{pNbody.ic.}\bfcode{nfwg}}{\emph{n}, \emph{rs}, \emph{gamma}, \emph{Rmax}, \emph{dR}, \emph{Rs=None}, \emph{name='nfwg.dat'}, \emph{ftype='binary'}, \emph{verbose=False}}{}
Return an Nbody object that contains n particules following
an nfw modifed profile.
rho = 1/{[} ((r/rs))**(gamma)(1+r/rs)\textasciicircum{}2 {]}**(0.5*(3-gamma))
\end{fulllineitems}
\index{pisothm() (in module pNbody.ic)}
\begin{fulllineitems}
\phantomsection\label{rst/IcModule:pNbody.ic.pisothm}\pysiglinewithargsret{\code{pNbody.ic.}\bfcode{pisothm}}{\emph{n}, \emph{rc}, \emph{rmax}, \emph{rmin=0}, \emph{name='pisothm.dat'}, \emph{ftype='binary'}, \emph{verbose=False}}{}
Pseudo-isothermal sphere
Mass in the radius r for the distribution
rho = 1/(1+(r/rc)**2)
\end{fulllineitems}
\index{pisothm\_mr() (in module pNbody.ic)}
\begin{fulllineitems}
\phantomsection\label{rst/IcModule:pNbody.ic.pisothm_mr}\pysiglinewithargsret{\code{pNbody.ic.}\bfcode{pisothm\_mr}}{\emph{r}, \emph{args}}{}
Mass in the radius r for the distribution
rho = 1/(1+(r/rc)**2)
\end{fulllineitems}
\index{plummer() (in module pNbody.ic)}
\begin{fulllineitems}
\phantomsection\label{rst/IcModule:pNbody.ic.plummer}\pysiglinewithargsret{\code{pNbody.ic.}\bfcode{plummer}}{\emph{n}, \emph{a}, \emph{b}, \emph{c}, \emph{eps}, \emph{rmax}, \emph{M=1.0}, \emph{vel='no'}, \emph{name='plummer.dat'}, \emph{ftype='binary'}, \emph{verbose=False}}{}
Return an Nbody object that contains n particules distributed
in a triaxial plummer model of axis a,b,c and core radius eps
and max radius of rmax.
rho = (1.+(r/eps)**2)**(-5/2)
\end{fulllineitems}
\index{shell() (in module pNbody.ic)}
\begin{fulllineitems}
\phantomsection\label{rst/IcModule:pNbody.ic.shell}\pysiglinewithargsret{\code{pNbody.ic.}\bfcode{shell}}{\emph{n}, \emph{r}, \emph{name='cell.dat'}, \emph{ftype='binary'}, \emph{verbose=False}}{}
Shell of radius r
\end{fulllineitems}
\section{the io module}
\label{rst/IoModule:the-io-module}\label{rst/IoModule::doc}\index{checkfile() (in module pNbody.io)}
\begin{fulllineitems}
\phantomsection\label{rst/IoModule:pNbody.io.checkfile}\pysiglinewithargsret{\code{pNbody.io.}\bfcode{checkfile}}{\emph{name}}{}
Check if a file exists. An error is generated if the file
does not exists.
\begin{quote}\begin{description}
\item[{Parameters }] \leavevmode
\textbf{name} : the path to a filename
\end{description}\end{quote}
\paragraph{Examples}
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{io}\PYG{o}{.}\PYG{n}{checkfile}\PYG{p}{(}\PYG{l+s}{'}\PYG{l+s}{an\PYGZus{}existing\PYGZus{}file}\PYG{l+s}{'}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }
\end{Verbatim}
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{io}\PYG{o}{.}\PYG{n}{checkfile}\PYG{p}{(}\PYG{l+s}{'}\PYG{l+s}{a\PYGZus{}non\PYGZus{}existing\PYGZus{}file}\PYG{l+s}{'}\PYG{p}{)}
\PYG{g+gt}{Traceback (most recent call last):}
File \PYG{n+nb}{"\textless{}stdin\textgreater{}"}, line \PYG{l+m}{1}, in \PYG{n+nIdentifier}{\textless{}module\textgreater{}}
File \PYG{n+nb}{"/home/epfl/revaz/local/lib64/python2.6/site-packages/pNbody/io.py"}, line \PYG{l+m}{33}, in \PYG{n+nIdentifier}{checkfile}
\PYG{k}{raise} \PYG{n+ne}{IOError}\PYG{p}{(}\PYG{l+m+mi}{915}\PYG{p}{,}\PYG{l+s}{'}\PYG{l+s}{file }\PYG{l+s+si}{\%s}\PYG{l+s}{ not found ! Pease check the file name.}\PYG{l+s}{'}\PYG{o}{\%}\PYG{p}{(}\PYG{n}{name}\PYG{p}{)}\PYG{p}{)}
\PYG{n+nc}{IOError}: \PYG{n+nIdentifier}{[Errno 915] file nofile not found ! Pease check the file name. }
\end{Verbatim}
\end{fulllineitems}
\index{end\_of\_file() (in module pNbody.io)}
\begin{fulllineitems}
\phantomsection\label{rst/IoModule:pNbody.io.end_of_file}\pysiglinewithargsret{\code{pNbody.io.}\bfcode{end\_of\_file}}{\emph{f}, \emph{pio='no'}, \emph{MPI=None}}{}
Return True if we have reached the end of the file f, False instead
\begin{quote}\begin{description}
\item[{Parameters }] \leavevmode
\textbf{f} : ndarray or matrix object
\begin{quote}
an open file
\end{quote}
\textbf{pio} : `yes' or `no'
\begin{quote}
if the file is read in parallel or not
\end{quote}
\textbf{MPI} : MPI communicator
\item[{Returns }] \leavevmode
\textbf{status} : Bool
\begin{quote}
True if the we reached the end of the file
False if not
\end{quote}
\end{description}\end{quote}
\end{fulllineitems}
\index{write\_array() (in module pNbody.io)}
\begin{fulllineitems}
\phantomsection\label{rst/IoModule:pNbody.io.write_array}\pysiglinewithargsret{\code{pNbody.io.}\bfcode{write\_array}}{\emph{file}, \emph{vec}}{}
Write an array to a file, in a very simple ascii format.
\begin{quote}\begin{description}
\item[{Parameters }] \leavevmode
\textbf{file} : the path to a file
\textbf{vec} : an ndarray object
\end{description}\end{quote}
\paragraph{Examples}
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{k+kn}{from} \PYG{n+nn}{numpy} \PYG{k+kn}{import} \PYG{o}{*}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{x} \PYG{o}{=} \PYG{n}{array}\PYG{p}{(}\PYG{p}{[}\PYG{l+m+mi}{1}\PYG{p}{,}\PYG{l+m+mi}{2}\PYG{p}{,}\PYG{l+m+mi}{3}\PYG{p}{]}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{io}\PYG{o}{.}\PYG{n}{write\PYGZus{}array}\PYG{p}{(}\PYG{l+s}{'}\PYG{l+s}{/tmp/array.dat}\PYG{l+s}{'}\PYG{p}{,}\PYG{n}{x}\PYG{p}{)}
\end{Verbatim}
\end{fulllineitems}
\index{read\_ascii() (in module pNbody.io)}
\begin{fulllineitems}
\phantomsection\label{rst/IoModule:pNbody.io.read_ascii}\pysiglinewithargsret{\code{pNbody.io.}\bfcode{read\_ascii}}{\emph{file}, \emph{columns=None}, \emph{lines=None}, \emph{dtype=\textless{}type `float'\textgreater{}}, \emph{skipheader=False}, \emph{cchar='\#'}}{}
Read an ascii file.
The function allows to set the number of columns or line to read.
If it contains a header, the header is used to label all column. In
this case, a dictionary is returned.
\begin{quote}\begin{description}
\item[{Parameters }] \leavevmode
\textbf{file} : the path to a file or an open file
\textbf{columns} : list
\begin{quote}
the list of the columns to read
if none, all columns are read
\end{quote}
\textbf{lines} : list
\begin{quote}
the list of the lines to read
if none, all lines are read
\end{quote}
\textbf{dtype} : dtype
\begin{quote}
the ndtype of the objects to read
\end{quote}
\textbf{skipheader} : bool
\begin{quote}
if true, do not read the header
if there is one
\end{quote}
\textbf{cchar} : char
\begin{quote}
lines begining with cchar are skiped
the first line is considered as the header
\end{quote}
\item[{Returns }] \leavevmode
\textbf{data} : Dict or ndarray
\begin{quote}
A python dictionary or an ndarray object
\end{quote}
\end{description}\end{quote}
\paragraph{Examples}
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{k+kn}{from} \PYG{n+nn}{numpy} \PYG{k+kn}{import} \PYG{o}{*}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{x} \PYG{o}{=} \PYG{n}{arange}\PYG{p}{(}\PYG{l+m+mi}{10}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{y} \PYG{o}{=} \PYG{n}{x}\PYG{o}{*}\PYG{n}{x}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{f} \PYG{o}{=} \PYG{n+nb}{open}\PYG{p}{(}\PYG{l+s}{'}\PYG{l+s}{afile.txt}\PYG{l+s}{'}\PYG{p}{,}\PYG{l+s}{'}\PYG{l+s}{w}\PYG{l+s}{'}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{f}\PYG{o}{.}\PYG{n}{write}\PYG{p}{(}\PYG{l+s}{"}\PYG{l+s}{\# x y}\PYG{l+s}{"}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{k}{for} \PYG{n}{i} \PYG{o+ow}{in} \PYG{n+nb}{xrange}\PYG{p}{(}\PYG{n+nb}{len}\PYG{p}{(}\PYG{n}{x}\PYG{p}{)}\PYG{p}{)}\PYG{p}{:}
\PYG{g+gp}{... } \PYG{n}{f}\PYG{o}{.}\PYG{n}{write}\PYG{p}{(}\PYG{l+s}{'}\PYG{l+s+si}{\%g}\PYG{l+s}{ }\PYG{l+s+si}{\%g}\PYG{l+s}{'}\PYG{o}{\%}\PYG{p}{(}\PYG{n}{x}\PYG{p}{[}\PYG{n}{i}\PYG{p}{]}\PYG{p}{,}\PYG{n}{y}\PYG{p}{[}\PYG{n}{i}\PYG{p}{]}\PYG{p}{)}\PYG{p}{)}
\PYG{g+gp}{... }
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{f}\PYG{o}{.}\PYG{n}{close}\PYG{p}{(}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{k+kn}{from} \PYG{n+nn}{pNbody} \PYG{k+kn}{import} \PYG{n}{io}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{data} \PYG{o}{=} \PYG{n}{io}\PYG{o}{.}\PYG{n}{read\PYGZus{}ascii}\PYG{p}{(}\PYG{l+s}{"}\PYG{l+s}{afile.txt}\PYG{l+s}{"}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{data}\PYG{p}{[}\PYG{l+s}{'}\PYG{l+s}{x}\PYG{l+s}{'}\PYG{p}{]}
\PYG{g+go}{array([ 0., 1., 2., 3., 4., 5., 6., 7., 8., 9.])}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{data}\PYG{p}{[}\PYG{l+s}{'}\PYG{l+s}{y}\PYG{l+s}{'}\PYG{p}{]}
\PYG{g+go}{array([ 0., 1., 4., 9., 16., 25., 36., 49., 64., 81.]) }
\end{Verbatim}
\end{fulllineitems}
\index{write\_dmp() (in module pNbody.io)}
\begin{fulllineitems}
\phantomsection\label{rst/IoModule:pNbody.io.write_dmp}\pysiglinewithargsret{\code{pNbody.io.}\bfcode{write\_dmp}}{\emph{file}, \emph{data}}{}
Write a dmp (pickle) file. In other word,
dump the data object.
\begin{quote}\begin{description}
\item[{Parameters }] \leavevmode
\textbf{file} : the path to a file
\textbf{data} : a pickable python object
\end{description}\end{quote}
\paragraph{Examples}
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{x} \PYG{o}{=} \PYG{p}{\PYGZob{}}\PYG{l+s}{'}\PYG{l+s}{a}\PYG{l+s}{'}\PYG{p}{:}\PYG{l+m+mi}{1}\PYG{p}{,}\PYG{l+s}{'}\PYG{l+s}{b}\PYG{l+s}{'}\PYG{p}{:}\PYG{l+m+mi}{2}\PYG{p}{\PYGZcb{}}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{io}\PYG{o}{.}\PYG{n}{write\PYGZus{}dmp}\PYG{p}{(}\PYG{l+s}{'}\PYG{l+s}{/tmp/afile.dmp}\PYG{l+s}{'}\PYG{p}{,}\PYG{n}{x}\PYG{p}{)}
\end{Verbatim}
\end{fulllineitems}
\index{read\_dmp() (in module pNbody.io)}
\begin{fulllineitems}
\phantomsection\label{rst/IoModule:pNbody.io.read_dmp}\pysiglinewithargsret{\code{pNbody.io.}\bfcode{read\_dmp}}{\emph{file}}{}
Read a dmp (pickle) file.
\begin{quote}\begin{description}
\item[{Parameters }] \leavevmode
\textbf{file} : the path to a file
\item[{Returns }] \leavevmode
\textbf{data} : a python object
\end{description}\end{quote}
\paragraph{Examples}
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{x} \PYG{o}{=} \PYG{p}{\PYGZob{}}\PYG{l+s}{'}\PYG{l+s}{a}\PYG{l+s}{'}\PYG{p}{:}\PYG{l+m+mi}{1}\PYG{p}{,}\PYG{l+s}{'}\PYG{l+s}{b}\PYG{l+s}{'}\PYG{p}{:}\PYG{l+m+mi}{2}\PYG{p}{\PYGZcb{}}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{io}\PYG{o}{.}\PYG{n}{write\PYGZus{}dmp}\PYG{p}{(}\PYG{l+s}{'}\PYG{l+s}{/tmp/afile.dmp}\PYG{l+s}{'}\PYG{p}{,}\PYG{n}{x}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{y} \PYG{o}{=} \PYG{n}{io}\PYG{o}{.}\PYG{n}{read\PYGZus{}dmp}\PYG{p}{(}\PYG{l+s}{'}\PYG{l+s}{/tmp/afile.dmp}\PYG{l+s}{'}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{y}
\PYG{g+go}{\PYGZob{}'a': 1, 'b': 2\PYGZcb{} }
\end{Verbatim}
\end{fulllineitems}
\section{the units module}
\label{rst/UnitsModule:the-units-module}\label{rst/UnitsModule::doc}\label{rst/UnitsModule:module-pNbody.units}\index{pNbody.units (module)}\index{PhysCte (class in pNbody.units)}
\begin{fulllineitems}
\phantomsection\label{rst/UnitsModule:pNbody.units.PhysCte}\pysiglinewithargsret{\strong{class }\code{pNbody.units.}\bfcode{PhysCte}}{\emph{value}, \emph{Unit}}{}
Physical constant
\paragraph{Methods}
\end{fulllineitems}
\index{Set\_SystemUnits\_From\_Params() (in module pNbody.units)}
\begin{fulllineitems}
\phantomsection\label{rst/UnitsModule:pNbody.units.Set_SystemUnits_From_Params}\pysiglinewithargsret{\code{pNbody.units.}\bfcode{Set\_SystemUnits\_From\_Params}}{\emph{params}}{}
return a system of units from given parameters
params is a dictionary that must constains at least
params{[}'UnitVelocity\_in\_cm\_per\_s'{]}
params{[}'UnitMass\_in\_g'{]}
params{[}'UnitLength\_in\_cm'{]}
\end{fulllineitems}
\index{UnitSystem (class in pNbody.units)}
\begin{fulllineitems}
\phantomsection\label{rst/UnitsModule:pNbody.units.UnitSystem}\pysiglinewithargsret{\strong{class }\code{pNbody.units.}\bfcode{UnitSystem}}{\emph{UnitSysName}, \emph{UnitLst}}{}
Units system
\paragraph{Methods}
\index{convertionFactorTo() (pNbody.units.UnitSystem method)}
\begin{fulllineitems}
\phantomsection\label{rst/UnitsModule:pNbody.units.UnitSystem.convertionFactorTo}\pysiglinewithargsret{\bfcode{convertionFactorTo}}{\emph{newUnits}}{}
return the conversion factor to obtain the new units
\end{fulllineitems}
\index{info() (pNbody.units.UnitSystem method)}
\begin{fulllineitems}
\phantomsection\label{rst/UnitsModule:pNbody.units.UnitSystem.info}\pysiglinewithargsret{\bfcode{info}}{}{}
print some info
\end{fulllineitems}
\index{into() (pNbody.units.UnitSystem method)}
\begin{fulllineitems}
\phantomsection\label{rst/UnitsModule:pNbody.units.UnitSystem.into}\pysiglinewithargsret{\bfcode{into}}{\emph{newUnits}}{}
return into the new units
\end{fulllineitems}
\end{fulllineitems}
\index{Units (class in pNbody.units)}
\begin{fulllineitems}
\phantomsection\label{rst/UnitsModule:pNbody.units.Units}\pysiglinewithargsret{\strong{class }\code{pNbody.units.}\bfcode{Units}}{\emph{symbol}, \emph{factor=1.0}, \emph{power=1}, \emph{ulist=}\optional{}}{}
Units
\paragraph{Methods}
\index{GatherBaseUnits() (pNbody.units.Units method)}
\begin{fulllineitems}
\phantomsection\label{rst/UnitsModule:pNbody.units.Units.GatherBaseUnits}\pysiglinewithargsret{\bfcode{GatherBaseUnits}}{}{}
create the self.bases list (recursively)
\end{fulllineitems}
\end{fulllineitems}
\index{gal (in module pNbody.units)}
\begin{fulllineitems}
\phantomsection\label{rst/UnitsModule:pNbody.units.gal}\pysigline{\code{pNbody.units.}\bfcode{gal}}{}
constantes are now defined in ctes.py
slight = PhysCte(2.99792458e8,Unit\_m/Unit\_s)
G = PhysCte(6.6732e-11,Unit\_G)
q\_electron = PhysCte(1.6022e-19,Unit\_C)
planck = PhysCte(6.6262e-34,Unit\_J*Unit\_s)
boltzmann = PhysCte(1.3807e-23,Unit\_J/Unit\_K)
m\_electron = PhysCte(9.1095e-31,Unit\_kg)
m\_proton = PhysCte(1.6726e-27,Unit\_kg)
m\_neutron = PhysCte(1.6750e-27,Unit\_kg)
Na = PhysCte(6.0220e+23,Unit\_mol)
R = PhysCte(8.3144e+00,Unit\_J/Unit\_mol)
Av = PhysCte(6.828e-50 ,Unit\_Pa*Unit\_m**6)
Bv = PhysCte(4.419e-29,Unit\_m**3)
\end{fulllineitems}
\section{the ctes module}
\label{rst/CtesModule:module-pNbody.ctes}\label{rst/CtesModule:the-ctes-module}\label{rst/CtesModule::doc}\index{pNbody.ctes (module)}\index{convert\_ctes() (in module pNbody.ctes)}
\begin{fulllineitems}
\phantomsection\label{rst/CtesModule:pNbody.ctes.convert_ctes}\pysiglinewithargsret{\code{pNbody.ctes.}\bfcode{convert\_ctes}}{\emph{units}}{}
convert a constante into a given unit system.
\end{fulllineitems}
\section{the mpi module}
\label{rst/MpiModule:module-pNbody.mpi}\label{rst/MpiModule:the-mpi-module}\label{rst/MpiModule::doc}\index{pNbody.mpi (module)}\index{mpi\_AllgatherAndConcatArray() (in module pNbody.mpi)}
\begin{fulllineitems}
\phantomsection\label{rst/MpiModule:pNbody.mpi.mpi_AllgatherAndConcatArray}\pysiglinewithargsret{\code{pNbody.mpi.}\bfcode{mpi\_AllgatherAndConcatArray}}{\emph{vec}}{}
AllGather array vec and concatenate it in a unique array
(concatenation order is reversed).
\end{fulllineitems}
\index{mpi\_ExchangeFromTable() (in module pNbody.mpi)}
\begin{fulllineitems}
\phantomsection\label{rst/MpiModule:pNbody.mpi.mpi_ExchangeFromTable}\pysiglinewithargsret{\code{pNbody.mpi.}\bfcode{mpi\_ExchangeFromTable}}{\emph{T}, \emph{procs}, \emph{ids}, \emph{vec}, \emph{num}}{}
Exchange an array according to a transfer array T
T : exchange table
procs : list of processor (from Tree.GetExchanges())
ids : list of id (from Tree.GetExchanges())
vec : vector to exchange
num : id correspondings to particles
\end{fulllineitems}
\index{mpi\_GatherAndWriteArray() (in module pNbody.mpi)}
\begin{fulllineitems}
\phantomsection\label{rst/MpiModule:pNbody.mpi.mpi_GatherAndWriteArray}\pysiglinewithargsret{\code{pNbody.mpi.}\bfcode{mpi\_GatherAndWriteArray}}{\emph{f}, \emph{data}, \emph{byteorder='little'}, \emph{npart=None}}{}
Gather and array and write it in a binary block.
data = array
shape = tuple
\end{fulllineitems}
\index{mpi\_GetExchangeTable() (in module pNbody.mpi)}
\begin{fulllineitems}
\phantomsection\label{rst/MpiModule:pNbody.mpi.mpi_GetExchangeTable}\pysiglinewithargsret{\code{pNbody.mpi.}\bfcode{mpi\_GetExchangeTable}}{\emph{n\_i}}{}
This function returns the exchange table
\end{fulllineitems}
\index{mpi\_OldGatherAndWriteArray() (in module pNbody.mpi)}
\begin{fulllineitems}
\phantomsection\label{rst/MpiModule:pNbody.mpi.mpi_OldGatherAndWriteArray}\pysiglinewithargsret{\code{pNbody.mpi.}\bfcode{mpi\_OldGatherAndWriteArray}}{\emph{f}, \emph{data}, \emph{byteorder='little'}, \emph{nlocal=None}}{}
Gather and array and write it in a binary block.
data = array
shape = tuple
\end{fulllineitems}
\index{mpi\_OldReadAndSendArray() (in module pNbody.mpi)}
\begin{fulllineitems}
\phantomsection\label{rst/MpiModule:pNbody.mpi.mpi_OldReadAndSendArray}\pysiglinewithargsret{\code{pNbody.mpi.}\bfcode{mpi\_OldReadAndSendArray}}{\emph{f}, \emph{data\_type}, \emph{shape=None}, \emph{skip=None}, \emph{byteorder='little'}, \emph{nlocal=None}}{}
Read and Brodcast a binary block assuming it contains an array.
The array is splitted acroding to the variable nlocal.
data\_type = array type
shape = tuple
\begin{description}
\item[{nlocal}] \leavevmode{[}array NTask x Npart {]}
array NTask
\end{description}
\end{fulllineitems}
\index{mpi\_ReadAndSendArray() (in module pNbody.mpi)}
\begin{fulllineitems}
\phantomsection\label{rst/MpiModule:pNbody.mpi.mpi_ReadAndSendArray}\pysiglinewithargsret{\code{pNbody.mpi.}\bfcode{mpi\_ReadAndSendArray}}{\emph{f}, \emph{data\_type}, \emph{shape=None}, \emph{byteorder='little'}, \emph{npart=None}}{}
Read and Brodcast a binary block assuming it contains an array.
\end{fulllineitems}
\index{mpi\_ReadAndSendBlock() (in module pNbody.mpi)}
\begin{fulllineitems}
\phantomsection\label{rst/MpiModule:pNbody.mpi.mpi_ReadAndSendBlock}\pysiglinewithargsret{\code{pNbody.mpi.}\bfcode{mpi\_ReadAndSendBlock}}{\emph{f}, \emph{data\_type}, \emph{shape=None}, \emph{byteorder='little'}, \emph{split=None}}{}
Read and brodcast a binary block.
data\_type = int,float32,float
or
data\_type = array
shape = tuple
\end{fulllineitems}
\index{mpi\_allgather() (in module pNbody.mpi)}
\begin{fulllineitems}
\phantomsection\label{rst/MpiModule:pNbody.mpi.mpi_allgather}\pysiglinewithargsret{\code{pNbody.mpi.}\bfcode{mpi\_allgather}}{\emph{x}}{}
Gather x from all to all.
Returns a list.
\end{fulllineitems}
\index{mpi\_allreduce() (in module pNbody.mpi)}
\begin{fulllineitems}
\phantomsection\label{rst/MpiModule:pNbody.mpi.mpi_allreduce}\pysiglinewithargsret{\code{pNbody.mpi.}\bfcode{mpi\_allreduce}}{\emph{x}, \emph{op=\textless{}mpi4py.MPI.Op object at 0x2fd74e0\textgreater{}}}{}
Reduce x from all node for all nodes.
When there is only one is defined, the function return x.
\end{fulllineitems}
\index{mpi\_arange() (in module pNbody.mpi)}
\begin{fulllineitems}
\phantomsection\label{rst/MpiModule:pNbody.mpi.mpi_arange}\pysiglinewithargsret{\code{pNbody.mpi.}\bfcode{mpi\_arange}}{\emph{n}}{}
Create an integer array containing elements from 0 to n
spreaded over all nodes.
\end{fulllineitems}
\index{mpi\_argmax() (in module pNbody.mpi)}
\begin{fulllineitems}
\phantomsection\label{rst/MpiModule:pNbody.mpi.mpi_argmax}\pysiglinewithargsret{\code{pNbody.mpi.}\bfcode{mpi\_argmax}}{\emph{x}}{}
Find the arument of the amximum value in x.
idx = (p,i) : where i = index in proc p
\end{fulllineitems}
\index{mpi\_argmin() (in module pNbody.mpi)}
\begin{fulllineitems}
\phantomsection\label{rst/MpiModule:pNbody.mpi.mpi_argmin}\pysiglinewithargsret{\code{pNbody.mpi.}\bfcode{mpi\_argmin}}{\emph{x}}{}
Find the arument of the maximum value in x.
idx = (p,i) : where i = index in proc p
\end{fulllineitems}
\index{mpi\_bcast() (in module pNbody.mpi)}
\begin{fulllineitems}
\phantomsection\label{rst/MpiModule:pNbody.mpi.mpi_bcast}\pysiglinewithargsret{\code{pNbody.mpi.}\bfcode{mpi\_bcast}}{\emph{x}, \emph{root=0}}{}
Broadcast from node root the variable x.
When there is only one is defined, it simplay returns x.
\end{fulllineitems}
\index{mpi\_find\_a\_toTask() (in module pNbody.mpi)}
\begin{fulllineitems}
\phantomsection\label{rst/MpiModule:pNbody.mpi.mpi_find_a_toTask}\pysiglinewithargsret{\code{pNbody.mpi.}\bfcode{mpi\_find\_a\_toTask}}{\emph{begTask}, \emph{fromTask}, \emph{ex\_table}, \emph{delta\_n}}{}
This function is used to find recursively an exange table
\end{fulllineitems}
\index{mpi\_gather() (in module pNbody.mpi)}
\begin{fulllineitems}
\phantomsection\label{rst/MpiModule:pNbody.mpi.mpi_gather}\pysiglinewithargsret{\code{pNbody.mpi.}\bfcode{mpi\_gather}}{\emph{x}, \emph{root=0}}{}
Gather x from all nodes to node dest.
Returns a list.
\end{fulllineitems}
\index{mpi\_getval() (in module pNbody.mpi)}
\begin{fulllineitems}
\phantomsection\label{rst/MpiModule:pNbody.mpi.mpi_getval}\pysiglinewithargsret{\code{pNbody.mpi.}\bfcode{mpi\_getval}}{\emph{x}, \emph{idx}}{}
Return the value of array x corresponding to the index idx.
idx = (p,i) : where i = index in proc p
equivalent to x{[}i{]} from proc p
\end{fulllineitems}
\index{mpi\_histogram() (in module pNbody.mpi)}
\begin{fulllineitems}
\phantomsection\label{rst/MpiModule:pNbody.mpi.mpi_histogram}\pysiglinewithargsret{\code{pNbody.mpi.}\bfcode{mpi\_histogram}}{\emph{x}, \emph{bins}}{}
Return an histogram of vector x binned using binx.
\end{fulllineitems}
\index{mpi\_iprint() (in module pNbody.mpi)}
\begin{fulllineitems}
\phantomsection\label{rst/MpiModule:pNbody.mpi.mpi_iprint}\pysiglinewithargsret{\code{pNbody.mpi.}\bfcode{mpi\_iprint}}{\emph{msg}, \emph{mode=None}}{}
Synchronized print, including info on node.
\end{fulllineitems}
\index{mpi\_len() (in module pNbody.mpi)}
\begin{fulllineitems}
\phantomsection\label{rst/MpiModule:pNbody.mpi.mpi_len}\pysiglinewithargsret{\code{pNbody.mpi.}\bfcode{mpi\_len}}{\emph{x}}{}
Lenght of array x.
\end{fulllineitems}
\index{mpi\_max() (in module pNbody.mpi)}
\begin{fulllineitems}
\phantomsection\label{rst/MpiModule:pNbody.mpi.mpi_max}\pysiglinewithargsret{\code{pNbody.mpi.}\bfcode{mpi\_max}}{\emph{x}}{}
Maximum element of array x.
\end{fulllineitems}
\index{mpi\_mean() (in module pNbody.mpi)}
\begin{fulllineitems}
\phantomsection\label{rst/MpiModule:pNbody.mpi.mpi_mean}\pysiglinewithargsret{\code{pNbody.mpi.}\bfcode{mpi\_mean}}{\emph{x}}{}
Mean of elements of array x.
\end{fulllineitems}
\index{mpi\_min() (in module pNbody.mpi)}
\begin{fulllineitems}
\phantomsection\label{rst/MpiModule:pNbody.mpi.mpi_min}\pysiglinewithargsret{\code{pNbody.mpi.}\bfcode{mpi\_min}}{\emph{x}}{}
Minimum element of array x.
\end{fulllineitems}
\index{mpi\_pprint() (in module pNbody.mpi)}
\begin{fulllineitems}
\phantomsection\label{rst/MpiModule:pNbody.mpi.mpi_pprint}\pysiglinewithargsret{\code{pNbody.mpi.}\bfcode{mpi\_pprint}}{\emph{msg}}{}
Synchronized print.
\end{fulllineitems}
\index{mpi\_recv() (in module pNbody.mpi)}
\begin{fulllineitems}
\phantomsection\label{rst/MpiModule:pNbody.mpi.mpi_recv}\pysiglinewithargsret{\code{pNbody.mpi.}\bfcode{mpi\_recv}}{\emph{source}}{}
Return a variable sent by node ar\{source\}.
When there is only one is defined, it does nothing.
\end{fulllineitems}
\index{mpi\_reduce() (in module pNbody.mpi)}
\begin{fulllineitems}
\phantomsection\label{rst/MpiModule:pNbody.mpi.mpi_reduce}\pysiglinewithargsret{\code{pNbody.mpi.}\bfcode{mpi\_reduce}}{\emph{x}, \emph{root=0}, \emph{op=\textless{}mpi4py.MPI.Op object at 0x2fd74e0\textgreater{}}}{}
Reduce x from all node only for root.
When there is only one is defined, the function return x.
\end{fulllineitems}
\index{mpi\_rprint() (in module pNbody.mpi)}
\begin{fulllineitems}
\phantomsection\label{rst/MpiModule:pNbody.mpi.mpi_rprint}\pysiglinewithargsret{\code{pNbody.mpi.}\bfcode{mpi\_rprint}}{\emph{msg}}{}
Rooted print.
\end{fulllineitems}
\index{mpi\_sarange() (in module pNbody.mpi)}
\begin{fulllineitems}
\phantomsection\label{rst/MpiModule:pNbody.mpi.mpi_sarange}\pysiglinewithargsret{\code{pNbody.mpi.}\bfcode{mpi\_sarange}}{\emph{npart\_all}}{}
Create an integer array containing elements from 0 to n,
spreaded over all nodes. The repartition of elements and
type of elements over nodes is given by the array npart\_all
\end{fulllineitems}
\index{mpi\_send() (in module pNbody.mpi)}
\begin{fulllineitems}
\phantomsection\label{rst/MpiModule:pNbody.mpi.mpi_send}\pysiglinewithargsret{\code{pNbody.mpi.}\bfcode{mpi\_send}}{\emph{x}, \emph{dest}}{}
Send x to node dest.
When there is only one is defined, it does nothing.
\end{fulllineitems}
\index{mpi\_sendrecv() (in module pNbody.mpi)}
\begin{fulllineitems}
\phantomsection\label{rst/MpiModule:pNbody.mpi.mpi_sendrecv}\pysiglinewithargsret{\code{pNbody.mpi.}\bfcode{mpi\_sendrecv}}{\emph{x}, \emph{dest}, \emph{source}}{}
\end{fulllineitems}
\index{mpi\_sum() (in module pNbody.mpi)}
\begin{fulllineitems}
\phantomsection\label{rst/MpiModule:pNbody.mpi.mpi_sum}\pysiglinewithargsret{\code{pNbody.mpi.}\bfcode{mpi\_sum}}{\emph{x}}{}
Sum elements of array x.
\end{fulllineitems}
\section{the libutil module}
\label{rst/LibutilModule:the-libutil-module}\label{rst/LibutilModule::doc}\label{rst/LibutilModule:module-pNbody.libutil}\index{pNbody.libutil (module)}\index{Extract1dMeanFrom2dMap() (in module pNbody.libutil)}
\begin{fulllineitems}
\phantomsection\label{rst/LibutilModule:pNbody.libutil.Extract1dMeanFrom2dMap}\pysiglinewithargsret{\code{pNbody.libutil.}\bfcode{Extract1dMeanFrom2dMap}}{\emph{x}, \emph{y}, \emph{mass}, \emph{val}, \emph{kx}, \emph{ky}, \emph{nmin}, \emph{momentum=0}}{}
Extract the mean along one axis, from a 2d mean or sigma matrix
x : pos in first dim. (beetween 0 and 1)
y : pos in sec dim. (beetween 0 and 1)
mass : mass of particles
val : value to compute
kx : number of bins in x
ky : number of bins in y
nmin : min number of particles needed to compute value
momentum : 0,1,2 (-1=number)
\end{fulllineitems}
\index{GetMassMap() (in module pNbody.libutil)}
\begin{fulllineitems}
\phantomsection\label{rst/LibutilModule:pNbody.libutil.GetMassMap}\pysiglinewithargsret{\code{pNbody.libutil.}\bfcode{GetMassMap}}{\emph{pos}, \emph{mass}, \emph{shape}}{}
\end{fulllineitems}
\index{GetMeanMap() (in module pNbody.libutil)}
\begin{fulllineitems}
\phantomsection\label{rst/LibutilModule:pNbody.libutil.GetMeanMap}\pysiglinewithargsret{\code{pNbody.libutil.}\bfcode{GetMeanMap}}{\emph{m0}, \emph{m1}}{}
Return a MeanMap using the 0 and 1 momentum
m0 : zero momentum
m1 : first momentum
\end{fulllineitems}
\index{GetMeanValMap() (in module pNbody.libutil)}
\begin{fulllineitems}
\phantomsection\label{rst/LibutilModule:pNbody.libutil.GetMeanValMap}\pysiglinewithargsret{\code{pNbody.libutil.}\bfcode{GetMeanValMap}}{\emph{pos}, \emph{mass}, \emph{val}, \emph{shape}}{}
\end{fulllineitems}
\index{GetNumberMap() (in module pNbody.libutil)}
\begin{fulllineitems}
\phantomsection\label{rst/LibutilModule:pNbody.libutil.GetNumberMap}\pysiglinewithargsret{\code{pNbody.libutil.}\bfcode{GetNumberMap}}{\emph{pos}, \emph{shape}}{}
\end{fulllineitems}
\index{GetSigmaMap() (in module pNbody.libutil)}
\begin{fulllineitems}
\phantomsection\label{rst/LibutilModule:pNbody.libutil.GetSigmaMap}\pysiglinewithargsret{\code{pNbody.libutil.}\bfcode{GetSigmaMap}}{\emph{m0}, \emph{m1}, \emph{m2}}{}
Return a MeanMap using the 0 and 1 and 2 momentum
m0 : zero momentum
m1 : first momentum
m2 : second momentum
\end{fulllineitems}
\index{GetSigmaValMap() (in module pNbody.libutil)}
\begin{fulllineitems}
\phantomsection\label{rst/LibutilModule:pNbody.libutil.GetSigmaValMap}\pysiglinewithargsret{\code{pNbody.libutil.}\bfcode{GetSigmaValMap}}{\emph{pos}, \emph{mass}, \emph{val}, \emph{shape}}{}
\end{fulllineitems}
\index{RotateAround() (in module pNbody.libutil)}
\begin{fulllineitems}
\phantomsection\label{rst/LibutilModule:pNbody.libutil.RotateAround}\pysiglinewithargsret{\code{pNbody.libutil.}\bfcode{RotateAround}}{\emph{angle}, \emph{axis}, \emph{point}, \emph{ObsM}}{}
this should be C
\end{fulllineitems}
\index{add\_box() (in module pNbody.libutil)}
\begin{fulllineitems}
\phantomsection\label{rst/LibutilModule:pNbody.libutil.add_box}\pysiglinewithargsret{\code{pNbody.libutil.}\bfcode{add\_box}}{\emph{matint}, \emph{shape=(256}, \emph{256)}, \emph{size=(30.0}, \emph{30.0)}, \emph{center=None}, \emph{box\_opts=(1}, \emph{None}, \emph{None}, \emph{255)}}{}
add a box on the frame
\end{fulllineitems}
\index{apply\_filter() (in module pNbody.libutil)}
\begin{fulllineitems}
\phantomsection\label{rst/LibutilModule:pNbody.libutil.apply_filter}\pysiglinewithargsret{\code{pNbody.libutil.}\bfcode{apply\_filter}}{\emph{mat}, \emph{name=None}, \emph{opt=None}}{}
Apply a filter to an image
\end{fulllineitems}
\index{compress\_from\_lst() (in module pNbody.libutil)}
\begin{fulllineitems}
\phantomsection\label{rst/LibutilModule:pNbody.libutil.compress_from_lst}\pysiglinewithargsret{\code{pNbody.libutil.}\bfcode{compress\_from\_lst}}{\emph{x}, \emph{num}, \emph{lst}, \emph{reject=False}}{}
Return the compression of x
\end{fulllineitems}
\index{contours() (in module pNbody.libutil)}
\begin{fulllineitems}
\phantomsection\label{rst/LibutilModule:pNbody.libutil.contours}\pysiglinewithargsret{\code{pNbody.libutil.}\bfcode{contours}}{\emph{m}, \emph{matint}, \emph{nl}, \emph{mn}, \emph{mx}, \emph{kx}, \emph{ky}, \emph{color}, \emph{crush='no'}}{}
Compute iso-contours on a n x m float array.
If ``l\_min'' equal ``l\_max'', levels are automatically between the minimum and
maximum values of the matrix ``mat''.
m = matrice (real values)
matint = matrice (interger values)
kx = num of sub-boxes
ky = num of sub-boxes
nl = \# of levels
mn = min
mx = max
color = color of contours
\end{fulllineitems}
\index{drawxticks() (in module pNbody.libutil)}
\begin{fulllineitems}
\phantomsection\label{rst/LibutilModule:pNbody.libutil.drawxticks}\pysiglinewithargsret{\code{pNbody.libutil.}\bfcode{drawxticks}}{\emph{matint}, \emph{m0}, \emph{d0}, \emph{n0}, \emph{h0}, \emph{shape}, \emph{size}, \emph{center}, \emph{color}}{}
draw x ticks in a matrix
\end{fulllineitems}
\index{drawyticks() (in module pNbody.libutil)}
\begin{fulllineitems}
\phantomsection\label{rst/LibutilModule:pNbody.libutil.drawyticks}\pysiglinewithargsret{\code{pNbody.libutil.}\bfcode{drawyticks}}{\emph{matint}, \emph{m0}, \emph{d0}, \emph{n0}, \emph{h0}, \emph{shape}, \emph{size}, \emph{center}, \emph{color}}{}
draw x ticks in a matrix
\end{fulllineitems}
\index{extract\_parameters() (in module pNbody.libutil)}
\begin{fulllineitems}
\phantomsection\label{rst/LibutilModule:pNbody.libutil.extract_parameters}\pysiglinewithargsret{\code{pNbody.libutil.}\bfcode{extract\_parameters}}{\emph{arg}, \emph{kw}, \emph{defaultparams}}{}
this function extract parameters given to a function
it returns a dictionary of parameters with respective value
defaultparams : dictionary of default parameters
\end{fulllineitems}
\index{get\_eyes() (in module pNbody.libutil)}
\begin{fulllineitems}
\phantomsection\label{rst/LibutilModule:pNbody.libutil.get_eyes}\pysiglinewithargsret{\code{pNbody.libutil.}\bfcode{get\_eyes}}{\emph{x0}, \emph{xp}, \emph{alpha}, \emph{dr}}{}
Return the position of two eyes.
x0 : position of the head
xp : looking point
theta : rotation of the head
dr : distance of the eyes
\end{fulllineitems}
\index{get\_image() (in module pNbody.libutil)}
\begin{fulllineitems}
\phantomsection\label{rst/LibutilModule:pNbody.libutil.get_image}\pysiglinewithargsret{\code{pNbody.libutil.}\bfcode{get\_image}}{\emph{mat}, \emph{name=None}, \emph{palette\_name='light'}, \emph{mode='RGB'}}{}
Return an image (PIL object).
data : numpy 2x2 object
name : name of the output
palette\_name : name of a palette
\end{fulllineitems}
\index{geter() (in module pNbody.libutil)}
\begin{fulllineitems}
\phantomsection\label{rst/LibutilModule:pNbody.libutil.geter}\pysiglinewithargsret{\code{pNbody.libutil.}\bfcode{geter}}{\emph{n}, \emph{rmin}, \emph{rmax}, \emph{g}, \emph{gm}}{}
Generate a one dimentional non linear array of r
\end{fulllineitems}
\index{geter2() (in module pNbody.libutil)}
\begin{fulllineitems}
\phantomsection\label{rst/LibutilModule:pNbody.libutil.geter2}\pysiglinewithargsret{\code{pNbody.libutil.}\bfcode{geter2}}{\emph{n}, \emph{rmin}, \emph{rmax}, \emph{g}, \emph{gm}}{}
Generate a one dimentional non linear array of r
\end{fulllineitems}
\index{getr() (in module pNbody.libutil)}
\begin{fulllineitems}
\phantomsection\label{rst/LibutilModule:pNbody.libutil.getr}\pysiglinewithargsret{\code{pNbody.libutil.}\bfcode{getr}}{\emph{nr=31}, \emph{nt=32}, \emph{rm=100.0}}{}
Return a sequence of number (n x 1 array),
where n=nr+1 defined by: Pfenniger \& Friedli (1994)
\end{fulllineitems}
\index{getval() (in module pNbody.libutil)}
\begin{fulllineitems}
\phantomsection\label{rst/LibutilModule:pNbody.libutil.getval}\pysiglinewithargsret{\code{pNbody.libutil.}\bfcode{getval}}{\emph{nb}, \emph{mode='m'}, \emph{obs=None}}{}
For each point, return a specific value linked to this point
0 : moment 0
m : moment 0
x : first moment in x
y : first moment in y
z : first moment in z
y2 : second moment in x
y2 : second moment in y
z2 : second moment in z
vx : first velocity moment in x
vy : first velocity moment in y
vz : first velocity moment in z
vx2 : second velocity moment in x
vy2 : second velocity moment in y
vz2 : second velocity moment in z
Lx : kinetic momemtum in x
Ly : kinetic momemtum in y
Lz : kinetic momemtum in z
lx : specific kinetic momemtum in x
ly : specific kinetic momemtum in y
lz : specific kinetic momemtum in z
u : specific energy
rho : density
T : temperature
A : entropy
P : pressure
Tcool : cooling time
Lum : luminosity
Ne : local electro density
\# depends on projection
r : first momemtum of radial distance
r2 : second momemtum of radial distance
vr : first momemtum of radial velocity
vr2 : second momemtum of radial velocity
vxyr : first momemtum of radial velocity in the plane
vxyr2 : second momemtum of radial velocity in the plane
vtr : first momemtum of tangential velocity in the plane
vtr2 : second momemtum of tangential velocity in the plane
\end{fulllineitems}
\index{getvaltype() (in module pNbody.libutil)}
\begin{fulllineitems}
\phantomsection\label{rst/LibutilModule:pNbody.libutil.getvaltype}\pysiglinewithargsret{\code{pNbody.libutil.}\bfcode{getvaltype}}{\emph{mode='m'}}{}
list values that depends on projection
\end{fulllineitems}
\index{invgetr() (in module pNbody.libutil)}
\begin{fulllineitems}
\phantomsection\label{rst/LibutilModule:pNbody.libutil.invgetr}\pysiglinewithargsret{\code{pNbody.libutil.}\bfcode{invgetr}}{\emph{r}, \emph{nr=31}, \emph{nt=32}, \emph{rm=100.0}}{}
From r, return the corresponding indexes.
Inverse of getr function.
\end{fulllineitems}
\index{log\_filter() (in module pNbody.libutil)}
\begin{fulllineitems}
\phantomsection\label{rst/LibutilModule:pNbody.libutil.log_filter}\pysiglinewithargsret{\code{pNbody.libutil.}\bfcode{log\_filter}}{\emph{x}, \emph{xmin}, \emph{xmax}, \emph{xc}, \emph{kx=1.0}}{}
map a value between 0 and kx
\end{fulllineitems}
\index{log\_filter\_inv() (in module pNbody.libutil)}
\begin{fulllineitems}
\phantomsection\label{rst/LibutilModule:pNbody.libutil.log_filter_inv}\pysiglinewithargsret{\code{pNbody.libutil.}\bfcode{log\_filter\_inv}}{\emph{k}, \emph{xmin}, \emph{xmax}, \emph{xc}, \emph{kx=1.0}}{}
map a value betwen xmin and xmax
\end{fulllineitems}
\index{mplot() (in module pNbody.libutil)}
\begin{fulllineitems}
\phantomsection\label{rst/LibutilModule:pNbody.libutil.mplot}\pysiglinewithargsret{\code{pNbody.libutil.}\bfcode{mplot}}{\emph{mat}, \emph{palette='light'}, \emph{save=None}, \emph{marker=None}, \emph{header=None}}{}
plot a 2d array
\end{fulllineitems}
\index{myhistogram() (in module pNbody.libutil)}
\begin{fulllineitems}
\phantomsection\label{rst/LibutilModule:pNbody.libutil.myhistogram}\pysiglinewithargsret{\code{pNbody.libutil.}\bfcode{myhistogram}}{\emph{a}, \emph{bins}}{}
Return the histogram (n x 1 float array) of the
n x 1 array ``a''.
``bins'' (m x 1 array) specify the bins of the histogram.
\end{fulllineitems}
\index{phys2img() (in module pNbody.libutil)}
\begin{fulllineitems}
\phantomsection\label{rst/LibutilModule:pNbody.libutil.phys2img}\pysiglinewithargsret{\code{pNbody.libutil.}\bfcode{phys2img}}{\emph{shape}, \emph{size}, \emph{center}, \emph{x}, \emph{y}}{}
convert physical position into the image pixel
\end{fulllineitems}
\index{sbox() (in module pNbody.libutil)}
\begin{fulllineitems}
\phantomsection\label{rst/LibutilModule:pNbody.libutil.sbox}\pysiglinewithargsret{\code{pNbody.libutil.}\bfcode{sbox}}{\emph{shape}, \emph{size}, \emph{lweight=1}, \emph{xticks=None}, \emph{yticks=None}, \emph{color=255}}{}
simple box
return a matrix of integer, containing a box with labels
xticks = (m0,d0,h0,m1,d1,h1)
0 = big
1 = small
m0,m1 = dist between ticks
d0,d1 = first tick
h0,h1 = height of the ticks
\end{fulllineitems}
\index{set\_ranges() (in module pNbody.libutil)}
\begin{fulllineitems}
\phantomsection\label{rst/LibutilModule:pNbody.libutil.set_ranges}\pysiglinewithargsret{\code{pNbody.libutil.}\bfcode{set\_ranges}}{\emph{mat}, \emph{scale='log'}, \emph{mn=None}, \emph{mx=None}, \emph{cd=None}}{}
Transform an n x m float array into an n x m int array that will be
used to create an image. The float values are rescaled and cutted in order to range
between 0 and 255.
mat : the matrice
scale : lin or log
mn : lower value for the cutoff
mx : higer value for the cutoff
cd : parameter
\end{fulllineitems}
\index{tranfert\_functions() (in module pNbody.libutil)}
\begin{fulllineitems}
\phantomsection\label{rst/LibutilModule:pNbody.libutil.tranfert_functions}\pysiglinewithargsret{\code{pNbody.libutil.}\bfcode{tranfert\_functions}}{\emph{rmin}, \emph{rmax}, \emph{g=None}, \emph{gm=None}}{}
This function computes the normalized tranfer fonction from g and gm
It is very usefull to tranform a linear vetor in a non linear one
example of g:
\begin{quote}
g = lambda r:log(r/rc+1)
gm = lambda r:rc*(exp(r)-1)
\end{quote}
\end{fulllineitems}
\index{vel\_cart2cyl() (in module pNbody.libutil)}
\begin{fulllineitems}
\phantomsection\label{rst/LibutilModule:pNbody.libutil.vel_cart2cyl}\pysiglinewithargsret{\code{pNbody.libutil.}\bfcode{vel\_cart2cyl}}{\emph{pos}, \emph{vel}}{}
Transform velocities in carthesian coordinates vx,vy,vz into cylindrical
coodinates vr,vz,vz.
Pos is the position of particles in cart. coord.
Vel is the velocity in cart. coord.
Return a 3xn float array.
\end{fulllineitems}
\index{vel\_cyl2cart() (in module pNbody.libutil)}
\begin{fulllineitems}
\phantomsection\label{rst/LibutilModule:pNbody.libutil.vel_cyl2cart}\pysiglinewithargsret{\code{pNbody.libutil.}\bfcode{vel\_cyl2cart}}{\emph{pos=None}, \emph{vel=None}}{}
Transform velocities in cylindrical coordinates vr,vt,vz into carthesian
coodinates vx,vy,vz.
Pos is the position of particles in cart. coord.
Vel is the velocity in cylindrical coord.
Return a 3xn float array.
\end{fulllineitems}
\section{the param module}
\label{rst/ParamModule:the-param-module}\label{rst/ParamModule::doc}\label{rst/ParamModule:module-pNbody.param}\index{pNbody.param (module)}\index{Params (class in pNbody.param)}
\begin{fulllineitems}
\phantomsection\label{rst/ParamModule:pNbody.param.Params}\pysiglinewithargsret{\strong{class }\code{pNbody.param.}\bfcode{Params}}{\emph{filename}, \emph{master}}{}~\begin{description}
\item[{params = {[}{[}'imwidth','image width','i',512{]},}] \leavevmode
{[}'imheight','image height','i',384{]},
{[}'winwidth','window width','f',50.{]},
{[}'winheight','window height','f',37.5{]}{]}
\end{description}
\paragraph{Methods}
\index{get() (pNbody.param.Params method)}
\begin{fulllineitems}
\phantomsection\label{rst/ParamModule:pNbody.param.Params.get}\pysiglinewithargsret{\bfcode{get}}{\emph{name}}{}
return the value of a parameter
\end{fulllineitems}
\index{get\_dic() (pNbody.param.Params method)}
\begin{fulllineitems}
\phantomsection\label{rst/ParamModule:pNbody.param.Params.get_dic}\pysiglinewithargsret{\bfcode{get\_dic}}{}{}
return values of parameters in a dictionary
\end{fulllineitems}
\index{get\_string() (pNbody.param.Params method)}
\begin{fulllineitems}
\phantomsection\label{rst/ParamModule:pNbody.param.Params.get_string}\pysiglinewithargsret{\bfcode{get\_string}}{\emph{name}}{}
return the value of a parameter in a string
\end{fulllineitems}
\index{get\_type() (pNbody.param.Params method)}
\begin{fulllineitems}
\phantomsection\label{rst/ParamModule:pNbody.param.Params.get_type}\pysiglinewithargsret{\bfcode{get\_type}}{\emph{name}}{}
return the type of a parameter
\end{fulllineitems}
\index{lists() (pNbody.param.Params method)}
\begin{fulllineitems}
\phantomsection\label{rst/ParamModule:pNbody.param.Params.lists}\pysiglinewithargsret{\bfcode{lists}}{}{}
print the list of the content of the class
\end{fulllineitems}
\index{save() (pNbody.param.Params method)}
\begin{fulllineitems}
\phantomsection\label{rst/ParamModule:pNbody.param.Params.save}\pysiglinewithargsret{\bfcode{save}}{\emph{filename=None}}{}
{[}'cd', `cd', `Float', 0.0{]}
\end{fulllineitems}
\index{set() (pNbody.param.Params method)}
\begin{fulllineitems}
\phantomsection\label{rst/ParamModule:pNbody.param.Params.set}\pysiglinewithargsret{\bfcode{set}}{\emph{name}, \emph{value}}{}
set the value of a parameter
\end{fulllineitems}
\end{fulllineitems}
\index{read\_ascii\_value() (in module pNbody.param)}
\begin{fulllineitems}
\phantomsection\label{rst/ParamModule:pNbody.param.read_ascii_value}\pysiglinewithargsret{\code{pNbody.param.}\bfcode{read\_ascii\_value}}{\emph{value}, \emph{tpe}, \emph{name}}{}
from a name and type, return
an object corresponding to the value given
\end{fulllineitems}
\index{write\_ascii\_value() (in module pNbody.param)}
\begin{fulllineitems}
\phantomsection\label{rst/ParamModule:pNbody.param.write_ascii_value}\pysiglinewithargsret{\code{pNbody.param.}\bfcode{write\_ascii\_value}}{\emph{value}, \emph{tpe}, \emph{name}}{}
from a name and type and value, return
an ascii representation of the object
\end{fulllineitems}
\section{the parameters module}
\label{rst/ParameterModule:the-parameters-module}\label{rst/ParameterModule:module-pNbody.parameters}\label{rst/ParameterModule::doc}\index{pNbody.parameters (module)}
\section{the liblog module}
\label{rst/LiblogModule:the-liblog-module}\label{rst/LiblogModule::doc}\label{rst/LiblogModule:module-pNbody.liblog}\index{pNbody.liblog (module)}\index{Log (class in pNbody.liblog)}
\begin{fulllineitems}
\phantomsection\label{rst/LiblogModule:pNbody.liblog.Log}\pysiglinewithargsret{\strong{class }\code{pNbody.liblog.}\bfcode{Log}}{\emph{directory}, \emph{show='yes'}, \emph{append='no'}, \emph{filename=None}, \emph{logframe=None}}{}
a log class
\paragraph{Methods}
\index{close() (pNbody.liblog.Log method)}
\begin{fulllineitems}
\phantomsection\label{rst/LiblogModule:pNbody.liblog.Log.close}\pysiglinewithargsret{\bfcode{close}}{}{}
close the file
\end{fulllineitems}
\index{write() (pNbody.liblog.Log method)}
\begin{fulllineitems}
\phantomsection\label{rst/LiblogModule:pNbody.liblog.Log.write}\pysiglinewithargsret{\bfcode{write}}{\emph{line}, \emph{name=None}}{}
write a line
\end{fulllineitems}
\end{fulllineitems}
\section{the talkgdisp module}
\label{rst/TalkgdispModule:the-talkgdisp-module}\label{rst/TalkgdispModule:module-pNbody.talkgdisp}\label{rst/TalkgdispModule::doc}\index{pNbody.talkgdisp (module)}\index{TalkServer (class in pNbody.talkgdisp)}
\begin{fulllineitems}
\phantomsection\label{rst/TalkgdispModule:pNbody.talkgdisp.TalkServer}\pysiglinewithargsret{\strong{class }\code{pNbody.talkgdisp.}\bfcode{TalkServer}}{\emph{address=None}, \emph{module=None}, \emph{cl=None}}{}
talk server class
\paragraph{Methods}
\end{fulllineitems}
\section{the pyfits module}
\label{rst/PyfitsModule:the-pyfits-module}\label{rst/PyfitsModule::doc}\label{rst/PyfitsModule:module-pNbody.pyfits}\index{pNbody.pyfits (module)}
A module for reading and writing FITS files and manipulating their contents.
A module for reading and writing Flexible Image Transport System
(FITS) files. This file format was endorsed by the International
Astronomical Union in 1999 and mandated by NASA as the standard format
for storing high energy astrophysics data. For details of the FITS
standard, see the NASA/Science Office of Standards and Technology
publication, NOST 100-2.0.
License: \href{http://www.stsci.edu/resources/software\_hardware/pyraf/LICENSE}{http://www.stsci.edu/resources/software\_hardware/pyraf/LICENSE}
For detailed examples of usage, see the I\{PyFITS User's Manual\} available from
U\{\href{http://www.stsci.edu/resources/software\_hardware/pyfits/Users\_Manual1.pdf}{http://www.stsci.edu/resources/software\_hardware/pyfits/Users\_Manual1.pdf}\}
Epydoc markup used for all docstrings in this module.
\begin{description}
\item[{@group Header-related Classes: Card, CardList, \_Card\_with\_continue,}] \leavevmode
Header, \_Hierarch
\item[{@group HDU Classes: \_AllHDU, BinTableHDU, \_CorruptedHDU, \_ExtensionHDU,}] \leavevmode
GroupsHDU, ImageHDU, \_ImageBaseHDU, PrimaryHDU, TableHDU,
\_TableBaseHDU, \_TempHDU, \_ValidHDU
\item[{@group Table-related Classes: ColDefs, Column, FITS\_rec, \_FormatP,}] \leavevmode
\_FormatX, \_VLF
\end{description}
\index{BinTableHDU (class in pNbody.pyfits)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.BinTableHDU}\pysiglinewithargsret{\strong{class }\code{pNbody.pyfits.}\bfcode{BinTableHDU}}{\emph{data=None}, \emph{header=None}, \emph{name=None}}{}
Binary table HDU class.
\paragraph{Methods}
\end{fulllineitems}
\index{CardList (class in pNbody.pyfits)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.CardList}\pysiglinewithargsret{\strong{class }\code{pNbody.pyfits.}\bfcode{CardList}}{\emph{cards=}\optional{}, \emph{keylist=None}}{}
FITS header card list class.
\paragraph{Methods}
\index{append() (pNbody.pyfits.CardList method)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.CardList.append}\pysiglinewithargsret{\bfcode{append}}{\emph{card}, \emph{useblanks=1}, \emph{bottom=0}}{}
Append a Card to the CardList.
card: The Card to be appended.
useblanks: Use any \emph{extra} blank cards? default=1.
\begin{quote}
If useblanks != 0, and if there are blank cards directly
before END, it will use this space first, instead of
appending after these blank cards, so the total space
will not increase (default). When useblanks == 0, the
card will be appended at the end, even if there are
blank cards in front of END.
\end{quote}
\begin{description}
\item[{bottom: If =0 (default) the card will be appended after the last}] \leavevmode
non-commentary card. If =1, the card will be appended
after the last non-blank card.
\end{description}
\end{fulllineitems}
\index{copy() (pNbody.pyfits.CardList method)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.CardList.copy}\pysiglinewithargsret{\bfcode{copy}}{}{}
Make a (deep)copy of the CardList.
\end{fulllineitems}
\index{count\_blanks() (pNbody.pyfits.CardList method)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.CardList.count_blanks}\pysiglinewithargsret{\bfcode{count\_blanks}}{}{}
Find out how many blank cards are \emph{directly} before the END card.
\end{fulllineitems}
\index{index\_of() (pNbody.pyfits.CardList method)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.CardList.index_of}\pysiglinewithargsret{\bfcode{index\_of}}{\emph{key}, \emph{backward=0}}{}
Get the index of a keyword in the CardList.
key: the keyword name (a string) or the index (an integer).
backward: search the index from the END, i.e. backward? default=0.
\begin{quote}
If backward = 1, search from the end.
\end{quote}
\end{fulllineitems}
\index{insert() (pNbody.pyfits.CardList method)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.CardList.insert}\pysiglinewithargsret{\bfcode{insert}}{\emph{pos}, \emph{card}, \emph{useblanks=1}}{}
Insert a Card to the CardList.
\begin{description}
\item[{pos: The position (index, keyword name will not be allowed) to}] \leavevmode
insert. The new card will be inserted before it.
\end{description}
card: The Card to be inserted.
useblanks: Use any \emph{extra} blank cards? default=1.
\begin{quote}
If useblanks != 0, and if there are blank cards directly
before END, it will use this space first, instead of
appending after these blank cards, so the total space
will not increase (default). When useblanks == 0, the
card will be appended at the end, even if there are
blank cards in front of END.
\end{quote}
\end{fulllineitems}
\index{keys() (pNbody.pyfits.CardList method)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.CardList.keys}\pysiglinewithargsret{\bfcode{keys}}{}{}
Return a list of all keywords from the CardList.
\end{fulllineitems}
\end{fulllineitems}
\index{ColDefs (class in pNbody.pyfits)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.ColDefs}\pysiglinewithargsret{\strong{class }\code{pNbody.pyfits.}\bfcode{ColDefs}}{\emph{input}, \emph{tbtype='BinTableHDU'}}{}
Column definitions class. It has attributes corresponding to the
Column attributes (e.g. ColDefs has the attribute .names while Column
has .name), Each attribute in ColDefs is a list of corresponding
attribute values from all Columns.
\paragraph{Methods}
\index{add\_col() (pNbody.pyfits.ColDefs method)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.ColDefs.add_col}\pysiglinewithargsret{\bfcode{add\_col}}{\emph{column}}{}
Append one Column to the column definition.
\end{fulllineitems}
\index{change\_attrib() (pNbody.pyfits.ColDefs method)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.ColDefs.change_attrib}\pysiglinewithargsret{\bfcode{change\_attrib}}{\emph{col\_name}, \emph{attrib}, \emph{new\_value}}{}
Change an attribute (in the commonName list) of a Column.
\end{fulllineitems}
\index{change\_name() (pNbody.pyfits.ColDefs method)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.ColDefs.change_name}\pysiglinewithargsret{\bfcode{change\_name}}{\emph{col\_name}, \emph{new\_name}}{}
Change a Column's name.
\end{fulllineitems}
\index{change\_unit() (pNbody.pyfits.ColDefs method)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.ColDefs.change_unit}\pysiglinewithargsret{\bfcode{change\_unit}}{\emph{col\_name}, \emph{new\_unit}}{}
Change a Column's unit.
\end{fulllineitems}
\index{del\_col() (pNbody.pyfits.ColDefs method)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.ColDefs.del_col}\pysiglinewithargsret{\bfcode{del\_col}}{\emph{col\_name}}{}
Delete (the definition of) one Column.
\end{fulllineitems}
\index{info() (pNbody.pyfits.ColDefs method)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.ColDefs.info}\pysiglinewithargsret{\bfcode{info}}{\emph{attrib='all'}}{}
Get attribute(s) information of the column definition.
\end{fulllineitems}
\end{fulllineitems}
\index{Column (class in pNbody.pyfits)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.Column}\pysiglinewithargsret{\strong{class }\code{pNbody.pyfits.}\bfcode{Column}}{\emph{name=None}, \emph{format=None}, \emph{unit=None}, \emph{null=None}, \emph{bscale=None}, \emph{bzero=None}, \emph{disp=None}, \emph{start=None}, \emph{dim=None}, \emph{array=None}}{}
Column class which contains the definition of one column, e.g.
ttype, tform, etc. and the array. Does not support theap yet.
\paragraph{Methods}
\end{fulllineitems}
\index{Delayed (class in pNbody.pyfits)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.Delayed}\pysiglinewithargsret{\strong{class }\code{pNbody.pyfits.}\bfcode{Delayed}}{\emph{hdu=None}, \emph{field=None}}{}
Delayed file-reading data.
\end{fulllineitems}
\index{ErrorURLopener (class in pNbody.pyfits)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.ErrorURLopener}\pysiglinewithargsret{\strong{class }\code{pNbody.pyfits.}\bfcode{ErrorURLopener}}{\emph{*args}, \emph{**kwargs}}{}
A class to use with urlretrieve to allow IOError exceptions to be
raised when a file specified by a URL cannot be accessed
\paragraph{Methods}
\end{fulllineitems}
\index{FITS\_rec (class in pNbody.pyfits)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.FITS_rec}\pysigline{\strong{class }\code{pNbody.pyfits.}\bfcode{FITS\_rec}}{}
FITS record array class. FITS record array is the data part of a
table HDU's data part. This is a layer over the recarray, so we
can deal with scaled columns.
\paragraph{Methods}
\index{field() (pNbody.pyfits.FITS\_rec method)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.FITS_rec.field}\pysiglinewithargsret{\bfcode{field}}{\emph{key}}{}
A view of a Column's data as an array.
\end{fulllineitems}
\end{fulllineitems}
\index{FITS\_record (class in pNbody.pyfits)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.FITS_record}\pysiglinewithargsret{\strong{class }\code{pNbody.pyfits.}\bfcode{FITS\_record}}{\emph{input}, \emph{row=0}}{}
FITS record class. FITS record class is used to access records of
the FITS\_rec object. This will allow us to deal with scaled columns.
The FITS\_record class expects a FITS\_rec object as input
\paragraph{Methods}
\index{field() (pNbody.pyfits.FITS\_record method)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.FITS_record.field}\pysiglinewithargsret{\bfcode{field}}{\emph{fieldName}}{}
Get the field data of the record.
\end{fulllineitems}
\index{setfield() (pNbody.pyfits.FITS\_record method)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.FITS_record.setfield}\pysiglinewithargsret{\bfcode{setfield}}{\emph{fieldName}, \emph{value}}{}
Set the field data of the record.
\end{fulllineitems}
\end{fulllineitems}
\index{GroupData (class in pNbody.pyfits)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.GroupData}\pysigline{\strong{class }\code{pNbody.pyfits.}\bfcode{GroupData}}{}
Random groups data object.
Allows structured access to FITS Group data in a manner analogous to tables
\paragraph{Methods}
\index{par() (pNbody.pyfits.GroupData method)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.GroupData.par}\pysiglinewithargsret{\bfcode{par}}{\emph{parName}}{}
Get the group parameter values.
\end{fulllineitems}
\index{setpar() (pNbody.pyfits.GroupData method)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.GroupData.setpar}\pysiglinewithargsret{\bfcode{setpar}}{\emph{parName}, \emph{value}}{}
Set the group parameter values.
\end{fulllineitems}
\end{fulllineitems}
\index{GroupsHDU (class in pNbody.pyfits)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.GroupsHDU}\pysiglinewithargsret{\strong{class }\code{pNbody.pyfits.}\bfcode{GroupsHDU}}{\emph{data=None}, \emph{header=None}, \emph{name=None}}{}
FITS Random Groups HDU class.
\paragraph{Methods}
\index{size() (pNbody.pyfits.GroupsHDU method)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.GroupsHDU.size}\pysiglinewithargsret{\bfcode{size}}{}{}
Returns the size (in bytes) of the HDU's data part.
\end{fulllineitems}
\end{fulllineitems}
\index{HDUList (class in pNbody.pyfits)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.HDUList}\pysiglinewithargsret{\strong{class }\code{pNbody.pyfits.}\bfcode{HDUList}}{\emph{hdus=}\optional{}, \emph{file=None}}{}
HDU list class. This is the top-level FITS object. When a FITS
file is opened, a HDUList object is returned.
\paragraph{Methods}
\index{append() (pNbody.pyfits.HDUList method)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.HDUList.append}\pysiglinewithargsret{\bfcode{append}}{\emph{hdu}}{}
Append a new HDU to the HDUList.
\end{fulllineitems}
\index{close() (pNbody.pyfits.HDUList method)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.HDUList.close}\pysiglinewithargsret{\bfcode{close}}{\emph{output\_verify='exception'}, \emph{verbose=0}}{}
Close the associated FITS file and memmap object, if any.
output\_verify: output verification option, default = `exception'.
verbose: print out verbose messages? default = 0.
This simply calls the close method of the \_File class. It has this
two-tier calls because \_File has ts own private attribute \_\_file.
\end{fulllineitems}
\index{flush() (pNbody.pyfits.HDUList method)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.HDUList.flush}\pysiglinewithargsret{\bfcode{flush}}{\emph{output\_verify='exception'}, \emph{verbose=0}, \emph{classExtensions=\{\}}}{}
Force a write of the HDUList back to the file (for append and
update modes only).
output\_verify: output verification option, default = `exception'.
verbose: print out verbose messages? default = 0.
classExtensions: A dictionary that maps pyfits classes to extensions
\begin{quote}
of those classes. When present in the dictionary,
the extension class will be constructed in place of
the pyfits class.
\end{quote}
\end{fulllineitems}
\index{index\_of() (pNbody.pyfits.HDUList method)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.HDUList.index_of}\pysiglinewithargsret{\bfcode{index\_of}}{\emph{key}}{}
Get the index of an HDU from the HDUList. The key can be an
integer, a string, or a tuple of (string, integer).
\end{fulllineitems}
\index{info() (pNbody.pyfits.HDUList method)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.HDUList.info}\pysiglinewithargsret{\bfcode{info}}{}{}
Summarize the info of the HDU's in this HDUList.
\end{fulllineitems}
\index{readall() (pNbody.pyfits.HDUList method)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.HDUList.readall}\pysiglinewithargsret{\bfcode{readall}}{}{}
Read data of all HDU's into memory.
\end{fulllineitems}
\index{update\_extend() (pNbody.pyfits.HDUList method)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.HDUList.update_extend}\pysiglinewithargsret{\bfcode{update\_extend}}{}{}
Make sure if the primary header needs the keyword EXTEND or if
it has the proper value.
\end{fulllineitems}
\index{update\_tbhdu() (pNbody.pyfits.HDUList method)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.HDUList.update_tbhdu}\pysiglinewithargsret{\bfcode{update\_tbhdu}}{}{}
Update all table HDU's for scaled fields.
\end{fulllineitems}
\index{writeto() (pNbody.pyfits.HDUList method)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.HDUList.writeto}\pysiglinewithargsret{\bfcode{writeto}}{\emph{name}, \emph{output\_verify='exception'}, \emph{clobber=False}, \emph{classExtensions=\{\}}}{}
Write the HDUList to a new file.
name: output FITS file name to be written to.
output\_verify: output verification option, default = `exception'.
clobber: Overwrite the output file if exists, default = False.
classExtensions: A dictionary that maps pyfits classes to extensions
\begin{quote}
of those classes. When present in the dictionary,
the extension class will be constructed in place of
the pyfits class.
\end{quote}
\end{fulllineitems}
\end{fulllineitems}
\index{Header (class in pNbody.pyfits)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.Header}\pysiglinewithargsret{\strong{class }\code{pNbody.pyfits.}\bfcode{Header}}{\emph{cards=}\optional{}}{}
FITS header class.
\paragraph{Methods}
\index{add\_blank() (pNbody.pyfits.Header method)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.Header.add_blank}\pysiglinewithargsret{\bfcode{add\_blank}}{\emph{value='`}, \emph{before=None}, \emph{after=None}}{}
Add a blank card.
value: Text to be added.
before: {[}same as in update(){]}
after: {[}same as in update(){]}
\end{fulllineitems}
\index{add\_comment() (pNbody.pyfits.Header method)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.Header.add_comment}\pysiglinewithargsret{\bfcode{add\_comment}}{\emph{value}, \emph{before=None}, \emph{after=None}}{}
Add a COMMENT card.
value: Comment text to be added.
before: {[}same as in update(){]}
after: {[}same as in update(){]}
\end{fulllineitems}
\index{add\_history() (pNbody.pyfits.Header method)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.Header.add_history}\pysiglinewithargsret{\bfcode{add\_history}}{\emph{value}, \emph{before=None}, \emph{after=None}}{}
Add a HISTORY card.
value: History text to be added.
before: {[}same as in update(){]}
after: {[}same as in update(){]}
\end{fulllineitems}
\index{ascardlist() (pNbody.pyfits.Header method)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.Header.ascardlist}\pysiglinewithargsret{\bfcode{ascardlist}}{}{}
Returns a CardList.
\end{fulllineitems}
\index{copy() (pNbody.pyfits.Header method)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.Header.copy}\pysiglinewithargsret{\bfcode{copy}}{}{}
Make a copy of the Header.
\end{fulllineitems}
\index{get() (pNbody.pyfits.Header method)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.Header.get}\pysiglinewithargsret{\bfcode{get}}{\emph{key}, \emph{default=None}}{}
Get a keyword value from the CardList.
If no keyword is found, return the default value.
key: keyword name or index
default: if no keyword is found, the value to be returned.
\end{fulllineitems}
\index{get\_comment() (pNbody.pyfits.Header method)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.Header.get_comment}\pysiglinewithargsret{\bfcode{get\_comment}}{}{}
Get all comments as a list of string texts.
\end{fulllineitems}
\index{get\_history() (pNbody.pyfits.Header method)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.Header.get_history}\pysiglinewithargsret{\bfcode{get\_history}}{}{}
Get all histories as a list of string texts.
\end{fulllineitems}
\index{has\_key() (pNbody.pyfits.Header method)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.Header.has_key}\pysiglinewithargsret{\bfcode{has\_key}}{\emph{key}}{}
Check for existence of a keyword. Returns 1 if found, otherwise, 0.
key: keyword name. If given an index, always returns 0.
\end{fulllineitems}
\index{items() (pNbody.pyfits.Header method)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.Header.items}\pysiglinewithargsret{\bfcode{items}}{}{}
Return a list of all keyword-value pairs from the CardList.
\end{fulllineitems}
\index{rename\_key() (pNbody.pyfits.Header method)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.Header.rename_key}\pysiglinewithargsret{\bfcode{rename\_key}}{\emph{oldkey}, \emph{newkey}, \emph{force=0}}{}
Rename a card's keyword in the header.
oldkey: old keyword, can be a name or index.
newkey: new keyword, must be a string.
force: if new key name already exist, force to have duplicate name.
\end{fulllineitems}
\index{update() (pNbody.pyfits.Header method)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.Header.update}\pysiglinewithargsret{\bfcode{update}}{\emph{key}, \emph{value}, \emph{comment=None}, \emph{before=None}, \emph{after=None}}{}
Update one header card.
\end{fulllineitems}
\end{fulllineitems}
\index{ImageHDU (class in pNbody.pyfits)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.ImageHDU}\pysiglinewithargsret{\strong{class }\code{pNbody.pyfits.}\bfcode{ImageHDU}}{\emph{data=None}, \emph{header=None}, \emph{name=None}}{}
FITS image extension HDU class.
\paragraph{Methods}
\end{fulllineitems}
\index{PrimaryHDU (class in pNbody.pyfits)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.PrimaryHDU}\pysiglinewithargsret{\strong{class }\code{pNbody.pyfits.}\bfcode{PrimaryHDU}}{\emph{data=None}, \emph{header=None}}{}
FITS primary HDU class.
\paragraph{Methods}
\end{fulllineitems}
\index{Section (class in pNbody.pyfits)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.Section}\pysiglinewithargsret{\strong{class }\code{pNbody.pyfits.}\bfcode{Section}}{\emph{hdu}}{}
Image section.
\end{fulllineitems}
\index{StreamingHDU (class in pNbody.pyfits)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.StreamingHDU}\pysiglinewithargsret{\strong{class }\code{pNbody.pyfits.}\bfcode{StreamingHDU}}{\emph{name}, \emph{header}}{}
A class that provides the capability to stream data to a FITS file
instead of requiring data to all be written at once.
The following psudo code illustrates its use:
header = pyfits.Header()
\begin{description}
\item[{for all the cards you need in the header:}] \leavevmode
header.update(key,value,comment)
\end{description}
shdu = pyfits.StreamingHDU(`filename.fits',header)
\begin{description}
\item[{for each piece of data:}] \leavevmode
shdu.write(data)
\end{description}
shdu.close()
\paragraph{Methods}
\index{close() (pNbody.pyfits.StreamingHDU method)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.StreamingHDU.close}\pysiglinewithargsret{\bfcode{close}}{}{}
Close the `physical' FITS file.
\begin{quote}\begin{description}
\item[{Parameters }] \leavevmode
None
\item[{Returns }] \leavevmode
None
\end{description}\end{quote}
\end{fulllineitems}
\index{size() (pNbody.pyfits.StreamingHDU method)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.StreamingHDU.size}\pysiglinewithargsret{\bfcode{size}}{}{}
Return the size (in bytes) of the data portion of the HDU.
\begin{quote}\begin{description}
\item[{Parameters }] \leavevmode
None
\item[{Returns }] \leavevmode\begin{description}
\item[{size}] \leavevmode{[}integer{]}
The number of bytes of data required to fill the stream
per the header provided in the constructor.
\end{description}
\end{description}\end{quote}
\end{fulllineitems}
\index{write() (pNbody.pyfits.StreamingHDU method)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.StreamingHDU.write}\pysiglinewithargsret{\bfcode{write}}{\emph{data}}{}
Write the given data to the stream.
\begin{quote}\begin{description}
\item[{Parameters }] \leavevmode\begin{description}
\item[{data}] \leavevmode{[}ndarray{]}
Data to stream to the file.
\end{description}
\item[{Returns }] \leavevmode\begin{description}
\item[{writeComplete}] \leavevmode{[}integer {]}
Flag that when true indicates that all of the required data
has been written to the stream.
\end{description}
\end{description}\end{quote}
\paragraph{Notes}
Only the amount of data specified in the header provided to the
class constructor may be written to the stream. If the provided
data would cause the stream to overflow, an IOError exception is
raised and the data is not written. Once sufficient data has been
written to the stream to satisfy the amount specified in the header,
the stream is padded to fill a complete FITS block and no more data
will be accepted. An attempt to write more data after the stream
has been filled will raise an IOError exception. If the dtype of
the input data does not match what is expected by the header, a
TypeError exception is raised.
\end{fulllineitems}
\end{fulllineitems}
\index{TableHDU (class in pNbody.pyfits)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.TableHDU}\pysiglinewithargsret{\strong{class }\code{pNbody.pyfits.}\bfcode{TableHDU}}{\emph{data=None}, \emph{header=None}, \emph{name=None}}{}
FITS ASCII table extension HDU class.
\paragraph{Methods}
\end{fulllineitems}
\index{Undefined (class in pNbody.pyfits)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.Undefined}\pysigline{\strong{class }\code{pNbody.pyfits.}\bfcode{Undefined}}{}
Undefined value.
\end{fulllineitems}
\index{VerifyError}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.VerifyError}\pysigline{\strong{exception }\code{pNbody.pyfits.}\bfcode{VerifyError}}{}
Verify exception class.
\end{fulllineitems}
\index{append() (in module pNbody.pyfits)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.append}\pysiglinewithargsret{\code{pNbody.pyfits.}\bfcode{append}}{\emph{filename}, \emph{data}, \emph{header=None}, \emph{classExtensions=\{\}}}{}
Append the header/data to FITS file if filename exists, create if not.
If only data is supplied, a minimal header is created
\begin{quote}
@type filename: string
@param filename: name of the file to append to
@type data: array, table, or group data object
@param data: the new data used for appending
@type header: L\{Header\} object or None
@param header: the header associated with `data', if None,
\begin{quote}
an appropriate header will be created for the data object
supplied.
\end{quote}
@type classExtensions: dictionary
@param classExtensions: A dictionary that maps pyfits classes to
\begin{quote}
extensions of those classes. When present in
the dictionary, the extension class will be
constructed in place of the pyfits class.
\end{quote}
\end{quote}
\end{fulllineitems}
\index{fitsopen() (in module pNbody.pyfits)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.fitsopen}\pysiglinewithargsret{\code{pNbody.pyfits.}\bfcode{fitsopen}}{\emph{name}, \emph{mode='copyonwrite'}, \emph{memmap=0}, \emph{classExtensions=\{\}}}{}
Factory function to open a FITS file and return an HDUList object.
name: Name of the FITS file to be opened or already opened file object.
mode: Open mode, `readonly' (default), `update', or `append'.
memmap: Is memmory mapping to be used? default=0.
classExtensions: A dictionary that maps pyfits classes to extensions of
\begin{quote}
those classes. When present in the dictionary, the
extension class will be constructed in place of the
pyfits class.
\end{quote}
\end{fulllineitems}
\index{getdata() (in module pNbody.pyfits)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.getdata}\pysiglinewithargsret{\code{pNbody.pyfits.}\bfcode{getdata}}{\emph{filename}, \emph{*ext}, \emph{**extkeys}}{}
Get the data from an extension of a FITS file (and optionally the header).
@type filename: string
@param filename: input FITS file name
\begin{description}
\item[{@keyword classExtensions: (optional) A dictionary that maps pyfits }] \leavevmode
classes to extensions of those classes. When present in the
dictionary, the extension class will be constructed in place
of the pyfits class.
\end{description}
@param ext: The rest of the arguments are for extension specification. They are
flexible and are best illustrated by examples:
No extra arguments implies the primary header
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{getdata}\PYG{p}{(}\PYG{l+s}{'}\PYG{l+s}{in.fits}\PYG{l+s}{'}\PYG{p}{)}
\end{Verbatim}
By extension number:
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{getdata}\PYG{p}{(}\PYG{l+s}{'}\PYG{l+s}{in.fits}\PYG{l+s}{'}\PYG{p}{,} \PYG{l+m+mi}{0}\PYG{p}{)} \PYG{c}{\# the primary header }
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{getdata}\PYG{p}{(}\PYG{l+s}{'}\PYG{l+s}{in.fits}\PYG{l+s}{'}\PYG{p}{,} \PYG{l+m+mi}{2}\PYG{p}{)} \PYG{c}{\# the second extension}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{getdata}\PYG{p}{(}\PYG{l+s}{'}\PYG{l+s}{in.fits}\PYG{l+s}{'}\PYG{p}{,} \PYG{n}{ext}\PYG{o}{=}\PYG{l+m+mi}{2}\PYG{p}{)} \PYG{c}{\# the second extension}
\end{Verbatim}
By name, i.e., EXTNAME value (if unique):
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{getdata}\PYG{p}{(}\PYG{l+s}{'}\PYG{l+s}{in.fits}\PYG{l+s}{'}\PYG{p}{,} \PYG{l+s}{'}\PYG{l+s}{sci}\PYG{l+s}{'}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{getdata}\PYG{p}{(}\PYG{l+s}{'}\PYG{l+s}{in.fits}\PYG{l+s}{'}\PYG{p}{,} \PYG{n}{extname}\PYG{o}{=}\PYG{l+s}{'}\PYG{l+s}{sci}\PYG{l+s}{'}\PYG{p}{)} \PYG{c}{\# equivalent}
\end{Verbatim}
Note EXTNAMEs are not case sensitive
By combination of EXTNAME and EXTVER, as separate arguments or as a tuple:
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{getdata}\PYG{p}{(}\PYG{l+s}{'}\PYG{l+s}{in.fits}\PYG{l+s}{'}\PYG{p}{,} \PYG{l+s}{'}\PYG{l+s}{sci}\PYG{l+s}{'}\PYG{p}{,} \PYG{l+m+mi}{2}\PYG{p}{)} \PYG{c}{\# EXTNAME='SCI' \& EXTVER=2}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{getdata}\PYG{p}{(}\PYG{l+s}{'}\PYG{l+s}{in.fits}\PYG{l+s}{'}\PYG{p}{,} \PYG{n}{extname}\PYG{o}{=}\PYG{l+s}{'}\PYG{l+s}{sci}\PYG{l+s}{'}\PYG{p}{,} \PYG{n}{extver}\PYG{o}{=}\PYG{l+m+mi}{2}\PYG{p}{)} \PYG{c}{\# equivalent}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{getdata}\PYG{p}{(}\PYG{l+s}{'}\PYG{l+s}{in.fits}\PYG{l+s}{'}\PYG{p}{,} \PYG{p}{(}\PYG{l+s}{'}\PYG{l+s}{sci}\PYG{l+s}{'}\PYG{p}{,} \PYG{l+m+mi}{2}\PYG{p}{)}\PYG{p}{)} \PYG{c}{\# equivalent}
\end{Verbatim}
Ambiguous or conflicting specifications will raise an exception, e.g.,
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{getdata}\PYG{p}{(}\PYG{l+s}{'}\PYG{l+s}{in.fits}\PYG{l+s}{'}\PYG{p}{,} \PYG{n}{ext}\PYG{o}{=}\PYG{p}{(}\PYG{l+s}{'}\PYG{l+s}{sci}\PYG{l+s}{'}\PYG{p}{,}\PYG{l+m+mi}{1}\PYG{p}{)}\PYG{p}{,} \PYG{n}{extname}\PYG{o}{=}\PYG{l+s}{'}\PYG{l+s}{err}\PYG{l+s}{'}\PYG{p}{,} \PYG{n}{extver}\PYG{o}{=}\PYG{l+m+mi}{2}\PYG{p}{)}
\end{Verbatim}
@return: an array, record array (i.e. table), or groups data object
depending on the type of the extension being referenced
If the optional keyword `header' is set to True, this function will
return a (data, header) tuple.
\end{fulllineitems}
\index{getheader() (in module pNbody.pyfits)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.getheader}\pysiglinewithargsret{\code{pNbody.pyfits.}\bfcode{getheader}}{\emph{filename}, \emph{*ext}, \emph{**extkeys}}{}
Get the header from an extension of a FITS file.
@param filename: input FITS file name
@type: string
@keyword classExtensions: (optional) A dictionary that maps pyfits
\begin{quote}
classes to extensions of those classes. When present in the
dictionary, the extension class will be constructed in place
of the pyfits class.
\end{quote}
\begin{description}
\item[{@param ext: The rest of the arguments are for extension specification.}] \leavevmode
See L\{getdata\} for explanations/examples.
\end{description}
@rtype: L\{Header\} object
@return: header
\end{fulllineitems}
\index{getval() (in module pNbody.pyfits)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.getval}\pysiglinewithargsret{\code{pNbody.pyfits.}\bfcode{getval}}{\emph{filename}, \emph{key}, \emph{*ext}, \emph{**extkeys}}{}
Get a keyword's value from a header in a FITS file.
@type filename: string
@param filename: input FITS file name
@type key: string
@param key: keyword name
@keyword classExtensions: (optional) A dictionary that maps pyfits
\begin{quote}
classes to extensions of those classes. When present in the
dictionary, the extension class will be constructed in place
of the pyfits class.
\end{quote}
\begin{description}
\item[{@param ext: The rest of the arguments are for extension specification.}] \leavevmode
See L\{getdata\} for explanations/examples.
\end{description}
@return: keyword value
@rtype: string, integer, or float
\end{fulllineitems}
\index{info() (in module pNbody.pyfits)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.info}\pysiglinewithargsret{\code{pNbody.pyfits.}\bfcode{info}}{\emph{filename}, \emph{classExtensions=\{\}}}{}
Print the summary information on a FITS file.
This includes the name, type, length of header, data shape and type
for each extension.
@type filename: string
@param filename: input FITS file name
@type classExtensions: dictionary
@param classExtensions: A dictionary that maps pyfits classes to
\begin{quote}
extensions of those classes. When present in
the dictionary, the extension class will be
constructed in place of the pyfits class.
\end{quote}
\end{fulllineitems}
\index{new\_table() (in module pNbody.pyfits)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.new_table}\pysiglinewithargsret{\code{pNbody.pyfits.}\bfcode{new\_table}}{\emph{input}, \emph{header=None}, \emph{nrows=0}, \emph{fill=0}, \emph{tbtype='BinTableHDU'}}{}
Create a new table from the input column definitions.
\end{fulllineitems}
\index{open() (in module pNbody.pyfits)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.open}\pysiglinewithargsret{\code{pNbody.pyfits.}\bfcode{open}}{\emph{name}, \emph{mode='copyonwrite'}, \emph{memmap=0}, \emph{classExtensions=\{\}}}{}
Factory function to open a FITS file and return an HDUList object.
name: Name of the FITS file to be opened or already opened file object.
mode: Open mode, `readonly' (default), `update', or `append'.
memmap: Is memmory mapping to be used? default=0.
classExtensions: A dictionary that maps pyfits classes to extensions of
\begin{quote}
those classes. When present in the dictionary, the
extension class will be constructed in place of the
pyfits class.
\end{quote}
\end{fulllineitems}
\index{update() (in module pNbody.pyfits)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.update}\pysiglinewithargsret{\code{pNbody.pyfits.}\bfcode{update}}{\emph{filename}, \emph{data}, \emph{*ext}, \emph{**extkeys}}{}
Update the specified extension with the input data/header.
@type filename: string
@param filename: name of the file to be updated
data: the new data used for updating
@keyword classExtensions: (optional) A dictionary that maps pyfits
\begin{quote}
classes to extensions of those classes. When present in the
dictionary, the extension class will be constructed in place
of the pyfits class.
\end{quote}
The rest of the arguments are flexible:
the 3rd argument can be the header associated with the data.
If the 3rd argument is not a header, it (and other positional
arguments) are assumed to be the extension specification(s).
Header and extension specs can also be keyword arguments.
For example:
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{update}\PYG{p}{(}\PYG{n+nb}{file}\PYG{p}{,} \PYG{n}{dat}\PYG{p}{,} \PYG{n}{hdr}\PYG{p}{,} \PYG{l+s}{'}\PYG{l+s}{sci}\PYG{l+s}{'}\PYG{p}{)} \PYG{c}{\# update the 'sci' extension}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{update}\PYG{p}{(}\PYG{n+nb}{file}\PYG{p}{,} \PYG{n}{dat}\PYG{p}{,} \PYG{l+m+mi}{3}\PYG{p}{)} \PYG{c}{\# update the 3rd extension}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{update}\PYG{p}{(}\PYG{n+nb}{file}\PYG{p}{,} \PYG{n}{dat}\PYG{p}{,} \PYG{n}{hdr}\PYG{p}{,} \PYG{l+m+mi}{3}\PYG{p}{)} \PYG{c}{\# update the 3rd extension}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{update}\PYG{p}{(}\PYG{n+nb}{file}\PYG{p}{,} \PYG{n}{dat}\PYG{p}{,} \PYG{l+s}{'}\PYG{l+s}{sci}\PYG{l+s}{'}\PYG{p}{,} \PYG{l+m+mi}{2}\PYG{p}{)} \PYG{c}{\# update the 2nd SCI extension}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{update}\PYG{p}{(}\PYG{n+nb}{file}\PYG{p}{,} \PYG{n}{dat}\PYG{p}{,} \PYG{l+m+mi}{3}\PYG{p}{,} \PYG{n}{header}\PYG{o}{=}\PYG{n}{hdr}\PYG{p}{)} \PYG{c}{\# update the 3rd extension}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{update}\PYG{p}{(}\PYG{n+nb}{file}\PYG{p}{,} \PYG{n}{dat}\PYG{p}{,} \PYG{n}{header}\PYG{o}{=}\PYG{n}{hdr}\PYG{p}{,} \PYG{n}{ext}\PYG{o}{=}\PYG{l+m+mi}{5}\PYG{p}{)} \PYG{c}{\# update the 5th extension}
\end{Verbatim}
\end{fulllineitems}
\index{writeto() (in module pNbody.pyfits)}
\begin{fulllineitems}
\phantomsection\label{rst/PyfitsModule:pNbody.pyfits.writeto}\pysiglinewithargsret{\code{pNbody.pyfits.}\bfcode{writeto}}{\emph{filename}, \emph{data}, \emph{header=None}, \emph{**keys}}{}
Create a new FITS file using the supplied data/header.
@type filename: string
@param filename: name of the new FITS file to write to
@type data: array, record array, or groups data object
@param data: data to write to the new file
@type header: L\{Header\} object or None
@param header: the header associated with `data', if None, a
\begin{quote}
header of the appropriate type is created for the supplied
data. This argument is optional.
\end{quote}
\begin{description}
\item[{@keyword classExtensions: (optional) A dictionary that maps pyfits }] \leavevmode
classes to extensions of those classes. When present in the
dictionary, the extension class will be constructed in place
of the pyfits class.
\item[{@keyword clobber: (optional) if True and if filename already exists, it}] \leavevmode
will overwrite the file. Default is False.
\end{description}
\end{fulllineitems}
\section{the rec module}
\label{rst/RecModule:module-pNbody.rec}\label{rst/RecModule:the-rec-module}\label{rst/RecModule::doc}\index{pNbody.rec (module)}
\section{the libqt module}
\label{rst/LibqtModule:module-pNbody.libqt}\label{rst/LibqtModule::doc}\label{rst/LibqtModule:the-libqt-module}\index{pNbody.libqt (module)}\index{QNumarrayImage (class in pNbody.libqt)}
\begin{fulllineitems}
\phantomsection\label{rst/LibqtModule:pNbody.libqt.QNumarrayImage}\pysiglinewithargsret{\strong{class }\code{pNbody.libqt.}\bfcode{QNumarrayImage}}{\emph{data}, \emph{palette\_name}}{}
QNumarrayImage class
\paragraph{Methods}
\end{fulllineitems}
\index{display() (in module pNbody.libqt)}
\begin{fulllineitems}
\phantomsection\label{rst/LibqtModule:pNbody.libqt.display}\pysiglinewithargsret{\code{pNbody.libqt.}\bfcode{display}}{\emph{imagePIL}}{}
display a PIL image
\end{fulllineitems}
\index{qtplot() (in module pNbody.libqt)}
\begin{fulllineitems}
\phantomsection\label{rst/LibqtModule:pNbody.libqt.qtplot}\pysiglinewithargsret{\code{pNbody.libqt.}\bfcode{qtplot}}{\emph{mat}, \emph{palette='light'}}{}
plot a matrix using qt
\end{fulllineitems}
\section{the fortranfile module}
\label{rst/FortranfileModule:module-pNbody.fortranfile}\label{rst/FortranfileModule:the-fortranfile-module}\label{rst/FortranfileModule::doc}\index{pNbody.fortranfile (module)}
Defines a file-derived class to read/write Fortran unformatted files.
The assumption is that a Fortran unformatted file is being written by
the Fortran runtime as a sequence of records. Each record consists of
an integer (of the default size {[}usually 32 or 64 bits{]}) giving the
length of the following data in bytes, then the data itself, then the
same integer as before.
\subsection{Examples}
\label{rst/FortranfileModule:examples}\begin{description}
\item[{To use the default endian and precision settings, one can just do::}] \leavevmode
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{f} \PYG{o}{=} \PYG{n}{FortranFile}\PYG{p}{(}\PYG{l+s}{'}\PYG{l+s}{filename}\PYG{l+s}{'}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{x} \PYG{o}{=} \PYG{n}{f}\PYG{o}{.}\PYG{n}{readReals}\PYG{p}{(}\PYG{p}{)}
\end{Verbatim}
\item[{One can read arrays with varying precisions::}] \leavevmode
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{f} \PYG{o}{=} \PYG{n}{FortranFile}\PYG{p}{(}\PYG{l+s}{'}\PYG{l+s}{filename}\PYG{l+s}{'}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{x} \PYG{o}{=} \PYG{n}{f}\PYG{o}{.}\PYG{n}{readInts}\PYG{p}{(}\PYG{l+s}{'}\PYG{l+s}{h}\PYG{l+s}{'}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{y} \PYG{o}{=} \PYG{n}{f}\PYG{o}{.}\PYG{n}{readInts}\PYG{p}{(}\PYG{l+s}{'}\PYG{l+s}{q}\PYG{l+s}{'}\PYG{p}{)}
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{z} \PYG{o}{=} \PYG{n}{f}\PYG{o}{.}\PYG{n}{readReals}\PYG{p}{(}\PYG{l+s}{'}\PYG{l+s}{f}\PYG{l+s}{'}\PYG{p}{)}
\end{Verbatim}
\end{description}
Where the format codes are those used by Python's struct module.
\begin{description}
\item[{One can change the default endian-ness and header precision::}] \leavevmode
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\textgreater{}\textgreater{}\textgreater{} }\PYG{n}{f} \PYG{o}{=} \PYG{n}{FortranFile}\PYG{p}{(}\PYG{l+s}{'}\PYG{l+s}{filename}\PYG{l+s}{'}\PYG{p}{,} \PYG{n}{endian}\PYG{o}{=}\PYG{l+s}{'}\PYG{l+s}{\textgreater{}}\PYG{l+s}{'}\PYG{p}{,} \PYG{n}{header\PYGZus{}prec}\PYG{o}{=}\PYG{l+s}{'}\PYG{l+s}{l}\PYG{l+s}{'}\PYG{p}{)}
\end{Verbatim}
\end{description}
for a file with little-endian data whose record headers are long
integers.
\index{FortranFile (class in pNbody.fortranfile)}
\begin{fulllineitems}
\phantomsection\label{rst/FortranfileModule:pNbody.fortranfile.FortranFile}\pysiglinewithargsret{\strong{class }\code{pNbody.fortranfile.}\bfcode{FortranFile}}{\emph{fname}, \emph{endian='@'}, \emph{header\_prec='i'}, \emph{*args}, \emph{**kwargs}}{}
File with methods for dealing with fortran unformatted data files
\paragraph{Methods}
\index{ENDIAN (pNbody.fortranfile.FortranFile attribute)}
\begin{fulllineitems}
\phantomsection\label{rst/FortranfileModule:pNbody.fortranfile.FortranFile.ENDIAN}\pysigline{\bfcode{ENDIAN}}{}
Possible endian values are `\textless{}', `\textgreater{}', `@', `='
\end{fulllineitems}
\index{HEADER\_PREC (pNbody.fortranfile.FortranFile attribute)}
\begin{fulllineitems}
\phantomsection\label{rst/FortranfileModule:pNbody.fortranfile.FortranFile.HEADER_PREC}\pysigline{\bfcode{HEADER\_PREC}}{}
Possible header precisions are `h', `i', `l', `q'
\end{fulllineitems}
\index{readInts() (pNbody.fortranfile.FortranFile method)}
\begin{fulllineitems}
\phantomsection\label{rst/FortranfileModule:pNbody.fortranfile.FortranFile.readInts}\pysiglinewithargsret{\bfcode{readInts}}{\emph{prec='i'}}{}
Read an array of integers.
\begin{quote}\begin{description}
\item[{Parameters }] \leavevmode
\textbf{prec} : character, optional
\begin{quote}
Specify the precision of the data to be read using
character codes from Python's struct module. Possible
values are `h', `i', `l' and `q'
\end{quote}
\end{description}\end{quote}
\end{fulllineitems}
\index{readReals() (pNbody.fortranfile.FortranFile method)}
\begin{fulllineitems}
\phantomsection\label{rst/FortranfileModule:pNbody.fortranfile.FortranFile.readReals}\pysiglinewithargsret{\bfcode{readReals}}{\emph{prec='f'}}{}
Read in an array of real numbers.
\begin{quote}\begin{description}
\item[{Parameters }] \leavevmode
\textbf{prec} : character, optional
\begin{quote}
Specify the precision of the array using character codes from
Python's struct module. Possible values are `d' and `f'.
\end{quote}
\end{description}\end{quote}
\end{fulllineitems}
\index{readRecord() (pNbody.fortranfile.FortranFile method)}
\begin{fulllineitems}
\phantomsection\label{rst/FortranfileModule:pNbody.fortranfile.FortranFile.readRecord}\pysiglinewithargsret{\bfcode{readRecord}}{}{}
Read a single fortran record
\end{fulllineitems}
\index{readString() (pNbody.fortranfile.FortranFile method)}
\begin{fulllineitems}
\phantomsection\label{rst/FortranfileModule:pNbody.fortranfile.FortranFile.readString}\pysiglinewithargsret{\bfcode{readString}}{}{}
Read a string.
\end{fulllineitems}
\index{writeInts() (pNbody.fortranfile.FortranFile method)}
\begin{fulllineitems}
\phantomsection\label{rst/FortranfileModule:pNbody.fortranfile.FortranFile.writeInts}\pysiglinewithargsret{\bfcode{writeInts}}{\emph{ints}, \emph{prec='i'}}{}
Write an array of integers in given precision
\begin{quote}\begin{description}
\item[{Parameters }] \leavevmode
\textbf{reals} : array
\begin{quote}
Data to write
\end{quote}
\textbf{prec} : string
\begin{quote}
Character code for the precision to use in writing
\end{quote}
\end{description}\end{quote}
\end{fulllineitems}
\index{writeReals() (pNbody.fortranfile.FortranFile method)}
\begin{fulllineitems}
\phantomsection\label{rst/FortranfileModule:pNbody.fortranfile.FortranFile.writeReals}\pysiglinewithargsret{\bfcode{writeReals}}{\emph{reals}, \emph{prec='f'}}{}
Write an array of floats in given precision
\begin{quote}\begin{description}
\item[{Parameters }] \leavevmode
\textbf{reals} : array
\begin{quote}
Data to write
\end{quote}
\textbf{prec{}`} : string
\begin{quote}
Character code for the precision to use in writing
\end{quote}
\end{description}\end{quote}
\end{fulllineitems}
\index{writeRecord() (pNbody.fortranfile.FortranFile method)}
\begin{fulllineitems}
\phantomsection\label{rst/FortranfileModule:pNbody.fortranfile.FortranFile.writeRecord}\pysiglinewithargsret{\bfcode{writeRecord}}{\emph{s}}{}
Write a record with the given bytes.
\begin{quote}\begin{description}
\item[{Parameters }] \leavevmode
\textbf{s} : the string to write
\end{description}\end{quote}
\end{fulllineitems}
\index{writeString() (pNbody.fortranfile.FortranFile method)}
\begin{fulllineitems}
\phantomsection\label{rst/FortranfileModule:pNbody.fortranfile.FortranFile.writeString}\pysiglinewithargsret{\bfcode{writeString}}{\emph{s}}{}
Write a string
\begin{quote}\begin{description}
\item[{Parameters }] \leavevmode
\textbf{s} : the string to write
\end{description}\end{quote}
\end{fulllineitems}
\end{fulllineitems}
\section{the palette module}
\label{rst/PaletteModule:the-palette-module}\label{rst/PaletteModule::doc}\label{rst/PaletteModule:module-pNbody.palette}\index{pNbody.palette (module)}
this module is used to deal with color palettes.
\index{readlut() (in module pNbody.palette)}
\begin{fulllineitems}
\phantomsection\label{rst/PaletteModule:pNbody.palette.readlut}\pysiglinewithargsret{\code{pNbody.palette.}\bfcode{readlut}}{\emph{filename='/home/epfl/revaz/.pNbody/rgb\_tables/light'}}{}
Read a lut file.
\end{fulllineitems}
\section{the Movie module}
\label{rst/MovieModule::doc}\label{rst/MovieModule:module-pNbody.Movie}\label{rst/MovieModule:the-movie-module}\index{pNbody.Movie (module)}\index{Movie (class in pNbody.Movie)}
\begin{fulllineitems}
\phantomsection\label{rst/MovieModule:pNbody.Movie.Movie}\pysiglinewithargsret{\strong{class }\code{pNbody.Movie.}\bfcode{Movie}}{\emph{name}, \emph{mode=None}}{}
a Movie class
\paragraph{Methods}
\index{get\_img() (pNbody.Movie.Movie method)}
\begin{fulllineitems}
\phantomsection\label{rst/MovieModule:pNbody.Movie.Movie.get_img}\pysiglinewithargsret{\bfcode{get\_img}}{\emph{data}}{}
can be replaced by read\_one with option ``image''
\end{fulllineitems}
\index{info() (pNbody.Movie.Movie method)}
\begin{fulllineitems}
\phantomsection\label{rst/MovieModule:pNbody.Movie.Movie.info}\pysiglinewithargsret{\bfcode{info}}{}{}
give info
\end{fulllineitems}
\index{open() (pNbody.Movie.Movie method)}
\begin{fulllineitems}
\phantomsection\label{rst/MovieModule:pNbody.Movie.Movie.open}\pysiglinewithargsret{\bfcode{open}}{\emph{mode='r'}, \emph{readall=0}}{}
open a file
\end{fulllineitems}
\index{read() (pNbody.Movie.Movie method)}
\begin{fulllineitems}
\phantomsection\label{rst/MovieModule:pNbody.Movie.Movie.read}\pysiglinewithargsret{\bfcode{read}}{\emph{skip=0}, \emph{mode='array'}}{}
skip = 0 : read image at the current position
skip = 1 : skip an image
skip = -1 : read the image before (go back)
skip = -2 : skip an image before (go back)
\end{fulllineitems}
\end{fulllineitems}
\section{the profiles module}
\label{rst/ProfilesModule:module-pNbody.profiles}\label{rst/ProfilesModule::doc}\label{rst/ProfilesModule:the-profiles-module}\index{pNbody.profiles (module)}\index{burkert\_mr() (in module pNbody.profiles)}
\begin{fulllineitems}
\phantomsection\label{rst/ProfilesModule:pNbody.profiles.burkert_mr}\pysiglinewithargsret{\code{pNbody.profiles.}\bfcode{burkert\_mr}}{\emph{r}, \emph{rs}, \emph{rho0=1.0}}{}
Burkert profile
rhob = rho0 / ( ( 1 + r/rs ) * ( 1 + (r/rs)**2 ) )
\begin{enumerate}
\item {}
Burkert, Astrophys. J. 447 (1995) L25.
\end{enumerate}
\end{fulllineitems}
\index{burkert\_profile() (in module pNbody.profiles)}
\begin{fulllineitems}
\phantomsection\label{rst/ProfilesModule:pNbody.profiles.burkert_profile}\pysiglinewithargsret{\code{pNbody.profiles.}\bfcode{burkert\_profile}}{\emph{r}, \emph{rs}, \emph{rho0=1.0}}{}
Burkert profile
rhob = rho0 / ( ( 1 + r/rs ) * ( 1 + (r/rs)**2 ) )
\begin{enumerate}
\item {}
Burkert, Astrophys. J. 447 (1995) L25.
\end{enumerate}
\end{fulllineitems}
\index{generic2c\_mr() (in module pNbody.profiles)}
\begin{fulllineitems}
\phantomsection\label{rst/ProfilesModule:pNbody.profiles.generic2c_mr}\pysiglinewithargsret{\code{pNbody.profiles.}\bfcode{generic2c\_mr}}{\emph{r}, \emph{rs}, \emph{a}, \emph{b}, \emph{rho0=1.0}}{}
Mass in the radius r for the distribution
rho = 1/( (r/rs)**a * (1+r/rs)**(b-a) )
\end{fulllineitems}
\index{generic2c\_profile() (in module pNbody.profiles)}
\begin{fulllineitems}
\phantomsection\label{rst/ProfilesModule:pNbody.profiles.generic2c_profile}\pysiglinewithargsret{\code{pNbody.profiles.}\bfcode{generic2c\_profile}}{\emph{r}, \emph{rs}, \emph{a}, \emph{b}, \emph{rho0=1.0}}{}
generic2c profile
rho = 1/( (r/rs)**a * (1+r/rs)**(b-a) )
\end{fulllineitems}
\index{hernquist\_mR() (in module pNbody.profiles)}
\begin{fulllineitems}
\phantomsection\label{rst/ProfilesModule:pNbody.profiles.hernquist_mR}\pysiglinewithargsret{\code{pNbody.profiles.}\bfcode{hernquist\_mR}}{\emph{R}, \emph{rs}, \emph{rho0=1}}{}
Mass in the projected radius R for the distribution
rho = 1/( (r/rs) * (1+r/rs)**3 )
(Hernquist 90, Eq. 37)
Warning : the function diverges in r=0 and r/rs=1.
Warning : it is badly implemented for arrays
\end{fulllineitems}
\index{hernquist\_mr() (in module pNbody.profiles)}
\begin{fulllineitems}
\phantomsection\label{rst/ProfilesModule:pNbody.profiles.hernquist_mr}\pysiglinewithargsret{\code{pNbody.profiles.}\bfcode{hernquist\_mr}}{\emph{r}, \emph{rs}, \emph{rho0=1.0}}{}
Mass in the radius r for the distribution
rho = 1/( (r/rs) * (1+r/rs)**3 )
\end{fulllineitems}
\index{hernquist\_profile() (in module pNbody.profiles)}
\begin{fulllineitems}
\phantomsection\label{rst/ProfilesModule:pNbody.profiles.hernquist_profile}\pysiglinewithargsret{\code{pNbody.profiles.}\bfcode{hernquist\_profile}}{\emph{r}, \emph{rs}, \emph{rho0=1.0}}{}
hernquist profile
rho = 1/( (r/rs) * (1+r/rs)**3 )
\end{fulllineitems}
\index{jaffe\_mr() (in module pNbody.profiles)}
\begin{fulllineitems}
\phantomsection\label{rst/ProfilesModule:pNbody.profiles.jaffe_mr}\pysiglinewithargsret{\code{pNbody.profiles.}\bfcode{jaffe\_mr}}{\emph{r}, \emph{rs}, \emph{rho0=1.0}}{}
Mass in the radius r for the distribution
rho = 1/( (r/rs)**2 * (1+r/rs)**2 )
\end{fulllineitems}
\index{jaffe\_profile() (in module pNbody.profiles)}
\begin{fulllineitems}
\phantomsection\label{rst/ProfilesModule:pNbody.profiles.jaffe_profile}\pysiglinewithargsret{\code{pNbody.profiles.}\bfcode{jaffe\_profile}}{\emph{r}, \emph{rs}, \emph{rho0=1.0}}{}
jaffe profile
rho = 1/( (r/rs)**2 * (1+r/rs)**2 )
\end{fulllineitems}
\index{king\_Rc() (in module pNbody.profiles)}
\begin{fulllineitems}
\phantomsection\label{rst/ProfilesModule:pNbody.profiles.king_Rc}\pysiglinewithargsret{\code{pNbody.profiles.}\bfcode{king\_Rc}}{\emph{rs}, \emph{rt}}{}
Core radius
Find R such that
Sigma(Rc) = Sigma(0)/2.
\end{fulllineitems}
\index{king\_profile() (in module pNbody.profiles)}
\begin{fulllineitems}
\phantomsection\label{rst/ProfilesModule:pNbody.profiles.king_profile}\pysiglinewithargsret{\code{pNbody.profiles.}\bfcode{king\_profile}}{\emph{r}, \emph{rs}, \emph{rt}}{}
King profile
(see King 62)
\end{fulllineitems}
\index{king\_profile\_Rz() (in module pNbody.profiles)}
\begin{fulllineitems}
\phantomsection\label{rst/ProfilesModule:pNbody.profiles.king_profile_Rz}\pysiglinewithargsret{\code{pNbody.profiles.}\bfcode{king\_profile\_Rz}}{\emph{R}, \emph{z}, \emph{rs}, \emph{rt}}{}
King profile in cyclindrical coord (needed for surface density computation)
(see King 62)
\end{fulllineitems}
\index{king\_surface\_density() (in module pNbody.profiles)}
\begin{fulllineitems}
\phantomsection\label{rst/ProfilesModule:pNbody.profiles.king_surface_density}\pysiglinewithargsret{\code{pNbody.profiles.}\bfcode{king\_surface\_density}}{\emph{R}, \emph{rs}, \emph{rt}}{}
Surface density of King profile
(see King 62)
\end{fulllineitems}
\index{king\_surface\_density\_old() (in module pNbody.profiles)}
\begin{fulllineitems}
\phantomsection\label{rst/ProfilesModule:pNbody.profiles.king_surface_density_old}\pysiglinewithargsret{\code{pNbody.profiles.}\bfcode{king\_surface\_density\_old}}{\emph{R}, \emph{rs}, \emph{rt}}{}
Obsolete implementation
\end{fulllineitems}
\index{nfw\_mr() (in module pNbody.profiles)}
\begin{fulllineitems}
\phantomsection\label{rst/ProfilesModule:pNbody.profiles.nfw_mr}\pysiglinewithargsret{\code{pNbody.profiles.}\bfcode{nfw\_mr}}{\emph{r}, \emph{rs}, \emph{rho0=1.0}}{}
Mass in the radius r for the distribution
rho = rho0/((r/rs)*(1+r/rs)**2)
\end{fulllineitems}
\index{nfw\_profile() (in module pNbody.profiles)}
\begin{fulllineitems}
\phantomsection\label{rst/ProfilesModule:pNbody.profiles.nfw_profile}\pysiglinewithargsret{\code{pNbody.profiles.}\bfcode{nfw\_profile}}{\emph{r}, \emph{rs}, \emph{rho0=1.0}}{}
NFW profile
rho = rho0/((r/rs)*(1+r/rs)**2)
\end{fulllineitems}
\index{nfwg\_mr() (in module pNbody.profiles)}
\begin{fulllineitems}
\phantomsection\label{rst/ProfilesModule:pNbody.profiles.nfwg_mr}\pysiglinewithargsret{\code{pNbody.profiles.}\bfcode{nfwg\_mr}}{\emph{r}, \emph{rs}, \emph{gamma}, \emph{rho0=1.0}}{}
Mass in the radius r for the distribution
rho = rho0/((r/rs)**(gamma)*(1+(r/rs)**2)**(0.5*(3.-gamma)))
\end{fulllineitems}
\index{nfwg\_profile() (in module pNbody.profiles)}
\begin{fulllineitems}
\phantomsection\label{rst/ProfilesModule:pNbody.profiles.nfwg_profile}\pysiglinewithargsret{\code{pNbody.profiles.}\bfcode{nfwg\_profile}}{\emph{r}, \emph{rs}, \emph{gamma}, \emph{rho0=1.0}}{}
NFW modified profile
rho = rho0/((r/rs)**(gamma)*(1+(r/rs)**2)**(0.5*(3.-gamma)))
\end{fulllineitems}
\index{nfws\_mr() (in module pNbody.profiles)}
\begin{fulllineitems}
\phantomsection\label{rst/ProfilesModule:pNbody.profiles.nfws_mr}\pysiglinewithargsret{\code{pNbody.profiles.}\bfcode{nfws\_mr}}{\emph{r}, \emph{rhos}, \emph{rs}, \emph{r0}}{}
Mass in the radius r for the distribution
rho = rhos/((r/rs)*(1+r/rs)**2)
\end{fulllineitems}
\index{nfws\_profile() (in module pNbody.profiles)}
\begin{fulllineitems}
\phantomsection\label{rst/ProfilesModule:pNbody.profiles.nfws_profile}\pysiglinewithargsret{\code{pNbody.profiles.}\bfcode{nfws\_profile}}{\emph{r}, \emph{rhos}, \emph{rs}, \emph{r0}}{}
NFW softened profile
rho = rhos/(((r+r0)/rs)*(1+r/rs)**2)
\end{fulllineitems}
\index{pisothm\_mr() (in module pNbody.profiles)}
\begin{fulllineitems}
\phantomsection\label{rst/ProfilesModule:pNbody.profiles.pisothm_mr}\pysiglinewithargsret{\code{pNbody.profiles.}\bfcode{pisothm\_mr}}{\emph{r}, \emph{rs}, \emph{rho0=1.0}}{}
Mass in the radius r for the distribution
rho = 1/(1+(r/rs)**2)
\end{fulllineitems}
\index{pisothm\_profile() (in module pNbody.profiles)}
\begin{fulllineitems}
\phantomsection\label{rst/ProfilesModule:pNbody.profiles.pisothm_profile}\pysiglinewithargsret{\code{pNbody.profiles.}\bfcode{pisothm\_profile}}{\emph{r}, \emph{rs}, \emph{rho0=1.0}}{}
Pseudo-isothermal profile
rho = 1/(1+(r/rs)**2)
\end{fulllineitems}
\index{plummer\_mr() (in module pNbody.profiles)}
\begin{fulllineitems}
\phantomsection\label{rst/ProfilesModule:pNbody.profiles.plummer_mr}\pysiglinewithargsret{\code{pNbody.profiles.}\bfcode{plummer\_mr}}{\emph{r}, \emph{rc}, \emph{rho0=1.0}}{}
Mass in the radius r for the distribution
rho = 1/(1+(r/rc)**2)**(5/2)
\end{fulllineitems}
\index{plummer\_profile() (in module pNbody.profiles)}
\begin{fulllineitems}
\phantomsection\label{rst/ProfilesModule:pNbody.profiles.plummer_profile}\pysiglinewithargsret{\code{pNbody.profiles.}\bfcode{plummer\_profile}}{\emph{r}, \emph{rc}, \emph{rho0=1.0}}{}
Plummer profile
rho = 1/(1+(r/rc)**2)**(5/2)
\end{fulllineitems}
\section{the geometry module}
\label{rst/GeometryModule:the-geometry-module}\label{rst/GeometryModule::doc}\label{rst/GeometryModule:module-pNbody.geometry}\index{pNbody.geometry (module)}\index{align() (in module pNbody.geometry)}
\begin{fulllineitems}
\phantomsection\label{rst/GeometryModule:pNbody.geometry.align}\pysiglinewithargsret{\code{pNbody.geometry.}\bfcode{align}}{\emph{x, axis1={[}1, 0, 0{]}, axis2={[}0, 0, 1{]}, point={[}0, 0, 0{]}}}{}
Rotate the object around point in order to align the axis `axis1' with the axis `axis2'.
axis1 : {[}x,y,z{]}
axis2 : {[}x,y,z{]}
\end{fulllineitems}
\index{boxcut() (in module pNbody.geometry)}
\begin{fulllineitems}
\phantomsection\label{rst/GeometryModule:pNbody.geometry.boxcut}\pysiglinewithargsret{\code{pNbody.geometry.}\bfcode{boxcut}}{\emph{pos}, \emph{args}}{}
Return only particles that are inside box 1:1:1
\end{fulllineitems}
\index{boxcut\_segments() (in module pNbody.geometry)}
\begin{fulllineitems}
\phantomsection\label{rst/GeometryModule:pNbody.geometry.boxcut_segments}\pysiglinewithargsret{\code{pNbody.geometry.}\bfcode{boxcut\_segments}}{\emph{pos}, \emph{args}}{}
Return only particles that are inside box 1:1:1
\end{fulllineitems}
\index{expose() (in module pNbody.geometry)}
\begin{fulllineitems}
\phantomsection\label{rst/GeometryModule:pNbody.geometry.expose}\pysiglinewithargsret{\code{pNbody.geometry.}\bfcode{expose}}{\emph{obj}, \emph{obs}, \emph{eye=None}, \emph{dist\_eye=None}, \emph{foc=None}}{}
Rotate and translate the object in order to be seen as if the
observer was in x0, looking at a point in xp.
obj : object array to expose
obs : representation of the observer
eye : `right' or `left'
dist\_eye : distance between eyes (separation = angle))
foc : focal
\end{fulllineitems}
\index{frustum() (in module pNbody.geometry)}
\begin{fulllineitems}
\phantomsection\label{rst/GeometryModule:pNbody.geometry.frustum}\pysiglinewithargsret{\code{pNbody.geometry.}\bfcode{frustum}}{\emph{pos}, \emph{clip}, \emph{size}}{}
Project using a frustrum matrix
clip = near and far planes
size = size of the box
\end{fulllineitems}
\index{get\_obs() (in module pNbody.geometry)}
\begin{fulllineitems}
\phantomsection\label{rst/GeometryModule:pNbody.geometry.get_obs}\pysiglinewithargsret{\code{pNbody.geometry.}\bfcode{get\_obs}}{\emph{x0={[}0.0, -50.0, 0.0{]}, xp={[}0.0, 0.0, 0.0{]}, alpha=0, view='xz', r\_obs=50}}{}
From some parameters, return an obs matrix
\begin{quote}
x0,xp,alpha
\end{quote}
\begin{description}
\item[{or}] \leavevmode
xz
\end{description}
\end{fulllineitems}
\index{inv\_viewport() (in module pNbody.geometry)}
\begin{fulllineitems}
\phantomsection\label{rst/GeometryModule:pNbody.geometry.inv_viewport}\pysiglinewithargsret{\code{pNbody.geometry.}\bfcode{inv\_viewport}}{\emph{xw}, \emph{yw}, \emph{zw}, \emph{shape}}{}
viewport transformation
xn = position (output from frustum or ortho)
shape = shape of the image
\end{fulllineitems}
\index{norm() (in module pNbody.geometry)}
\begin{fulllineitems}
\phantomsection\label{rst/GeometryModule:pNbody.geometry.norm}\pysiglinewithargsret{\code{pNbody.geometry.}\bfcode{norm}}{\emph{x}}{}
return the norm of vector x
\end{fulllineitems}
\index{ortho() (in module pNbody.geometry)}
\begin{fulllineitems}
\phantomsection\label{rst/GeometryModule:pNbody.geometry.ortho}\pysiglinewithargsret{\code{pNbody.geometry.}\bfcode{ortho}}{\emph{pos}, \emph{clip}, \emph{size}}{}
Project using an ortho matrix
clip = near and far planes
size = size of the box
\end{fulllineitems}
\index{perspective() (in module pNbody.geometry)}
\begin{fulllineitems}
\phantomsection\label{rst/GeometryModule:pNbody.geometry.perspective}\pysiglinewithargsret{\code{pNbody.geometry.}\bfcode{perspective}}{\emph{r\_obs=100.0}, \emph{foc=50.0}, \emph{view='xz'}}{}
Project the N-body model in order to get a perspective view.
r\_obs = distance of the observer to the looking point
foc = focal
view = `xz' , `xy' , `yz'
\end{fulllineitems}
\index{rotate() (in module pNbody.geometry)}
\begin{fulllineitems}
\phantomsection\label{rst/GeometryModule:pNbody.geometry.rotate}\pysiglinewithargsret{\code{pNbody.geometry.}\bfcode{rotate}}{\emph{x, angle=0, axis={[}1, 0, 0{]}, point={[}0, 0, 0{]}}}{}
Rotate the positions and/or the velocities of the object around a specific axis
with respect to a specific point
angle : rotation angle in radian
axis : {[}x,y,z{]} : around this axis
point : {[}x,y,z{]} : rotation origin
use the euler rotation matrix
\end{fulllineitems}
\index{viewport() (in module pNbody.geometry)}
\begin{fulllineitems}
\phantomsection\label{rst/GeometryModule:pNbody.geometry.viewport}\pysiglinewithargsret{\code{pNbody.geometry.}\bfcode{viewport}}{\emph{xn}, \emph{shape=None}}{}
viewport transformation
xn = position (output from frustum or ortho)
shape = shape of the image
\end{fulllineitems}
\section{the libmiyamoto module}
\label{rst/LibmiyamotoModule::doc}\label{rst/LibmiyamotoModule:module-pNbody.libmiyamoto}\label{rst/LibmiyamotoModule:the-libmiyamoto-module}\index{pNbody.libmiyamoto (module)}\index{Density() (in module pNbody.libmiyamoto)}
\begin{fulllineitems}
\phantomsection\label{rst/LibmiyamotoModule:pNbody.libmiyamoto.Density}\pysiglinewithargsret{\code{pNbody.libmiyamoto.}\bfcode{Density}}{\emph{G}, \emph{M}, \emph{a}, \emph{b}, \emph{R}, \emph{z}}{}
Miyamoto-Nagai Density
\end{fulllineitems}
\index{Kappa() (in module pNbody.libmiyamoto)}
\begin{fulllineitems}
\phantomsection\label{rst/LibmiyamotoModule:pNbody.libmiyamoto.Kappa}\pysiglinewithargsret{\code{pNbody.libmiyamoto.}\bfcode{Kappa}}{\emph{G}, \emph{M}, \emph{a}, \emph{b}, \emph{R}}{}
Miyamoto-Nagai Kappa
\end{fulllineitems}
\index{Omega() (in module pNbody.libmiyamoto)}
\begin{fulllineitems}
\phantomsection\label{rst/LibmiyamotoModule:pNbody.libmiyamoto.Omega}\pysiglinewithargsret{\code{pNbody.libmiyamoto.}\bfcode{Omega}}{\emph{G}, \emph{M}, \emph{a}, \emph{b}, \emph{R}}{}
Miyamoto-Nagai Omega
\end{fulllineitems}
\index{Potential() (in module pNbody.libmiyamoto)}
\begin{fulllineitems}
\phantomsection\label{rst/LibmiyamotoModule:pNbody.libmiyamoto.Potential}\pysiglinewithargsret{\code{pNbody.libmiyamoto.}\bfcode{Potential}}{\emph{G}, \emph{M}, \emph{a}, \emph{b}, \emph{R}, \emph{z}}{}
Miyamoto-Nagai Potential
\end{fulllineitems}
\index{Sigma\_t() (in module pNbody.libmiyamoto)}
\begin{fulllineitems}
\phantomsection\label{rst/LibmiyamotoModule:pNbody.libmiyamoto.Sigma_t}\pysiglinewithargsret{\code{pNbody.libmiyamoto.}\bfcode{Sigma\_t}}{\emph{G}, \emph{M}, \emph{a}, \emph{b}, \emph{R}, \emph{z}}{}
Return sigma\_z from Jeans equation : 1/rho Int( rho * dzPhi * dz )
sigma\_t\textasciicircum{}2 = R*d/dr(Phi) + R/rho*d/dr(rho*sigma\_z\textasciicircum{}2)
\end{fulllineitems}
\index{Sigma\_z() (in module pNbody.libmiyamoto)}
\begin{fulllineitems}
\phantomsection\label{rst/LibmiyamotoModule:pNbody.libmiyamoto.Sigma_z}\pysiglinewithargsret{\code{pNbody.libmiyamoto.}\bfcode{Sigma\_z}}{\emph{G}, \emph{M}, \emph{a}, \emph{b}, \emph{R}, \emph{z}}{}
Return sigma\_z from Jeans equation : 1/rho Int( rho * dzPhi * dz )
\end{fulllineitems}
\index{Sigma\_zbis() (in module pNbody.libmiyamoto)}
\begin{fulllineitems}
\phantomsection\label{rst/LibmiyamotoModule:pNbody.libmiyamoto.Sigma_zbis}\pysiglinewithargsret{\code{pNbody.libmiyamoto.}\bfcode{Sigma\_zbis}}{\emph{G}, \emph{M}, \emph{a}, \emph{b}, \emph{R}, \emph{z}}{}
Same than Sigma\_z, but optimized
\end{fulllineitems}
\index{SurfaceDensity() (in module pNbody.libmiyamoto)}
\begin{fulllineitems}
\phantomsection\label{rst/LibmiyamotoModule:pNbody.libmiyamoto.SurfaceDensity}\pysiglinewithargsret{\code{pNbody.libmiyamoto.}\bfcode{SurfaceDensity}}{\emph{G}, \emph{M}, \emph{a}, \emph{b}, \emph{R}}{}
Miyamoto-Nagai Surface density
\end{fulllineitems}
\index{Vcirc() (in module pNbody.libmiyamoto)}
\begin{fulllineitems}
\phantomsection\label{rst/LibmiyamotoModule:pNbody.libmiyamoto.Vcirc}\pysiglinewithargsret{\code{pNbody.libmiyamoto.}\bfcode{Vcirc}}{\emph{G}, \emph{M}, \emph{a}, \emph{b}, \emph{R}}{}
Miyamoto-Nagai Circular velocity
\end{fulllineitems}
\index{d2R\_Potential() (in module pNbody.libmiyamoto)}
\begin{fulllineitems}
\phantomsection\label{rst/LibmiyamotoModule:pNbody.libmiyamoto.d2R_Potential}\pysiglinewithargsret{\code{pNbody.libmiyamoto.}\bfcode{d2R\_Potential}}{\emph{G}, \emph{M}, \emph{a}, \emph{b}, \emph{R}, \emph{z}}{}
second derivative in R
\end{fulllineitems}
\index{d2z\_Potential() (in module pNbody.libmiyamoto)}
\begin{fulllineitems}
\phantomsection\label{rst/LibmiyamotoModule:pNbody.libmiyamoto.d2z_Potential}\pysiglinewithargsret{\code{pNbody.libmiyamoto.}\bfcode{d2z\_Potential}}{\emph{G}, \emph{M}, \emph{a}, \emph{b}, \emph{R}, \emph{z}}{}
second derivative in R
\end{fulllineitems}
\index{dR\_Potential() (in module pNbody.libmiyamoto)}
\begin{fulllineitems}
\phantomsection\label{rst/LibmiyamotoModule:pNbody.libmiyamoto.dR_Potential}\pysiglinewithargsret{\code{pNbody.libmiyamoto.}\bfcode{dR\_Potential}}{\emph{G}, \emph{M}, \emph{a}, \emph{b}, \emph{R}, \emph{z}}{}
first derivative in R
\end{fulllineitems}
\index{dz\_Potential() (in module pNbody.libmiyamoto)}
\begin{fulllineitems}
\phantomsection\label{rst/LibmiyamotoModule:pNbody.libmiyamoto.dz_Potential}\pysiglinewithargsret{\code{pNbody.libmiyamoto.}\bfcode{dz\_Potential}}{\emph{G}, \emph{M}, \emph{a}, \emph{b}, \emph{R}, \emph{z}}{}
first derivative in R
\end{fulllineitems}
\section{the plummer module}
\label{rst/PlummerModule:module-pNbody.plummer}\label{rst/PlummerModule:the-plummer-module}\label{rst/PlummerModule::doc}\index{pNbody.plummer (module)}
plummer model
\index{Density() (in module pNbody.plummer)}
\begin{fulllineitems}
\phantomsection\label{rst/PlummerModule:pNbody.plummer.Density}\pysiglinewithargsret{\code{pNbody.plummer.}\bfcode{Density}}{\emph{G}, \emph{M}, \emph{a}, \emph{r}}{}
Plummer Density
\end{fulllineitems}
\index{LDensity() (in module pNbody.plummer)}
\begin{fulllineitems}
\phantomsection\label{rst/PlummerModule:pNbody.plummer.LDensity}\pysiglinewithargsret{\code{pNbody.plummer.}\bfcode{LDensity}}{\emph{G}, \emph{M}, \emph{a}, \emph{r}}{}
Plummer Linear Density
\end{fulllineitems}
\index{Potential() (in module pNbody.plummer)}
\begin{fulllineitems}
\phantomsection\label{rst/PlummerModule:pNbody.plummer.Potential}\pysiglinewithargsret{\code{pNbody.plummer.}\bfcode{Potential}}{\emph{G}, \emph{M}, \emph{a}, \emph{r}}{}
Plummer Potential
\end{fulllineitems}
\index{Sigma() (in module pNbody.plummer)}
\begin{fulllineitems}
\phantomsection\label{rst/PlummerModule:pNbody.plummer.Sigma}\pysiglinewithargsret{\code{pNbody.plummer.}\bfcode{Sigma}}{\emph{G}, \emph{M}, \emph{a}, \emph{r}}{}
Return sigma (radial) from Jeans equation : 1/rho Int( rho * drPhi * dr )
\end{fulllineitems}
\index{Vcirc() (in module pNbody.plummer)}
\begin{fulllineitems}
\phantomsection\label{rst/PlummerModule:pNbody.plummer.Vcirc}\pysiglinewithargsret{\code{pNbody.plummer.}\bfcode{Vcirc}}{\emph{G}, \emph{M}, \emph{a}, \emph{r}}{}
Plummer circular velocity
\end{fulllineitems}
\index{dPotential() (in module pNbody.plummer)}
\begin{fulllineitems}
\phantomsection\label{rst/PlummerModule:pNbody.plummer.dPotential}\pysiglinewithargsret{\code{pNbody.plummer.}\bfcode{dPotential}}{\emph{G}, \emph{M}, \emph{a}, \emph{r}}{}
Plummer first derivative of Potential
\end{fulllineitems}
\section{the libgrid module}
\label{rst/LibgridModule:module-pNbody.libgrid}\label{rst/LibgridModule:the-libgrid-module}\label{rst/LibgridModule::doc}\index{pNbody.libgrid (module)}\index{get\_AccelerationMap\_On\_Cylindrical\_2dv\_Grid() (in module pNbody.libgrid)}
\begin{fulllineitems}
\phantomsection\label{rst/LibgridModule:pNbody.libgrid.get_AccelerationMap_On_Cylindrical_2dv_Grid}\pysiglinewithargsret{\code{pNbody.libgrid.}\bfcode{get\_AccelerationMap\_On\_Cylindrical\_2dv\_Grid}}{\emph{nb}, \emph{nr}, \emph{nz}, \emph{rmax}, \emph{zmin}, \emph{zmax}, \emph{eps}, \emph{Tree=None}}{}
Return an array of points containing accelerations
\end{fulllineitems}
\index{get\_AccumulatedMassMap\_On\_Spherical\_1d\_Grid() (in module pNbody.libgrid)}
\begin{fulllineitems}
\phantomsection\label{rst/LibgridModule:pNbody.libgrid.get_AccumulatedMassMap_On_Spherical_1d_Grid}\pysiglinewithargsret{\code{pNbody.libgrid.}\bfcode{get\_AccumulatedMassMap\_On\_Spherical\_1d\_Grid}}{\emph{nb}, \emph{nr}, \emph{rmax}, \emph{f=None}, \emph{fm=None}}{}
Return an array of points containing M(r) in each cell
\end{fulllineitems}
\index{get\_Accumulation\_Along\_Axis() (in module pNbody.libgrid)}
\begin{fulllineitems}
\phantomsection\label{rst/LibgridModule:pNbody.libgrid.get_Accumulation_Along_Axis}\pysiglinewithargsret{\code{pNbody.libgrid.}\bfcode{get\_Accumulation\_Along\_Axis}}{\emph{mat}, \emph{axis=0}}{}
Accumulate values along an axis
\end{fulllineitems}
\index{get\_DensityMap\_On\_Carthesian\_3d\_Grid() (in module pNbody.libgrid)}
\begin{fulllineitems}
\phantomsection\label{rst/LibgridModule:pNbody.libgrid.get_DensityMap_On_Carthesian_3d_Grid}\pysiglinewithargsret{\code{pNbody.libgrid.}\bfcode{get\_DensityMap\_On\_Carthesian\_3d\_Grid}}{\emph{nb}, \emph{nx}, \emph{ny}, \emph{nz}, \emph{xmin}, \emph{xmax}, \emph{ymin}, \emph{ymax}, \emph{zmin}, \emph{zmax}}{}
Return an array of points containing density in each cell
\end{fulllineitems}
\index{get\_DensityMap\_On\_Cylindrical\_2dv\_Grid() (in module pNbody.libgrid)}
\begin{fulllineitems}
\phantomsection\label{rst/LibgridModule:pNbody.libgrid.get_DensityMap_On_Cylindrical_2dv_Grid}\pysiglinewithargsret{\code{pNbody.libgrid.}\bfcode{get\_DensityMap\_On\_Cylindrical\_2dv\_Grid}}{\emph{nb}, \emph{nr}, \emph{nz}, \emph{rmax}, \emph{zmin}, \emph{zmax}}{}
Return an array of points containing density in each cell
\end{fulllineitems}
\index{get\_DensityMap\_On\_Cylindrical\_3d\_Grid() (in module pNbody.libgrid)}
\begin{fulllineitems}
\phantomsection\label{rst/LibgridModule:pNbody.libgrid.get_DensityMap_On_Cylindrical_3d_Grid}\pysiglinewithargsret{\code{pNbody.libgrid.}\bfcode{get\_DensityMap\_On\_Cylindrical\_3d\_Grid}}{\emph{nb}, \emph{nr}, \emph{nt}, \emph{nz}, \emph{rmax}, \emph{zmin}, \emph{zmax}}{}
Return an array of points containing density in each cell
\end{fulllineitems}
\index{get\_DensityMap\_On\_Spherical\_1d\_Grid() (in module pNbody.libgrid)}
\begin{fulllineitems}
\phantomsection\label{rst/LibgridModule:pNbody.libgrid.get_DensityMap_On_Spherical_1d_Grid}\pysiglinewithargsret{\code{pNbody.libgrid.}\bfcode{get\_DensityMap\_On\_Spherical\_1d\_Grid}}{\emph{nb}, \emph{nr}, \emph{rmax}, \emph{f=None}, \emph{fm=None}}{}
Return an array of points containing density in each cell
\end{fulllineitems}
\index{get\_DensityMap\_On\_Spherical\_3d\_Grid() (in module pNbody.libgrid)}
\begin{fulllineitems}
\phantomsection\label{rst/LibgridModule:pNbody.libgrid.get_DensityMap_On_Spherical_3d_Grid}\pysiglinewithargsret{\code{pNbody.libgrid.}\bfcode{get\_DensityMap\_On\_Spherical\_3d\_Grid}}{\emph{nb}, \emph{nr}, \emph{np}, \emph{nt}, \emph{rmax}}{}
Return an array of points containing density in each cell
\end{fulllineitems}
\index{get\_First\_Derivative() (in module pNbody.libgrid)}
\begin{fulllineitems}
\phantomsection\label{rst/LibgridModule:pNbody.libgrid.get_First_Derivative}\pysiglinewithargsret{\code{pNbody.libgrid.}\bfcode{get\_First\_Derivative}}{\emph{f}, \emph{x}, \emph{s=None}, \emph{k=2}}{}
First derivative of f(x)
\end{fulllineitems}
\index{get\_GenericMap\_On\_Spherical\_1d\_Grid() (in module pNbody.libgrid)}
\begin{fulllineitems}
\phantomsection\label{rst/LibgridModule:pNbody.libgrid.get_GenericMap_On_Spherical_1d_Grid}\pysiglinewithargsret{\code{pNbody.libgrid.}\bfcode{get\_GenericMap\_On\_Spherical\_1d\_Grid}}{\emph{nb}, \emph{nr}, \emph{rmax}, \emph{val}, \emph{f=None}, \emph{fm=None}}{}
Return an array of points containing mass*val
\end{fulllineitems}
\index{get\_Integral() (in module pNbody.libgrid)}
\begin{fulllineitems}
\phantomsection\label{rst/LibgridModule:pNbody.libgrid.get_Integral}\pysiglinewithargsret{\code{pNbody.libgrid.}\bfcode{get\_Integral}}{\emph{v}, \emph{dr}, \emph{ia}, \emph{ib}}{}
Integrate the vector v, between ia and ib.
v : values of cells (must be 1 dimensional)
dr : corresponding physical size of cells
ia : lower real indice
ib : higher real indice
\end{fulllineitems}
\index{get\_Interpolation\_On\_Cylindrical\_2dv\_Grid() (in module pNbody.libgrid)}
\begin{fulllineitems}
\phantomsection\label{rst/LibgridModule:pNbody.libgrid.get_Interpolation_On_Cylindrical_2dv_Grid}\pysiglinewithargsret{\code{pNbody.libgrid.}\bfcode{get\_Interpolation\_On\_Cylindrical\_2dv\_Grid}}{\emph{pos}, \emph{mat}, \emph{nr}, \emph{nz}, \emph{rmax}, \emph{zmin}, \emph{zmax}, \emph{offr=0}, \emph{offz=0}}{}
Interpolates continuous value of pos, using matrix mat
\end{fulllineitems}
\index{get\_Interpolation\_On\_Spherical\_1d\_Grid() (in module pNbody.libgrid)}
\begin{fulllineitems}
\phantomsection\label{rst/LibgridModule:pNbody.libgrid.get_Interpolation_On_Spherical_1d_Grid}\pysiglinewithargsret{\code{pNbody.libgrid.}\bfcode{get\_Interpolation\_On\_Spherical\_1d\_Grid}}{\emph{pos}, \emph{mat}, \emph{nr}, \emph{rmax}, \emph{offr=0}, \emph{f=None}, \emph{fm=None}}{}
Interpolates continuous value of pos, using matrix mat
\end{fulllineitems}
\index{get\_LinearDensityMap\_On\_Spherical\_1d\_Grid() (in module pNbody.libgrid)}
\begin{fulllineitems}
\phantomsection\label{rst/LibgridModule:pNbody.libgrid.get_LinearDensityMap_On_Spherical_1d_Grid}\pysiglinewithargsret{\code{pNbody.libgrid.}\bfcode{get\_LinearDensityMap\_On\_Spherical\_1d\_Grid}}{\emph{nb}, \emph{nr}, \emph{rmax}, \emph{f=None}, \emph{fm=None}}{}
Return an array of points containing the linear density in each cell
\end{fulllineitems}
\index{get\_MassMap\_On\_Carthesian\_2d\_Grid() (in module pNbody.libgrid)}
\begin{fulllineitems}
\phantomsection\label{rst/LibgridModule:pNbody.libgrid.get_MassMap_On_Carthesian_2d_Grid}\pysiglinewithargsret{\code{pNbody.libgrid.}\bfcode{get\_MassMap\_On\_Carthesian\_2d\_Grid}}{\emph{nb}, \emph{nx}, \emph{ny}, \emph{xmin}, \emph{xmax}, \emph{ymin}, \emph{ymax}}{}
Return an array of points containing mass of particles
\end{fulllineitems}
\index{get\_MassMap\_On\_Carthesian\_3d\_Grid() (in module pNbody.libgrid)}
\begin{fulllineitems}
\phantomsection\label{rst/LibgridModule:pNbody.libgrid.get_MassMap_On_Carthesian_3d_Grid}\pysiglinewithargsret{\code{pNbody.libgrid.}\bfcode{get\_MassMap\_On\_Carthesian\_3d\_Grid}}{\emph{nb}, \emph{nx}, \emph{ny}, \emph{nz}, \emph{xmin}, \emph{xmax}, \emph{ymin}, \emph{ymax}, \emph{zmin}, \emph{zmax}}{}
Return an array of points containing mass of particles
\end{fulllineitems}
\index{get\_MassMap\_On\_Cylindrical\_2dh\_Grid() (in module pNbody.libgrid)}
\begin{fulllineitems}
\phantomsection\label{rst/LibgridModule:pNbody.libgrid.get_MassMap_On_Cylindrical_2dh_Grid}\pysiglinewithargsret{\code{pNbody.libgrid.}\bfcode{get\_MassMap\_On\_Cylindrical\_2dh\_Grid}}{\emph{nb}, \emph{nr}, \emph{nt}, \emph{rmax}}{}
Return an array of points containing mass of particles
\end{fulllineitems}
\index{get\_MassMap\_On\_Cylindrical\_2dv\_Grid() (in module pNbody.libgrid)}
\begin{fulllineitems}
\phantomsection\label{rst/LibgridModule:pNbody.libgrid.get_MassMap_On_Cylindrical_2dv_Grid}\pysiglinewithargsret{\code{pNbody.libgrid.}\bfcode{get\_MassMap\_On\_Cylindrical\_2dv\_Grid}}{\emph{nb}, \emph{nr}, \emph{nz}, \emph{rmax}, \emph{zmin}, \emph{zmax}}{}
Return an array of points containing mass of particles
\end{fulllineitems}
\index{get\_MassMap\_On\_Cylindrical\_3d\_Grid() (in module pNbody.libgrid)}
\begin{fulllineitems}
\phantomsection\label{rst/LibgridModule:pNbody.libgrid.get_MassMap_On_Cylindrical_3d_Grid}\pysiglinewithargsret{\code{pNbody.libgrid.}\bfcode{get\_MassMap\_On\_Cylindrical\_3d\_Grid}}{\emph{nb}, \emph{nr}, \emph{nt}, \emph{nz}, \emph{rmax}, \emph{zmin}, \emph{zmax}}{}
Return an array of points containing mass of particles
\end{fulllineitems}
\index{get\_MassMap\_On\_Spherical\_1d\_Grid() (in module pNbody.libgrid)}
\begin{fulllineitems}
\phantomsection\label{rst/LibgridModule:pNbody.libgrid.get_MassMap_On_Spherical_1d_Grid}\pysiglinewithargsret{\code{pNbody.libgrid.}\bfcode{get\_MassMap\_On\_Spherical\_1d\_Grid}}{\emph{nb}, \emph{nr}, \emph{rmax}, \emph{f=None}, \emph{fm=None}}{}
Return an array of points containing mass of particles
\end{fulllineitems}
\index{get\_MassMap\_On\_Spherical\_3d\_Grid() (in module pNbody.libgrid)}
\begin{fulllineitems}
\phantomsection\label{rst/LibgridModule:pNbody.libgrid.get_MassMap_On_Spherical_3d_Grid}\pysiglinewithargsret{\code{pNbody.libgrid.}\bfcode{get\_MassMap\_On\_Spherical\_3d\_Grid}}{\emph{nb}, \emph{nr}, \emph{np}, \emph{nt}, \emph{rmax}}{}
Return an array of points containing mass of particles
\end{fulllineitems}
\index{get\_NumberMap\_On\_Carthesian\_2d\_Grid() (in module pNbody.libgrid)}
\begin{fulllineitems}
\phantomsection\label{rst/LibgridModule:pNbody.libgrid.get_NumberMap_On_Carthesian_2d_Grid}\pysiglinewithargsret{\code{pNbody.libgrid.}\bfcode{get\_NumberMap\_On\_Carthesian\_2d\_Grid}}{\emph{nb}, \emph{nx}, \emph{ny}, \emph{xmin}, \emph{xmax}, \emph{ymin}, \emph{ymax}}{}
Return an array of points containing mass of particles
\end{fulllineitems}
\index{get\_NumberMap\_On\_Carthesian\_3d\_Grid() (in module pNbody.libgrid)}
\begin{fulllineitems}
\phantomsection\label{rst/LibgridModule:pNbody.libgrid.get_NumberMap_On_Carthesian_3d_Grid}\pysiglinewithargsret{\code{pNbody.libgrid.}\bfcode{get\_NumberMap\_On\_Carthesian\_3d\_Grid}}{\emph{nb}, \emph{nx}, \emph{ny}, \emph{nz}, \emph{xmin}, \emph{xmax}, \emph{ymin}, \emph{ymax}, \emph{zmin}, \emph{zmax}}{}
Return an array of points containing mass of particles
\end{fulllineitems}
\index{get\_NumberMap\_On\_Cylindrical\_2dh\_Grid() (in module pNbody.libgrid)}
\begin{fulllineitems}
\phantomsection\label{rst/LibgridModule:pNbody.libgrid.get_NumberMap_On_Cylindrical_2dh_Grid}\pysiglinewithargsret{\code{pNbody.libgrid.}\bfcode{get\_NumberMap\_On\_Cylindrical\_2dh\_Grid}}{\emph{nb}, \emph{nr}, \emph{nt}, \emph{rmax}}{}
Return an array of points containing mass of particles
\end{fulllineitems}
\index{get\_NumberMap\_On\_Cylindrical\_2dv\_Grid() (in module pNbody.libgrid)}
\begin{fulllineitems}
\phantomsection\label{rst/LibgridModule:pNbody.libgrid.get_NumberMap_On_Cylindrical_2dv_Grid}\pysiglinewithargsret{\code{pNbody.libgrid.}\bfcode{get\_NumberMap\_On\_Cylindrical\_2dv\_Grid}}{\emph{nb}, \emph{nr}, \emph{nz}, \emph{rmax}, \emph{zmin}, \emph{zmax}}{}
Return an array of points containing mass of particles
\end{fulllineitems}
\index{get\_NumberMap\_On\_Cylindrical\_3d\_Grid() (in module pNbody.libgrid)}
\begin{fulllineitems}
\phantomsection\label{rst/LibgridModule:pNbody.libgrid.get_NumberMap_On_Cylindrical_3d_Grid}\pysiglinewithargsret{\code{pNbody.libgrid.}\bfcode{get\_NumberMap\_On\_Cylindrical\_3d\_Grid}}{\emph{nb}, \emph{nr}, \emph{nt}, \emph{nz}, \emph{rmax}, \emph{zmin}, \emph{zmax}}{}
Return an array of points containing mass of particles
\end{fulllineitems}
\index{get\_NumberMap\_On\_Spherical\_1d\_Grid() (in module pNbody.libgrid)}
\begin{fulllineitems}
\phantomsection\label{rst/LibgridModule:pNbody.libgrid.get_NumberMap_On_Spherical_1d_Grid}\pysiglinewithargsret{\code{pNbody.libgrid.}\bfcode{get\_NumberMap\_On\_Spherical\_1d\_Grid}}{\emph{nb}, \emph{nr}, \emph{rmax}, \emph{f=None}, \emph{fm=None}}{}
Return an array of points containing number of particles
\end{fulllineitems}
\index{get\_NumberMap\_On\_Spherical\_3d\_Grid() (in module pNbody.libgrid)}
\begin{fulllineitems}
\phantomsection\label{rst/LibgridModule:pNbody.libgrid.get_NumberMap_On_Spherical_3d_Grid}\pysiglinewithargsret{\code{pNbody.libgrid.}\bfcode{get\_NumberMap\_On\_Spherical\_3d\_Grid}}{\emph{nb}, \emph{nr}, \emph{np}, \emph{nt}, \emph{rmax}}{}
Return an array of points containing mass of particles
\end{fulllineitems}
\index{get\_Points\_On\_Carthesian\_2d\_Grid() (in module pNbody.libgrid)}
\begin{fulllineitems}
\phantomsection\label{rst/LibgridModule:pNbody.libgrid.get_Points_On_Carthesian_2d_Grid}\pysiglinewithargsret{\code{pNbody.libgrid.}\bfcode{get\_Points\_On\_Carthesian\_2d\_Grid}}{\emph{nx}, \emph{ny}, \emph{xmin}, \emph{xmax}, \emph{ymin}, \emph{ymax}, \emph{offx=0}, \emph{offy=0}}{}
Return an array of points corresponding to the center of cells
af a 2d carthesian grid.
To get a nt X nr array from the returned vector (pos), do
x = copy(pos{[}:,0{]})
y = copy(pos{[}:,1{]})
z = copy(pos{[}:,2{]})
x.shape = (nx,ny)
y.shape = (nx,ny)
z.shape = (nx,ny)
\end{fulllineitems}
\index{get\_Points\_On\_Carthesian\_3d\_Grid() (in module pNbody.libgrid)}
\begin{fulllineitems}
\phantomsection\label{rst/LibgridModule:pNbody.libgrid.get_Points_On_Carthesian_3d_Grid}\pysiglinewithargsret{\code{pNbody.libgrid.}\bfcode{get\_Points\_On\_Carthesian\_3d\_Grid}}{\emph{nx}, \emph{ny}, \emph{nz}, \emph{xmin}, \emph{xmax}, \emph{ymin}, \emph{ymax}, \emph{zmin}, \emph{zmax}, \emph{offx=0}, \emph{offy=0}, \emph{offz=0}}{}
Return an array of points corresponding to the center of cells
af a 3d carthesian grid.
To get a nt X nr array from the returned vector (pos), do
x = copy(pos{[}:,0{]})
y = copy(pos{[}:,1{]})
z = copy(pos{[}:,2{]})
x.shape = (nx,ny,nz)
y.shape = (nx,ny,nz)
z.shape = (nx,ny,nz)
\end{fulllineitems}
\index{get\_Points\_On\_Cylindrical\_2dh\_Grid() (in module pNbody.libgrid)}
\begin{fulllineitems}
\phantomsection\label{rst/LibgridModule:pNbody.libgrid.get_Points_On_Cylindrical_2dh_Grid}\pysiglinewithargsret{\code{pNbody.libgrid.}\bfcode{get\_Points\_On\_Cylindrical\_2dh\_Grid}}{\emph{nr}, \emph{nt}, \emph{rmax}, \emph{offr=0}, \emph{offt=0}}{}
Return an array of points corresponding to the nodes of
a 2d cylindrical grid
To get a nt X nr array from the returned vector (pos), do
x = copy(pos{[}:,0{]})
y = copy(pos{[}:,1{]})
z = copy(pos{[}:,2{]})
x.shape = (nr,nt)
y.shape = (nr,nt)
z.shape = (nr,nt)
\# to get r and theta
r = sqrt(x**2+y**2+z**2)
t = arctan2(y,x)*180/pi
\end{fulllineitems}
\index{get\_Points\_On\_Cylindrical\_2dv\_Grid() (in module pNbody.libgrid)}
\begin{fulllineitems}
\phantomsection\label{rst/LibgridModule:pNbody.libgrid.get_Points_On_Cylindrical_2dv_Grid}\pysiglinewithargsret{\code{pNbody.libgrid.}\bfcode{get\_Points\_On\_Cylindrical\_2dv\_Grid}}{\emph{nr}, \emph{nz}, \emph{rmax}, \emph{zmin}, \emph{zmax}, \emph{offr=0}, \emph{offz=0}}{}
Return an array of points corresponding to the nodes of
a 2d cylindrical grid
To get a nt X nr array from the returned vector (pos), do
x = copy(pos{[}:,0{]})
y = copy(pos{[}:,1{]})
z = copy(pos{[}:,2{]})
x.shape = (nr,nt)
y.shape = (nr,nt)
z.shape = (nr,nt)
\# to get r and theta
r = sqrt(x**2+y**2+z**2)
t = arctan2(y,x)*180/pi
\end{fulllineitems}
\index{get\_Points\_On\_Cylindrical\_3d\_Grid() (in module pNbody.libgrid)}
\begin{fulllineitems}
\phantomsection\label{rst/LibgridModule:pNbody.libgrid.get_Points_On_Cylindrical_3d_Grid}\pysiglinewithargsret{\code{pNbody.libgrid.}\bfcode{get\_Points\_On\_Cylindrical\_3d\_Grid}}{\emph{nr}, \emph{nt}, \emph{nz}, \emph{rmax}, \emph{zmin}, \emph{zmax}, \emph{offr=0}, \emph{offt=0}, \emph{offz=0}}{}
Return an array of points corresponding to the nodes of
a 2d cylindrical grid
To get a nt X nr array from the returned vector (pos), do
x = pos{[}:,0{]}
y = pos{[}:,0{]}
z = pos{[}:,0{]}
x.shape = (nr,nt,nz)
y.shape = (nr,nt,nz)
z.shape = (nr,nt,nz)
\# to get r and theta
r = sqrt(x**2+y**2+z**2)
t = arctan2(y,x)*180/pi
\end{fulllineitems}
\index{get\_Points\_On\_Spherical\_1d\_Grid() (in module pNbody.libgrid)}
\begin{fulllineitems}
\phantomsection\label{rst/LibgridModule:pNbody.libgrid.get_Points_On_Spherical_1d_Grid}\pysiglinewithargsret{\code{pNbody.libgrid.}\bfcode{get\_Points\_On\_Spherical\_1d\_Grid}}{\emph{nr}, \emph{rmax}, \emph{offr=0}, \emph{f=None}, \emph{fm=None}}{}
Return an array of points corresponding to the nodes of
a 1d spherical grid
To get a nt X nr array from the returned vector (pos), do
x = pos{[}:,0{]}
y = pos{[}:,0{]}
z = pos{[}:,0{]}
x.shape = (nr,np,nt)
y.shape = (nr,np,nt)
z.shape = (nr,np,nt)
\end{fulllineitems}
\index{get\_Points\_On\_Spherical\_3d\_Grid() (in module pNbody.libgrid)}
\begin{fulllineitems}
\phantomsection\label{rst/LibgridModule:pNbody.libgrid.get_Points_On_Spherical_3d_Grid}\pysiglinewithargsret{\code{pNbody.libgrid.}\bfcode{get\_Points\_On\_Spherical\_3d\_Grid}}{\emph{nr}, \emph{np}, \emph{nt}, \emph{rmax}, \emph{offr=0}, \emph{offp=0}, \emph{offt=0}}{}
Return an array of points corresponding to the nodes of
a 3d spherical grid
To get a nt X nr array from the returned vector (pos), do
x = pos{[}:,0{]}
y = pos{[}:,0{]}
z = pos{[}:,0{]}
x.shape = (nr,np,nt)
y.shape = (nr,np,nt)
z.shape = (nr,np,nt)
\end{fulllineitems}
\index{get\_PotentialMap\_On\_Carthesian\_2d\_Grid() (in module pNbody.libgrid)}
\begin{fulllineitems}
\phantomsection\label{rst/LibgridModule:pNbody.libgrid.get_PotentialMap_On_Carthesian_2d_Grid}\pysiglinewithargsret{\code{pNbody.libgrid.}\bfcode{get\_PotentialMap\_On\_Carthesian\_2d\_Grid}}{\emph{nb}, \emph{nx}, \emph{ny}, \emph{xmin}, \emph{xmax}, \emph{ymin}, \emph{ymax}, \emph{eps}, \emph{Tree=None}}{}
Return an array of points containing potential
\end{fulllineitems}
\index{get\_PotentialMap\_On\_Carthesian\_3d\_Grid() (in module pNbody.libgrid)}
\begin{fulllineitems}
\phantomsection\label{rst/LibgridModule:pNbody.libgrid.get_PotentialMap_On_Carthesian_3d_Grid}\pysiglinewithargsret{\code{pNbody.libgrid.}\bfcode{get\_PotentialMap\_On\_Carthesian\_3d\_Grid}}{\emph{nb}, \emph{nx}, \emph{ny}, \emph{nz}, \emph{xmin}, \emph{xmax}, \emph{ymin}, \emph{ymax}, \emph{zmin}, \emph{zmax}, \emph{eps}, \emph{Tree=None}}{}
Return an array of points containing potential
\end{fulllineitems}
\index{get\_PotentialMap\_On\_Cylindrical\_2dh\_Grid() (in module pNbody.libgrid)}
\begin{fulllineitems}
\phantomsection\label{rst/LibgridModule:pNbody.libgrid.get_PotentialMap_On_Cylindrical_2dh_Grid}\pysiglinewithargsret{\code{pNbody.libgrid.}\bfcode{get\_PotentialMap\_On\_Cylindrical\_2dh\_Grid}}{\emph{nb}, \emph{nr}, \emph{nt}, \emph{rmax}, \emph{eps}, \emph{Tree=None}}{}
Return an array of points containing potential
\end{fulllineitems}
\index{get\_PotentialMap\_On\_Cylindrical\_2dv\_Grid() (in module pNbody.libgrid)}
\begin{fulllineitems}
\phantomsection\label{rst/LibgridModule:pNbody.libgrid.get_PotentialMap_On_Cylindrical_2dv_Grid}\pysiglinewithargsret{\code{pNbody.libgrid.}\bfcode{get\_PotentialMap\_On\_Cylindrical\_2dv\_Grid}}{\emph{nb}, \emph{nr}, \emph{nz}, \emph{rmax}, \emph{zmin}, \emph{zmax}, \emph{eps}, \emph{Tree=None}}{}
Return an array of points containing potential
\end{fulllineitems}
\index{get\_PotentialMap\_On\_Cylindrical\_3d\_Grid() (in module pNbody.libgrid)}
\begin{fulllineitems}
\phantomsection\label{rst/LibgridModule:pNbody.libgrid.get_PotentialMap_On_Cylindrical_3d_Grid}\pysiglinewithargsret{\code{pNbody.libgrid.}\bfcode{get\_PotentialMap\_On\_Cylindrical\_3d\_Grid}}{\emph{nb}, \emph{nr}, \emph{nt}, \emph{nz}, \emph{rmax}, \emph{zmin}, \emph{zmax}, \emph{eps}, \emph{Tree=None}}{}
Return an array of points containing potential
\end{fulllineitems}
\index{get\_PotentialMap\_On\_Spherical\_1d\_Grid() (in module pNbody.libgrid)}
\begin{fulllineitems}
\phantomsection\label{rst/LibgridModule:pNbody.libgrid.get_PotentialMap_On_Spherical_1d_Grid}\pysiglinewithargsret{\code{pNbody.libgrid.}\bfcode{get\_PotentialMap\_On\_Spherical\_1d\_Grid}}{\emph{nb}, \emph{nr}, \emph{rmax}, \emph{eps}, \emph{Tree=None}, \emph{f=None}, \emph{fm=None}}{}
Return an array of points containing potential
\end{fulllineitems}
\index{get\_PotentialMap\_On\_Spherical\_3d\_Grid() (in module pNbody.libgrid)}
\begin{fulllineitems}
\phantomsection\label{rst/LibgridModule:pNbody.libgrid.get_PotentialMap_On_Spherical_3d_Grid}\pysiglinewithargsret{\code{pNbody.libgrid.}\bfcode{get\_PotentialMap\_On\_Spherical\_3d\_Grid}}{\emph{nb}, \emph{nr}, \emph{np}, \emph{nt}, \emph{rmax}, \emph{eps}, \emph{Tree=None}}{}
Return an array of points containing potential
\end{fulllineitems}
\index{get\_SurfaceDensityMap\_From\_Cylindrical\_2dv\_Grid() (in module pNbody.libgrid)}
\begin{fulllineitems}
\phantomsection\label{rst/LibgridModule:pNbody.libgrid.get_SurfaceDensityMap_From_Cylindrical_2dv_Grid}\pysiglinewithargsret{\code{pNbody.libgrid.}\bfcode{get\_SurfaceDensityMap\_From\_Cylindrical\_2dv\_Grid}}{\emph{nb}, \emph{nr}, \emph{nz}, \emph{rmax}, \emph{zmin}, \emph{zmax}}{}
Return an array of points containing the surface density along r
\end{fulllineitems}
\index{get\_SurfaceDensityMap\_On\_Carthesian\_2d\_Grid() (in module pNbody.libgrid)}
\begin{fulllineitems}
\phantomsection\label{rst/LibgridModule:pNbody.libgrid.get_SurfaceDensityMap_On_Carthesian_2d_Grid}\pysiglinewithargsret{\code{pNbody.libgrid.}\bfcode{get\_SurfaceDensityMap\_On\_Carthesian\_2d\_Grid}}{\emph{nb}, \emph{nx}, \emph{ny}, \emph{xmin}, \emph{xmax}, \emph{ymin}, \emph{ymax}}{}
Return an array of points containing density in each cell
\end{fulllineitems}
\index{get\_SurfaceDensityMap\_On\_Cylindrical\_2dh\_Grid() (in module pNbody.libgrid)}
\begin{fulllineitems}
\phantomsection\label{rst/LibgridModule:pNbody.libgrid.get_SurfaceDensityMap_On_Cylindrical_2dh_Grid}\pysiglinewithargsret{\code{pNbody.libgrid.}\bfcode{get\_SurfaceDensityMap\_On\_Cylindrical\_2dh\_Grid}}{\emph{nb}, \emph{nr}, \emph{nt}, \emph{rmax}}{}
Return an array of points containing density in each cell
\end{fulllineitems}
\index{get\_SurfaceMap\_On\_Carthesian\_2d\_Grid() (in module pNbody.libgrid)}
\begin{fulllineitems}
\phantomsection\label{rst/LibgridModule:pNbody.libgrid.get_SurfaceMap_On_Carthesian_2d_Grid}\pysiglinewithargsret{\code{pNbody.libgrid.}\bfcode{get\_SurfaceMap\_On\_Carthesian\_2d\_Grid}}{\emph{nb}, \emph{nx}, \emph{ny}, \emph{xmin}, \emph{xmax}, \emph{ymin}, \emph{ymax}}{}
Return an array of points containing corresponding physical
volumes of each cell (usefull to compute density)
\end{fulllineitems}
\index{get\_SurfaceMap\_On\_Cylindrical\_2dh\_Grid() (in module pNbody.libgrid)}
\begin{fulllineitems}
\phantomsection\label{rst/LibgridModule:pNbody.libgrid.get_SurfaceMap_On_Cylindrical_2dh_Grid}\pysiglinewithargsret{\code{pNbody.libgrid.}\bfcode{get\_SurfaceMap\_On\_Cylindrical\_2dh\_Grid}}{\emph{nb}, \emph{nr}, \emph{nt}, \emph{rmax}}{}
Return an array of points containing corresponding physical
volumes of each cell (usefull to compute density)
\end{fulllineitems}
\index{get\_SurfaceMap\_On\_Spherical\_1d\_Grid() (in module pNbody.libgrid)}
\begin{fulllineitems}
\phantomsection\label{rst/LibgridModule:pNbody.libgrid.get_SurfaceMap_On_Spherical_1d_Grid}\pysiglinewithargsret{\code{pNbody.libgrid.}\bfcode{get\_SurfaceMap\_On\_Spherical\_1d\_Grid}}{\emph{nb}, \emph{nr}, \emph{rmax}, \emph{f=None}, \emph{fm=None}}{}
Return an array of points containing surface (volume)
of each cell.
\end{fulllineitems}
\index{get\_Symetrisation\_Along\_Axis() (in module pNbody.libgrid)}
\begin{fulllineitems}
\phantomsection\label{rst/LibgridModule:pNbody.libgrid.get_Symetrisation_Along_Axis}\pysiglinewithargsret{\code{pNbody.libgrid.}\bfcode{get\_Symetrisation\_Along\_Axis}}{\emph{mat}, \emph{axis=1}}{}
Return an array where the two half are symetrized
\end{fulllineitems}
\index{get\_Symetrisation\_Along\_Axis\_Old() (in module pNbody.libgrid)}
\begin{fulllineitems}
\phantomsection\label{rst/LibgridModule:pNbody.libgrid.get_Symetrisation_Along_Axis_Old}\pysiglinewithargsret{\code{pNbody.libgrid.}\bfcode{get\_Symetrisation\_Along\_Axis\_Old}}{\emph{mat}, \emph{axis=1}}{}
Return an array where the two half are symetrized
Old but more correct than new one
\end{fulllineitems}
\index{get\_VolumeMap\_On\_Carthesian\_3d\_Grid() (in module pNbody.libgrid)}
\begin{fulllineitems}
\phantomsection\label{rst/LibgridModule:pNbody.libgrid.get_VolumeMap_On_Carthesian_3d_Grid}\pysiglinewithargsret{\code{pNbody.libgrid.}\bfcode{get\_VolumeMap\_On\_Carthesian\_3d\_Grid}}{\emph{nb}, \emph{nx}, \emph{ny}, \emph{nz}, \emph{xmin}, \emph{xmax}, \emph{ymin}, \emph{ymax}, \emph{zmin}, \emph{zmax}}{}
Return an array of points containing corresponding physical
volumes of each cell (usefull to compute density)
\end{fulllineitems}
\index{get\_VolumeMap\_On\_Cylindrical\_2dv\_Grid() (in module pNbody.libgrid)}
\begin{fulllineitems}
\phantomsection\label{rst/LibgridModule:pNbody.libgrid.get_VolumeMap_On_Cylindrical_2dv_Grid}\pysiglinewithargsret{\code{pNbody.libgrid.}\bfcode{get\_VolumeMap\_On\_Cylindrical\_2dv\_Grid}}{\emph{nb}, \emph{nr}, \emph{nz}, \emph{rmax}, \emph{zmin}, \emph{zmax}}{}
Return an array of points containing corresponding physical
volumes of each cell (usefull to compute density)
\end{fulllineitems}
\index{get\_VolumeMap\_On\_Cylindrical\_3d\_Grid() (in module pNbody.libgrid)}
\begin{fulllineitems}
\phantomsection\label{rst/LibgridModule:pNbody.libgrid.get_VolumeMap_On_Cylindrical_3d_Grid}\pysiglinewithargsret{\code{pNbody.libgrid.}\bfcode{get\_VolumeMap\_On\_Cylindrical\_3d\_Grid}}{\emph{nb}, \emph{nr}, \emph{nt}, \emph{nz}, \emph{rmax}, \emph{zmin}, \emph{zmax}}{}
Return an array of points containing corresponding physical
volumes of each cell (usefull to compute density)
\end{fulllineitems}
\index{get\_VolumeMap\_On\_Spherical\_1d\_Grid() (in module pNbody.libgrid)}
\begin{fulllineitems}
\phantomsection\label{rst/LibgridModule:pNbody.libgrid.get_VolumeMap_On_Spherical_1d_Grid}\pysiglinewithargsret{\code{pNbody.libgrid.}\bfcode{get\_VolumeMap\_On\_Spherical\_1d\_Grid}}{\emph{nb}, \emph{nr}, \emph{rmax}, \emph{f=None}, \emph{fm=None}}{}
Return an array of points containing corresponding physical
volumes of each cell (usefull to compute density)
\end{fulllineitems}
\index{get\_VolumeMap\_On\_Spherical\_3d\_Grid() (in module pNbody.libgrid)}
\begin{fulllineitems}
\phantomsection\label{rst/LibgridModule:pNbody.libgrid.get_VolumeMap_On_Spherical_3d_Grid}\pysiglinewithargsret{\code{pNbody.libgrid.}\bfcode{get\_VolumeMap\_On\_Spherical\_3d\_Grid}}{\emph{nb}, \emph{nr}, \emph{np}, \emph{nt}, \emph{rmax}}{}
Return an array of points containing corresponding physical
volumes of each cell (usefull to compute density)
\end{fulllineitems}
\index{get\_r\_Interpolation\_On\_Cylindrical\_2dv\_Grid() (in module pNbody.libgrid)}
\begin{fulllineitems}
\phantomsection\label{rst/LibgridModule:pNbody.libgrid.get_r_Interpolation_On_Cylindrical_2dv_Grid}\pysiglinewithargsret{\code{pNbody.libgrid.}\bfcode{get\_r\_Interpolation\_On\_Cylindrical\_2dv\_Grid}}{\emph{pos}, \emph{mat}, \emph{nr}, \emph{nz}, \emph{rmax}, \emph{zmin}, \emph{zmax}, \emph{offr=0}}{}
Interpolates continuous value of pos, using matrix mat
only along first axis.
\end{fulllineitems}
\section{the libdisk module}
\label{rst/LibdiskModule:the-libdisk-module}\label{rst/LibdiskModule::doc}\label{rst/LibdiskModule:module-pNbody.libdisk}\index{pNbody.libdisk (module)}\index{Diff() (in module pNbody.libdisk)}
\begin{fulllineitems}
\phantomsection\label{rst/LibdiskModule:pNbody.libdisk.Diff}\pysiglinewithargsret{\code{pNbody.libdisk.}\bfcode{Diff}}{\emph{f}, \emph{x}, \emph{s=None}, \emph{k=2}}{}
First derivative of f(x)
\end{fulllineitems}
\index{get\_Integral() (in module pNbody.libdisk)}
\begin{fulllineitems}
\phantomsection\label{rst/LibdiskModule:pNbody.libdisk.get_Integral}\pysiglinewithargsret{\code{pNbody.libdisk.}\bfcode{get\_Integral}}{\emph{v}, \emph{dr}, \emph{ia}, \emph{ib}}{}
Integrate the vector v, between ia and ib, using trapezes.
v : values of cells (must be 1 dimensional)
dr : corresponding physical size of cells
ia : lower real indice WARNING : the indicies must now be integer !!!
ib : higher real indice WARNING : the indicies must now be integer !!!
\end{fulllineitems}
\section{the cosmo module}
\label{rst/CosmoModule:the-cosmo-module}\label{rst/CosmoModule::doc}\label{rst/CosmoModule:module-pNbody.cosmo}\index{pNbody.cosmo (module)}\index{A\_z() (in module pNbody.cosmo)}
\begin{fulllineitems}
\phantomsection\label{rst/CosmoModule:pNbody.cosmo.A_z}\pysiglinewithargsret{\code{pNbody.cosmo.}\bfcode{A\_z}}{\emph{z}}{}
\end{fulllineitems}
\index{Adot\_a() (in module pNbody.cosmo)}
\begin{fulllineitems}
\phantomsection\label{rst/CosmoModule:pNbody.cosmo.Adot_a}\pysiglinewithargsret{\code{pNbody.cosmo.}\bfcode{Adot\_a}}{\emph{a}, \emph{pars=\{`Hubble': 0.100000001545942}, \emph{`HubbleParam': 0.72999999999999998}, \emph{`Omega0': 0.23999999999999999}, \emph{`OmegaLambda': 0.76000000000000001\}}}{}
da/dt
\end{fulllineitems}
\index{Age\_a() (in module pNbody.cosmo)}
\begin{fulllineitems}
\phantomsection\label{rst/CosmoModule:pNbody.cosmo.Age_a}\pysiglinewithargsret{\code{pNbody.cosmo.}\bfcode{Age\_a}}{\emph{a}, \emph{pars=\{`Hubble': 0.100000001545942}, \emph{`HubbleParam': 0.72999999999999998}, \emph{`Omega0': 0.23999999999999999}, \emph{`OmegaLambda': 0.76000000000000001\}}}{}
cosmic age as a function of a
\end{fulllineitems}
\index{CosmicTime\_a() (in module pNbody.cosmo)}
\begin{fulllineitems}
\phantomsection\label{rst/CosmoModule:pNbody.cosmo.CosmicTime_a}\pysiglinewithargsret{\code{pNbody.cosmo.}\bfcode{CosmicTime\_a}}{\emph{a}, \emph{pars=\{`Hubble': 0.100000001545942}, \emph{`HubbleParam': 0.72999999999999998}, \emph{`Omega0': 0.23999999999999999}, \emph{`OmegaLambda': 0.76000000000000001\}}}{}
cosmic time as a function of a in internal units,
ie, (1/h)
\end{fulllineitems}
\index{Hubble\_a() (in module pNbody.cosmo)}
\begin{fulllineitems}
\phantomsection\label{rst/CosmoModule:pNbody.cosmo.Hubble_a}\pysiglinewithargsret{\code{pNbody.cosmo.}\bfcode{Hubble\_a}}{\emph{a}}{}
\end{fulllineitems}
\index{Rho\_c() (in module pNbody.cosmo)}
\begin{fulllineitems}
\phantomsection\label{rst/CosmoModule:pNbody.cosmo.Rho_c}\pysiglinewithargsret{\code{pNbody.cosmo.}\bfcode{Rho\_c}}{\emph{localsystem\_of\_units}}{}
Critical density
\end{fulllineitems}
\index{Z\_a() (in module pNbody.cosmo)}
\begin{fulllineitems}
\phantomsection\label{rst/CosmoModule:pNbody.cosmo.Z_a}\pysiglinewithargsret{\code{pNbody.cosmo.}\bfcode{Z\_a}}{\emph{a}}{}
\end{fulllineitems}
\index{a\_CosmicTime() (in module pNbody.cosmo)}
\begin{fulllineitems}
\phantomsection\label{rst/CosmoModule:pNbody.cosmo.a_CosmicTime}\pysiglinewithargsret{\code{pNbody.cosmo.}\bfcode{a\_CosmicTime}}{\emph{t}, \emph{pars=\{`Hubble': 0.100000001545942}, \emph{`HubbleParam': 0.72999999999999998}, \emph{`Omega0': 0.23999999999999999}, \emph{`OmegaLambda': 0.76000000000000001\}}, \emph{a0=0.5}}{}
return a for a given cosmic time
\end{fulllineitems}
\index{setdefault() (in module pNbody.cosmo)}
\begin{fulllineitems}
\phantomsection\label{rst/CosmoModule:pNbody.cosmo.setdefault}\pysiglinewithargsret{\code{pNbody.cosmo.}\bfcode{setdefault}}{}{}
set default cosmological parameters
\end{fulllineitems}
\section{the thermodyn module}
\label{rst/ThermodynModule:module-pNbody.thermodyn}\label{rst/ThermodynModule::doc}\label{rst/ThermodynModule:the-thermodyn-module}\index{pNbody.thermodyn (module)}\index{Arp() (in module pNbody.thermodyn)}
\begin{fulllineitems}
\phantomsection\label{rst/ThermodynModule:pNbody.thermodyn.Arp}\pysiglinewithargsret{\code{pNbody.thermodyn.}\bfcode{Arp}}{\emph{rho}, \emph{P}}{}
\end{fulllineitems}
\index{Art() (in module pNbody.thermodyn)}
\begin{fulllineitems}
\phantomsection\label{rst/ThermodynModule:pNbody.thermodyn.Art}\pysiglinewithargsret{\code{pNbody.thermodyn.}\bfcode{Art}}{\emph{rho}, \emph{T}}{}
\end{fulllineitems}
\index{Aru() (in module pNbody.thermodyn)}
\begin{fulllineitems}
\phantomsection\label{rst/ThermodynModule:pNbody.thermodyn.Aru}\pysiglinewithargsret{\code{pNbody.thermodyn.}\bfcode{Aru}}{\emph{rho}, \emph{U}}{}
\end{fulllineitems}
\index{ElectronDensity() (in module pNbody.thermodyn)}
\begin{fulllineitems}
\phantomsection\label{rst/ThermodynModule:pNbody.thermodyn.ElectronDensity}\pysiglinewithargsret{\code{pNbody.thermodyn.}\bfcode{ElectronDensity}}{\emph{rho}, \emph{pars}}{}
Electron density for a mixture of H + He
\end{fulllineitems}
\index{Lambda() (in module pNbody.thermodyn)}
\begin{fulllineitems}
\phantomsection\label{rst/ThermodynModule:pNbody.thermodyn.Lambda}\pysiglinewithargsret{\code{pNbody.thermodyn.}\bfcode{Lambda}}{\emph{rho}, \emph{u}, \emph{localsystem}, \emph{thermopars}, \emph{coolingfile}}{}
This corresponds to Lambda normalized
Ln = L / nh 2
nh = (xi*rho/mh)
\end{fulllineitems}
\index{Pra() (in module pNbody.thermodyn)}
\begin{fulllineitems}
\phantomsection\label{rst/ThermodynModule:pNbody.thermodyn.Pra}\pysiglinewithargsret{\code{pNbody.thermodyn.}\bfcode{Pra}}{\emph{rho}, \emph{A}}{}
\end{fulllineitems}
\index{Prt() (in module pNbody.thermodyn)}
\begin{fulllineitems}
\phantomsection\label{rst/ThermodynModule:pNbody.thermodyn.Prt}\pysiglinewithargsret{\code{pNbody.thermodyn.}\bfcode{Prt}}{\emph{rho}, \emph{T}}{}
\end{fulllineitems}
\index{Pru() (in module pNbody.thermodyn)}
\begin{fulllineitems}
\phantomsection\label{rst/ThermodynModule:pNbody.thermodyn.Pru}\pysiglinewithargsret{\code{pNbody.thermodyn.}\bfcode{Pru}}{\emph{rho}, \emph{U}}{}
\end{fulllineitems}
\index{Tra() (in module pNbody.thermodyn)}
\begin{fulllineitems}
\phantomsection\label{rst/ThermodynModule:pNbody.thermodyn.Tra}\pysiglinewithargsret{\code{pNbody.thermodyn.}\bfcode{Tra}}{\emph{rho}, \emph{A}}{}
\end{fulllineitems}
\index{Trp() (in module pNbody.thermodyn)}
\begin{fulllineitems}
\phantomsection\label{rst/ThermodynModule:pNbody.thermodyn.Trp}\pysiglinewithargsret{\code{pNbody.thermodyn.}\bfcode{Trp}}{\emph{rho}, \emph{P}}{}
\end{fulllineitems}
\index{Tru() (in module pNbody.thermodyn)}
\begin{fulllineitems}
\phantomsection\label{rst/ThermodynModule:pNbody.thermodyn.Tru}\pysiglinewithargsret{\code{pNbody.thermodyn.}\bfcode{Tru}}{\emph{rho}, \emph{U}}{}
\end{fulllineitems}
\index{Ura() (in module pNbody.thermodyn)}
\begin{fulllineitems}
\phantomsection\label{rst/ThermodynModule:pNbody.thermodyn.Ura}\pysiglinewithargsret{\code{pNbody.thermodyn.}\bfcode{Ura}}{\emph{rho}, \emph{A}}{}
\end{fulllineitems}
\index{Urp() (in module pNbody.thermodyn)}
\begin{fulllineitems}
\phantomsection\label{rst/ThermodynModule:pNbody.thermodyn.Urp}\pysiglinewithargsret{\code{pNbody.thermodyn.}\bfcode{Urp}}{\emph{rho}, \emph{P}}{}
\end{fulllineitems}
\index{Urt() (in module pNbody.thermodyn)}
\begin{fulllineitems}
\phantomsection\label{rst/ThermodynModule:pNbody.thermodyn.Urt}\pysiglinewithargsret{\code{pNbody.thermodyn.}\bfcode{Urt}}{\emph{rho}, \emph{T}}{}
\end{fulllineitems}
\section{the fourier module}
\label{rst/FourierModule:module-pNbody.fourier}\label{rst/FourierModule::doc}\label{rst/FourierModule:the-fourier-module}\index{pNbody.fourier (module)}\index{fourier() (in module pNbody.fourier)}
\begin{fulllineitems}
\phantomsection\label{rst/FourierModule:pNbody.fourier.fourier}\pysiglinewithargsret{\code{pNbody.fourier.}\bfcode{fourier}}{\emph{m=1}, \emph{n) amp\_m cos( 2.pi f\_m phi + phi\_m ) = Sum\_(m=1}, \emph{n) amp\_m cos( m phi + phi\_m}}{}
m = 2.pi f\_m
\end{fulllineitems}
\section{the phot module}
\label{rst/PhotModule:module-pNbody.phot}\label{rst/PhotModule:the-phot-module}\label{rst/PhotModule::doc}\index{pNbody.phot (module)}\index{LvtoMv() (in module pNbody.phot)}
\begin{fulllineitems}
\phantomsection\label{rst/PhotModule:pNbody.phot.LvtoMv}\pysiglinewithargsret{\code{pNbody.phot.}\bfcode{LvtoMv}}{\emph{Lv}, \emph{Mvsun=4.8300000000000001}, \emph{Lvsun=1.0}}{}
Lv : V-band luminosity in solar luminosity unit
Mvsun : magnitude of the sun in V-band
Lvsun : V-band solar luminosity in solar luminosity unit
Return the magnitude in V-band
\end{fulllineitems}
\index{MvtoLv() (in module pNbody.phot)}
\begin{fulllineitems}
\phantomsection\label{rst/PhotModule:pNbody.phot.MvtoLv}\pysiglinewithargsret{\code{pNbody.phot.}\bfcode{MvtoLv}}{\emph{Mv}, \emph{Mvsun=4.8300000000000001}, \emph{Lvsun=1.0}}{}
Mv : magnitude in V-band
Mvsun : magnitude of the sun in V-band
Lvsun : V-band solar luminosity in solar luminosity unit
Return the corresponding V-band luminosity in solar luminosity unit.
\end{fulllineitems}
\section{the cooling module}
\label{rst/CoolingModule::doc}\label{rst/CoolingModule:the-cooling-module}
\section{the C asciilib module}
\label{rst/C_asciilib:the-c-asciilib-module}\label{rst/C_asciilib:module-pNbody.asciilib}\label{rst/C_asciilib::doc}\index{pNbody.asciilib (module)}\index{read() (in module pNbody.asciilib)}
\begin{fulllineitems}
\phantomsection\label{rst/C_asciilib:pNbody.asciilib.read}\pysiglinewithargsret{\code{pNbody.asciilib.}\bfcode{read}}{}{}
Read ascii file
\end{fulllineitems}
\section{the C coolinglib module}
\label{rst/C_coolinglib::doc}\label{rst/C_coolinglib:the-c-coolinglib-module}\phantomsection\label{rst/C_coolinglib:module-pNbody.coolinglib}\index{pNbody.coolinglib (module)}\index{cooling() (in module pNbody.coolinglib)}
\begin{fulllineitems}
\phantomsection\label{rst/C_coolinglib:pNbody.coolinglib.cooling}\pysiglinewithargsret{\code{pNbody.coolinglib.}\bfcode{cooling}}{}{}
Return Mu and Lambda. Energy spec and Density must be in cgs.
\end{fulllineitems}
\index{cooling\_from\_nH\_and\_T() (in module pNbody.coolinglib)}
\begin{fulllineitems}
\phantomsection\label{rst/C_coolinglib:pNbody.coolinglib.cooling_from_nH_and_T}\pysiglinewithargsret{\code{pNbody.coolinglib.}\bfcode{cooling\_from\_nH\_and\_T}}{}{}
Return Mu and Lambda. Temperature and Hydrogen Density must be in cgs.
\end{fulllineitems}
\section{the C cooling\_with\_metals module}
\label{rst/C_cooling_with_metals::doc}\label{rst/C_cooling_with_metals:the-c-cooling-with-metals-module}\phantomsection\label{rst/C_cooling_with_metals:module-pNbody.cooling_with_metals}\index{pNbody.cooling\_with\_metals (module)}\index{PrintParameters() (in module pNbody.cooling\_with\_metals)}
\begin{fulllineitems}
\phantomsection\label{rst/C_cooling_with_metals:pNbody.cooling_with_metals.PrintParameters}\pysiglinewithargsret{\code{pNbody.cooling\_with\_metals.}\bfcode{PrintParameters}}{}{}
Print parameters.
\end{fulllineitems}
\index{get\_cooling\_time\_from\_Density\_EnergyInt\_FeH() (in module pNbody.cooling\_with\_metals)}
\begin{fulllineitems}
\phantomsection\label{rst/C_cooling_with_metals:pNbody.cooling_with_metals.get_cooling_time_from_Density_EnergyInt_FeH}\pysiglinewithargsret{\code{pNbody.cooling\_with\_metals.}\bfcode{get\_cooling\_time\_from\_Density\_EnergyInt\_FeH}}{}{}
Get the cooling time in user units.
\end{fulllineitems}
\index{get\_cooling\_time\_from\_Density\_Temperature\_FeH() (in module pNbody.cooling\_with\_metals)}
\begin{fulllineitems}
\phantomsection\label{rst/C_cooling_with_metals:pNbody.cooling_with_metals.get_cooling_time_from_Density_Temperature_FeH}\pysiglinewithargsret{\code{pNbody.cooling\_with\_metals.}\bfcode{get\_cooling\_time\_from\_Density\_Temperature\_FeH}}{}{}
Get the cooling time in user units.
\end{fulllineitems}
\index{get\_lambda\_from\_Density\_EnergyInt\_FeH() (in module pNbody.cooling\_with\_metals)}
\begin{fulllineitems}
\phantomsection\label{rst/C_cooling_with_metals:pNbody.cooling_with_metals.get_lambda_from_Density_EnergyInt_FeH}\pysiglinewithargsret{\code{pNbody.cooling\_with\_metals.}\bfcode{get\_lambda\_from\_Density\_EnergyInt\_FeH}}{}{}
Get the lambda function in user units.
\end{fulllineitems}
\index{get\_lambda\_from\_Density\_Entropy\_FeH() (in module pNbody.cooling\_with\_metals)}
\begin{fulllineitems}
\phantomsection\label{rst/C_cooling_with_metals:pNbody.cooling_with_metals.get_lambda_from_Density_Entropy_FeH}\pysiglinewithargsret{\code{pNbody.cooling\_with\_metals.}\bfcode{get\_lambda\_from\_Density\_Entropy\_FeH}}{}{}
Get the lambda function in user units.
\end{fulllineitems}
\index{get\_lambda\_from\_Density\_Temperature\_FeH() (in module pNbody.cooling\_with\_metals)}
\begin{fulllineitems}
\phantomsection\label{rst/C_cooling_with_metals:pNbody.cooling_with_metals.get_lambda_from_Density_Temperature_FeH}\pysiglinewithargsret{\code{pNbody.cooling\_with\_metals.}\bfcode{get\_lambda\_from\_Density\_Temperature\_FeH}}{}{}
Get the lambda function in user units.
\end{fulllineitems}
\index{get\_lambda\_normalized\_from\_Temperature\_FeH() (in module pNbody.cooling\_with\_metals)}
\begin{fulllineitems}
\phantomsection\label{rst/C_cooling_with_metals:pNbody.cooling_with_metals.get_lambda_normalized_from_Temperature_FeH}\pysiglinewithargsret{\code{pNbody.cooling\_with\_metals.}\bfcode{get\_lambda\_normalized\_from\_Temperature\_FeH}}{}{}
Get the normalized lambda function in mks.
\end{fulllineitems}
\index{init\_cooling() (in module pNbody.cooling\_with\_metals)}
\begin{fulllineitems}
\phantomsection\label{rst/C_cooling_with_metals:pNbody.cooling_with_metals.init_cooling}\pysiglinewithargsret{\code{pNbody.cooling\_with\_metals.}\bfcode{init\_cooling}}{}{}
Init cooling.
\end{fulllineitems}
\index{integrate1() (in module pNbody.cooling\_with\_metals)}
\begin{fulllineitems}
\phantomsection\label{rst/C_cooling_with_metals:pNbody.cooling_with_metals.integrate1}\pysiglinewithargsret{\code{pNbody.cooling\_with\_metals.}\bfcode{integrate1}}{}{}
Integrate cooling during a timestep using first scheme of integration.
\end{fulllineitems}
\index{integrate2() (in module pNbody.cooling\_with\_metals)}
\begin{fulllineitems}
\phantomsection\label{rst/C_cooling_with_metals:pNbody.cooling_with_metals.integrate2}\pysiglinewithargsret{\code{pNbody.cooling\_with\_metals.}\bfcode{integrate2}}{}{}
Integrate cooling during a timestep using second scheme of integration.
\end{fulllineitems}
\section{the C cosmolib module}
\label{rst/C_cosmolib:the-c-cosmolib-module}\label{rst/C_cosmolib::doc}\label{rst/C_cosmolib:module-pNbody.cosmolib}\index{pNbody.cosmolib (module)}\index{Age\_a() (in module pNbody.cosmolib)}
\begin{fulllineitems}
\phantomsection\label{rst/C_cosmolib:pNbody.cosmolib.Age_a}\pysiglinewithargsret{\code{pNbody.cosmolib.}\bfcode{Age\_a}}{}{}
Return age of the univers as a function of a (expansion factor).
\end{fulllineitems}
\section{the C iclib module}
\label{rst/C_iclib:the-c-iclib-module}\label{rst/C_iclib::doc}\label{rst/C_iclib:module-pNbody.iclib}\index{pNbody.iclib (module)}\index{burkert() (in module pNbody.iclib)}
\begin{fulllineitems}
\phantomsection\label{rst/C_iclib:pNbody.iclib.burkert}\pysiglinewithargsret{\code{pNbody.iclib.}\bfcode{burkert}}{}{}
Return position of a burkert model.
\end{fulllineitems}
\index{exponential\_disk() (in module pNbody.iclib)}
\begin{fulllineitems}
\phantomsection\label{rst/C_iclib:pNbody.iclib.exponential_disk}\pysiglinewithargsret{\code{pNbody.iclib.}\bfcode{exponential\_disk}}{}{}
Return position of an exponential disk.
\end{fulllineitems}
\index{generic\_Mr() (in module pNbody.iclib)}
\begin{fulllineitems}
\phantomsection\label{rst/C_iclib:pNbody.iclib.generic_Mr}\pysiglinewithargsret{\code{pNbody.iclib.}\bfcode{generic\_Mr}}{}{}
Return position following the density given by M(r)=Mr.
\end{fulllineitems}
\index{generic\_Mx() (in module pNbody.iclib)}
\begin{fulllineitems}
\phantomsection\label{rst/C_iclib:pNbody.iclib.generic_Mx}\pysiglinewithargsret{\code{pNbody.iclib.}\bfcode{generic\_Mx}}{}{}
Return position following the density given by M(x)=Mx. We assume an homogeneous distribution in y and z.
\end{fulllineitems}
\index{generic\_Mx1D() (in module pNbody.iclib)}
\begin{fulllineitems}
\phantomsection\label{rst/C_iclib:pNbody.iclib.generic_Mx1D}\pysiglinewithargsret{\code{pNbody.iclib.}\bfcode{generic\_Mx1D}}{}{}
Return position following the density given by M(x)=Mx. Return only x.
\end{fulllineitems}
\index{generic\_alpha() (in module pNbody.iclib)}
\begin{fulllineitems}
\phantomsection\label{rst/C_iclib:pNbody.iclib.generic_alpha}\pysiglinewithargsret{\code{pNbody.iclib.}\bfcode{generic\_alpha}}{}{}
Return position following the density (r+eps)\textasciicircum{}a.
\end{fulllineitems}
\index{miyamoto\_nagai() (in module pNbody.iclib)}
\begin{fulllineitems}
\phantomsection\label{rst/C_iclib:pNbody.iclib.miyamoto_nagai}\pysiglinewithargsret{\code{pNbody.iclib.}\bfcode{miyamoto\_nagai}}{}{}
Return position of a miyamoto\_nagai model.
\end{fulllineitems}
\index{miyamoto\_nagai\_f() (in module pNbody.iclib)}
\begin{fulllineitems}
\phantomsection\label{rst/C_iclib:pNbody.iclib.miyamoto_nagai_f}\pysiglinewithargsret{\code{pNbody.iclib.}\bfcode{miyamoto\_nagai\_f}}{}{}
Return position of a miyamoto\_nagai model divided by f(R).
\end{fulllineitems}
\index{nfwg() (in module pNbody.iclib)}
\begin{fulllineitems}
\phantomsection\label{rst/C_iclib:pNbody.iclib.nfwg}\pysiglinewithargsret{\code{pNbody.iclib.}\bfcode{nfwg}}{}{}
Return position of a nfwg model.
\end{fulllineitems}
\section{the C mapping module}
\label{rst/C_mapping:the-c-mapping-module}\label{rst/C_mapping:module-pNbody.mapping}\label{rst/C_mapping::doc}\index{pNbody.mapping (module)}\index{create\_line() (in module pNbody.mapping)}
\begin{fulllineitems}
\phantomsection\label{rst/C_mapping:pNbody.mapping.create_line}\pysiglinewithargsret{\code{pNbody.mapping.}\bfcode{create\_line}}{}{}
Add a line in the given matrice using the Bresenham algorithm.
\end{fulllineitems}
\index{create\_line2() (in module pNbody.mapping)}
\begin{fulllineitems}
\phantomsection\label{rst/C_mapping:pNbody.mapping.create_line2}\pysiglinewithargsret{\code{pNbody.mapping.}\bfcode{create\_line2}}{}{}
Add a line in the given matrice using the Bresenham algorithm.
\end{fulllineitems}
\index{create\_line3() (in module pNbody.mapping)}
\begin{fulllineitems}
\phantomsection\label{rst/C_mapping:pNbody.mapping.create_line3}\pysiglinewithargsret{\code{pNbody.mapping.}\bfcode{create\_line3}}{}{}
Add a line in the given matrice using a personal algorithm.
\end{fulllineitems}
\index{mkmap1d() (in module pNbody.mapping)}
\begin{fulllineitems}
\phantomsection\label{rst/C_mapping:pNbody.mapping.mkmap1d}\pysiglinewithargsret{\code{pNbody.mapping.}\bfcode{mkmap1d}}{}{}
Return a 1d mapping.
\end{fulllineitems}
\index{mkmap1dn() (in module pNbody.mapping)}
\begin{fulllineitems}
\phantomsection\label{rst/C_mapping:pNbody.mapping.mkmap1dn}\pysiglinewithargsret{\code{pNbody.mapping.}\bfcode{mkmap1dn}}{}{}
Return a 1d mapping.
\end{fulllineitems}
\index{mkmap1dw() (in module pNbody.mapping)}
\begin{fulllineitems}
\phantomsection\label{rst/C_mapping:pNbody.mapping.mkmap1dw}\pysiglinewithargsret{\code{pNbody.mapping.}\bfcode{mkmap1dw}}{}{}
Return a 1d mapping (a particle is distributed over 2 nodes).
\end{fulllineitems}
\index{mkmap2d() (in module pNbody.mapping)}
\begin{fulllineitems}
\phantomsection\label{rst/C_mapping:pNbody.mapping.mkmap2d}\pysiglinewithargsret{\code{pNbody.mapping.}\bfcode{mkmap2d}}{}{}
Return a 2d mapping.
\end{fulllineitems}
\index{mkmap2dn() (in module pNbody.mapping)}
\begin{fulllineitems}
\phantomsection\label{rst/C_mapping:pNbody.mapping.mkmap2dn}\pysiglinewithargsret{\code{pNbody.mapping.}\bfcode{mkmap2dn}}{}{}
Return a 2d mapping.
\end{fulllineitems}
\index{mkmap2dnsph() (in module pNbody.mapping)}
\begin{fulllineitems}
\phantomsection\label{rst/C_mapping:pNbody.mapping.mkmap2dnsph}\pysiglinewithargsret{\code{pNbody.mapping.}\bfcode{mkmap2dnsph}}{}{}
Return a 2d smoothed maping.
\end{fulllineitems}
\index{mkmap2dsph() (in module pNbody.mapping)}
\begin{fulllineitems}
\phantomsection\label{rst/C_mapping:pNbody.mapping.mkmap2dsph}\pysiglinewithargsret{\code{pNbody.mapping.}\bfcode{mkmap2dsph}}{}{}
Return a 2d smoothed maping.
\end{fulllineitems}
\index{mkmap2dw() (in module pNbody.mapping)}
\begin{fulllineitems}
\phantomsection\label{rst/C_mapping:pNbody.mapping.mkmap2dw}\pysiglinewithargsret{\code{pNbody.mapping.}\bfcode{mkmap2dw}}{}{}
Return a 2d mapping (a particle is distributed over 4 nodes).
\end{fulllineitems}
\index{mkmap3d() (in module pNbody.mapping)}
\begin{fulllineitems}
\phantomsection\label{rst/C_mapping:pNbody.mapping.mkmap3d}\pysiglinewithargsret{\code{pNbody.mapping.}\bfcode{mkmap3d}}{}{}
Return a 3d mapping.
\end{fulllineitems}
\index{mkmap3dn() (in module pNbody.mapping)}
\begin{fulllineitems}
\phantomsection\label{rst/C_mapping:pNbody.mapping.mkmap3dn}\pysiglinewithargsret{\code{pNbody.mapping.}\bfcode{mkmap3dn}}{}{}
Return a 3d mapping.
\end{fulllineitems}
\index{mkmap3dslicesph() (in module pNbody.mapping)}
\begin{fulllineitems}
\phantomsection\label{rst/C_mapping:pNbody.mapping.mkmap3dslicesph}\pysiglinewithargsret{\code{pNbody.mapping.}\bfcode{mkmap3dslicesph}}{}{}
Return a 3d slice (sph).
\end{fulllineitems}
\index{mkmap3dsortedsph() (in module pNbody.mapping)}
\begin{fulllineitems}
\phantomsection\label{rst/C_mapping:pNbody.mapping.mkmap3dsortedsph}\pysiglinewithargsret{\code{pNbody.mapping.}\bfcode{mkmap3dsortedsph}}{}{}
Return a 3d mapping (sph).
\end{fulllineitems}
\index{mkmap3dw() (in module pNbody.mapping)}
\begin{fulllineitems}
\phantomsection\label{rst/C_mapping:pNbody.mapping.mkmap3dw}\pysiglinewithargsret{\code{pNbody.mapping.}\bfcode{mkmap3dw}}{}{}
Return a 3d mapping (a particle is distributed over 8 nodes).
\end{fulllineitems}
\section{the C mapping-omp module (under construction)}
\label{rst/C_mapping-omp:the-c-mapping-omp-module-under-construction}\label{rst/C_mapping-omp::doc}
currently not available,
still under construction.
\section{the C montecarlolib module}
\label{rst/C_montecarlolib:the-c-montecarlolib-module}\label{rst/C_montecarlolib::doc}\phantomsection\label{rst/C_montecarlolib:module-pNbody.montecarlolib}\index{pNbody.montecarlolib (module)}\index{mc1d() (in module pNbody.montecarlolib)}
\begin{fulllineitems}
\phantomsection\label{rst/C_montecarlolib:pNbody.montecarlolib.mc1d}\pysiglinewithargsret{\code{pNbody.montecarlolib.}\bfcode{mc1d}}{}{}
Return a 1d monte carlo distribution.
\end{fulllineitems}
\index{mc2d() (in module pNbody.montecarlolib)}
\begin{fulllineitems}
\phantomsection\label{rst/C_montecarlolib:pNbody.montecarlolib.mc2d}\pysiglinewithargsret{\code{pNbody.montecarlolib.}\bfcode{mc2d}}{}{}
Return a 2d monte carlo distribution.
\end{fulllineitems}
\index{mc3d() (in module pNbody.montecarlolib)}
\begin{fulllineitems}
\phantomsection\label{rst/C_montecarlolib:pNbody.montecarlolib.mc3d}\pysiglinewithargsret{\code{pNbody.montecarlolib.}\bfcode{mc3d}}{}{}
Return a 3d monte carlo distribution.
\end{fulllineitems}
\section{the C myNumeric module}
\label{rst/C_myNumeric:the-c-mynumeric-module}\label{rst/C_myNumeric::doc}\label{rst/C_myNumeric:module-pNbody.myNumeric}\index{pNbody.myNumeric (module)}\index{Interpolate\_From\_1d\_Array() (in module pNbody.myNumeric)}
\begin{fulllineitems}
\phantomsection\label{rst/C_myNumeric:pNbody.myNumeric.Interpolate_From_1d_Array}\pysiglinewithargsret{\code{pNbody.myNumeric.}\bfcode{Interpolate\_From\_1d\_Array}}{}{}
Interpolate values from a given array.
\end{fulllineitems}
\index{Interpolate\_From\_2d\_Array() (in module pNbody.myNumeric)}
\begin{fulllineitems}
\phantomsection\label{rst/C_myNumeric:pNbody.myNumeric.Interpolate_From_2d_Array}\pysiglinewithargsret{\code{pNbody.myNumeric.}\bfcode{Interpolate\_From\_2d\_Array}}{}{}
Interpolate values from a given array.
\end{fulllineitems}
\index{expand() (in module pNbody.myNumeric)}
\begin{fulllineitems}
\phantomsection\label{rst/C_myNumeric:pNbody.myNumeric.expand}\pysiglinewithargsret{\code{pNbody.myNumeric.}\bfcode{expand}}{}{}
Expand a matrix.
\end{fulllineitems}
\index{getmask() (in module pNbody.myNumeric)}
\begin{fulllineitems}
\phantomsection\label{rst/C_myNumeric:pNbody.myNumeric.getmask}\pysiglinewithargsret{\code{pNbody.myNumeric.}\bfcode{getmask}}{}{}
Return a mask of the same type as x which has ones where elemets of x that have a corespondant in y and zeros instead.
\end{fulllineitems}
\index{histogram2d() (in module pNbody.myNumeric)}
\begin{fulllineitems}
\phantomsection\label{rst/C_myNumeric:pNbody.myNumeric.histogram2d}\pysiglinewithargsret{\code{pNbody.myNumeric.}\bfcode{histogram2d}}{}{}
Return a 2d matrix corresponding to the histrogram of two vector values in given ranges.
\end{fulllineitems}
\index{hnd() (in module pNbody.myNumeric)}
\begin{fulllineitems}
\phantomsection\label{rst/C_myNumeric:pNbody.myNumeric.hnd}\pysiglinewithargsret{\code{pNbody.myNumeric.}\bfcode{hnd}}{}{}
Return a 3d matrix corresponding to the histrogram in n dim of a vector 3xn
\end{fulllineitems}
\index{lininterp1d() (in module pNbody.myNumeric)}
\begin{fulllineitems}
\phantomsection\label{rst/C_myNumeric:pNbody.myNumeric.lininterp1d}\pysiglinewithargsret{\code{pNbody.myNumeric.}\bfcode{lininterp1d}}{}{}
Linear interpolation of 1d function given by two vectors.
\end{fulllineitems}
\index{polint() (in module pNbody.myNumeric)}
\begin{fulllineitems}
\phantomsection\label{rst/C_myNumeric:pNbody.myNumeric.polint}\pysiglinewithargsret{\code{pNbody.myNumeric.}\bfcode{polint}}{}{}
Polynomial interpolation.
\end{fulllineitems}
\index{quaddinterp1d() (in module pNbody.myNumeric)}
\begin{fulllineitems}
\phantomsection\label{rst/C_myNumeric:pNbody.myNumeric.quaddinterp1d}\pysiglinewithargsret{\code{pNbody.myNumeric.}\bfcode{quaddinterp1d}}{}{}
Quadratic interpolation of 1d function given by two vectors (the slope is continuous).
\end{fulllineitems}
\index{quadinterp1d() (in module pNbody.myNumeric)}
\begin{fulllineitems}
\phantomsection\label{rst/C_myNumeric:pNbody.myNumeric.quadinterp1d}\pysiglinewithargsret{\code{pNbody.myNumeric.}\bfcode{quadinterp1d}}{}{}
Quadratic interpolation of 1d function given by two vectors.
\end{fulllineitems}
\index{ratint() (in module pNbody.myNumeric)}
\begin{fulllineitems}
\phantomsection\label{rst/C_myNumeric:pNbody.myNumeric.ratint}\pysiglinewithargsret{\code{pNbody.myNumeric.}\bfcode{ratint}}{}{}
Polynomial interpolation.
\end{fulllineitems}
\index{rotx() (in module pNbody.myNumeric)}
\begin{fulllineitems}
\phantomsection\label{rst/C_myNumeric:pNbody.myNumeric.rotx}\pysiglinewithargsret{\code{pNbody.myNumeric.}\bfcode{rotx}}{}{}
Rotation around the x axis.
\end{fulllineitems}
\index{roty() (in module pNbody.myNumeric)}
\begin{fulllineitems}
\phantomsection\label{rst/C_myNumeric:pNbody.myNumeric.roty}\pysiglinewithargsret{\code{pNbody.myNumeric.}\bfcode{roty}}{}{}
Rotation around the y axis.
\end{fulllineitems}
\index{rotz() (in module pNbody.myNumeric)}
\begin{fulllineitems}
\phantomsection\label{rst/C_myNumeric:pNbody.myNumeric.rotz}\pysiglinewithargsret{\code{pNbody.myNumeric.}\bfcode{rotz}}{}{}
Rotation around the z axis.
\end{fulllineitems}
\index{spline() (in module pNbody.myNumeric)}
\begin{fulllineitems}
\phantomsection\label{rst/C_myNumeric:pNbody.myNumeric.spline}\pysiglinewithargsret{\code{pNbody.myNumeric.}\bfcode{spline}}{}{}
spline.
\end{fulllineitems}
\index{spline3d() (in module pNbody.myNumeric)}
\begin{fulllineitems}
\phantomsection\label{rst/C_myNumeric:pNbody.myNumeric.spline3d}\pysiglinewithargsret{\code{pNbody.myNumeric.}\bfcode{spline3d}}{}{}
Return a 3d interpolation.
\end{fulllineitems}
\index{splint() (in module pNbody.myNumeric)}
\begin{fulllineitems}
\phantomsection\label{rst/C_myNumeric:pNbody.myNumeric.splint}\pysiglinewithargsret{\code{pNbody.myNumeric.}\bfcode{splint}}{}{}
splint.
\end{fulllineitems}
\index{test() (in module pNbody.myNumeric)}
\begin{fulllineitems}
\phantomsection\label{rst/C_myNumeric:pNbody.myNumeric.test}\pysiglinewithargsret{\code{pNbody.myNumeric.}\bfcode{test}}{}{}
Some test on PyArray object.
\end{fulllineitems}
\index{turnup() (in module pNbody.myNumeric)}
\begin{fulllineitems}
\phantomsection\label{rst/C_myNumeric:pNbody.myNumeric.turnup}\pysiglinewithargsret{\code{pNbody.myNumeric.}\bfcode{turnup}}{}{}
Turn up a matrix.
\end{fulllineitems}
\index{vprod() (in module pNbody.myNumeric)}
\begin{fulllineitems}
\phantomsection\label{rst/C_myNumeric:pNbody.myNumeric.vprod}\pysiglinewithargsret{\code{pNbody.myNumeric.}\bfcode{vprod}}{}{}
Calculate the vectorial product of two vectors.
\end{fulllineitems}
\index{whistogram() (in module pNbody.myNumeric)}
\begin{fulllineitems}
\phantomsection\label{rst/C_myNumeric:pNbody.myNumeric.whistogram}\pysiglinewithargsret{\code{pNbody.myNumeric.}\bfcode{whistogram}}{}{}
Return a weighted histogram.
\end{fulllineitems}
\section{the C nbdrklib module}
\label{rst/C_nbdrklib:the-c-nbdrklib-module}\label{rst/C_nbdrklib::doc}\label{rst/C_nbdrklib:module-pNbody.nbdrklib}\index{pNbody.nbdrklib (module)}\index{Compute() (in module pNbody.nbdrklib)}
\begin{fulllineitems}
\phantomsection\label{rst/C_nbdrklib:pNbody.nbdrklib.Compute}\pysiglinewithargsret{\code{pNbody.nbdrklib.}\bfcode{Compute}}{}{}
Compute all.
\end{fulllineitems}
\index{IntegrateOverDt() (in module pNbody.nbdrklib)}
\begin{fulllineitems}
\phantomsection\label{rst/C_nbdrklib:pNbody.nbdrklib.IntegrateOverDt}\pysiglinewithargsret{\code{pNbody.nbdrklib.}\bfcode{IntegrateOverDt}}{}{}
Integrate the system over dt.
\end{fulllineitems}
\section{the C nbodymodule module}
\label{rst/C_nbodymodule:the-c-nbodymodule-module}\label{rst/C_nbodymodule::doc}\phantomsection\label{rst/C_nbodymodule:module-pNbody.nbodymodule}\index{pNbody.nbodymodule (module)}\index{acceleration() (in module pNbody.nbodymodule)}
\begin{fulllineitems}
\phantomsection\label{rst/C_nbodymodule:pNbody.nbodymodule.acceleration}\pysiglinewithargsret{\code{pNbody.nbodymodule.}\bfcode{acceleration}}{}{}
Calculate the acceleration at a given position, with a given softening.
\end{fulllineitems}
\index{am() (in module pNbody.nbodymodule)}
\begin{fulllineitems}
\phantomsection\label{rst/C_nbodymodule:pNbody.nbodymodule.am}\pysiglinewithargsret{\code{pNbody.nbodymodule.}\bfcode{am}}{}{}
Calculate the angular momentum of the model.
\end{fulllineitems}
\index{ampmap() (in module pNbody.nbodymodule)}
\begin{fulllineitems}
\phantomsection\label{rst/C_nbodymodule:pNbody.nbodymodule.ampmap}\pysiglinewithargsret{\code{pNbody.nbodymodule.}\bfcode{ampmap}}{}{}
Return a map of amplitude of the given points.
\end{fulllineitems}
\index{amxyz() (in module pNbody.nbodymodule)}
\begin{fulllineitems}
\phantomsection\label{rst/C_nbodymodule:pNbody.nbodymodule.amxyz}\pysiglinewithargsret{\code{pNbody.nbodymodule.}\bfcode{amxyz}}{}{}
Calculate the angular momentum in x,y,z for all particles.
\end{fulllineitems}
\index{convol() (in module pNbody.nbodymodule)}
\begin{fulllineitems}
\phantomsection\label{rst/C_nbodymodule:pNbody.nbodymodule.convol}\pysiglinewithargsret{\code{pNbody.nbodymodule.}\bfcode{convol}}{}{}
Return a 2d convolution of a with kernel b.
\end{fulllineitems}
\index{epot() (in module pNbody.nbodymodule)}
\begin{fulllineitems}
\phantomsection\label{rst/C_nbodymodule:pNbody.nbodymodule.epot}\pysiglinewithargsret{\code{pNbody.nbodymodule.}\bfcode{epot}}{}{}
Calculate the total potential energy.
\end{fulllineitems}
\index{pamap() (in module pNbody.nbodymodule)}
\begin{fulllineitems}
\phantomsection\label{rst/C_nbodymodule:pNbody.nbodymodule.pamap}\pysiglinewithargsret{\code{pNbody.nbodymodule.}\bfcode{pamap}}{}{}
Return a map of the given points.
\end{fulllineitems}
\index{pdmap() (in module pNbody.nbodymodule)}
\begin{fulllineitems}
\phantomsection\label{rst/C_nbodymodule:pNbody.nbodymodule.pdmap}\pysiglinewithargsret{\code{pNbody.nbodymodule.}\bfcode{pdmap}}{}{}
Return a ponderated map of the given points.
\end{fulllineitems}
\index{perspective() (in module pNbody.nbodymodule)}
\begin{fulllineitems}
\phantomsection\label{rst/C_nbodymodule:pNbody.nbodymodule.perspective}\pysiglinewithargsret{\code{pNbody.nbodymodule.}\bfcode{perspective}}{}{}
Return a 3d projection of the given points.
\end{fulllineitems}
\index{potential() (in module pNbody.nbodymodule)}
\begin{fulllineitems}
\phantomsection\label{rst/C_nbodymodule:pNbody.nbodymodule.potential}\pysiglinewithargsret{\code{pNbody.nbodymodule.}\bfcode{potential}}{}{}
Calculate the potential at a given position, with a given softening.
\end{fulllineitems}
\index{rotx() (in module pNbody.nbodymodule)}
\begin{fulllineitems}
\phantomsection\label{rst/C_nbodymodule:pNbody.nbodymodule.rotx}\pysiglinewithargsret{\code{pNbody.nbodymodule.}\bfcode{rotx}}{}{}
Rotation around the x axis.
\end{fulllineitems}
\index{roty() (in module pNbody.nbodymodule)}
\begin{fulllineitems}
\phantomsection\label{rst/C_nbodymodule:pNbody.nbodymodule.roty}\pysiglinewithargsret{\code{pNbody.nbodymodule.}\bfcode{roty}}{}{}
Rotation around the y axis.
\end{fulllineitems}
\index{rotz() (in module pNbody.nbodymodule)}
\begin{fulllineitems}
\phantomsection\label{rst/C_nbodymodule:pNbody.nbodymodule.rotz}\pysiglinewithargsret{\code{pNbody.nbodymodule.}\bfcode{rotz}}{}{}
Rotation around the z axis.
\end{fulllineitems}
\index{samxyz() (in module pNbody.nbodymodule)}
\begin{fulllineitems}
\phantomsection\label{rst/C_nbodymodule:pNbody.nbodymodule.samxyz}\pysiglinewithargsret{\code{pNbody.nbodymodule.}\bfcode{samxyz}}{}{}
Calculate the specific angular momentum in x,y,z for all particles.
\end{fulllineitems}
\index{sphmap() (in module pNbody.nbodymodule)}
\begin{fulllineitems}
\phantomsection\label{rst/C_nbodymodule:pNbody.nbodymodule.sphmap}\pysiglinewithargsret{\code{pNbody.nbodymodule.}\bfcode{sphmap}}{}{}
Return a sphmap of the given points.
\end{fulllineitems}
\index{spin() (in module pNbody.nbodymodule)}
\begin{fulllineitems}
\phantomsection\label{rst/C_nbodymodule:pNbody.nbodymodule.spin}\pysiglinewithargsret{\code{pNbody.nbodymodule.}\bfcode{spin}}{}{}
Spin the model around an axis.
\end{fulllineitems}
\section{the C peanolib module}
\label{rst/C_peanolib::doc}\label{rst/C_peanolib:module-pNbody.peanolib}\label{rst/C_peanolib:the-c-peanolib-module}\index{pNbody.peanolib (module)}\index{peano2xyz() (in module pNbody.peanolib)}
\begin{fulllineitems}
\phantomsection\label{rst/C_peanolib:pNbody.peanolib.peano2xyz}\pysiglinewithargsret{\code{pNbody.peanolib.}\bfcode{peano2xyz}}{}{}
From a peano key return a triplet xyz.
\end{fulllineitems}
\index{xyz2peano() (in module pNbody.peanolib)}
\begin{fulllineitems}
\phantomsection\label{rst/C_peanolib:pNbody.peanolib.xyz2peano}\pysiglinewithargsret{\code{pNbody.peanolib.}\bfcode{xyz2peano}}{}{}
From a triplet xyz return a peano key.
\end{fulllineitems}
\section{the C pmlib module (never developped)}
\label{rst/C_pmlib:the-c-pmlib-module-never-developped}\label{rst/C_pmlib::doc}
currently not available,
still under construction.
\section{the C ptreelib module (obsolete)}
\label{rst/C_ptreelib:the-c-ptreelib-module-obsolete}\label{rst/C_ptreelib::doc}
currently not available,
still under construction.
\section{the C PyGadget module}
\label{rst/C_PyGadget::doc}\label{rst/C_PyGadget:the-c-pygadget-module}
This mpdule is currently not completely integrated to \textbf{pNbody}.
It is part of the \textbf{pNbody} package but must be compiled
separately.
For mpi, use:
\begin{Verbatim}[commandchars=@\[\]]
export CC=mpirun
\end{Verbatim}
\section{the C pygsl module}
\label{rst/C_pygsl:module-pNbody.pygsl}\label{rst/C_pygsl::doc}\label{rst/C_pygsl:the-c-pygsl-module}\index{pNbody.pygsl (module)}\index{sobol\_sequence() (in module pNbody.pygsl)}
\begin{fulllineitems}
\phantomsection\label{rst/C_pygsl:pNbody.pygsl.sobol_sequence}\pysiglinewithargsret{\code{pNbody.pygsl.}\bfcode{sobol\_sequence}}{}{}
Return a sobol sequence of len n and of dimension d.
\end{fulllineitems}
\section{the C streelib module (under construction)}
\label{rst/C_streelib:the-c-streelib-module-under-construction}\label{rst/C_streelib::doc}
currently not available,
still under construction.
\section{the C tessel module}
\label{rst/C_tessel:the-c-tessel-module}\label{rst/C_tessel::doc}\label{rst/C_tessel:module-pNbody.tessel}\index{pNbody.tessel (module)}\index{CircumCircleProperties() (in module pNbody.tessel)}
\begin{fulllineitems}
\phantomsection\label{rst/C_tessel:pNbody.tessel.CircumCircleProperties}\pysiglinewithargsret{\code{pNbody.tessel.}\bfcode{CircumCircleProperties}}{}{}
Get Circum Circle Properties
\end{fulllineitems}
\index{ComputeIsoContours() (in module pNbody.tessel)}
\begin{fulllineitems}
\phantomsection\label{rst/C_tessel:pNbody.tessel.ComputeIsoContours}\pysiglinewithargsret{\code{pNbody.tessel.}\bfcode{ComputeIsoContours}}{}{}
Compute iso-contours.
\end{fulllineitems}
\index{ConstructDelaunay() (in module pNbody.tessel)}
\begin{fulllineitems}
\phantomsection\label{rst/C_tessel:pNbody.tessel.ConstructDelaunay}\pysiglinewithargsret{\code{pNbody.tessel.}\bfcode{ConstructDelaunay}}{}{}
Construct the Delaunay tesselation for a given sample of points
\end{fulllineitems}
\index{GetTriangles() (in module pNbody.tessel)}
\begin{fulllineitems}
\phantomsection\label{rst/C_tessel:pNbody.tessel.GetTriangles}\pysiglinewithargsret{\code{pNbody.tessel.}\bfcode{GetTriangles}}{}{}
Get the trianles in a list of 3x3 arrays.
\end{fulllineitems}
\index{GetVoronoi() (in module pNbody.tessel)}
\begin{fulllineitems}
\phantomsection\label{rst/C_tessel:pNbody.tessel.GetVoronoi}\pysiglinewithargsret{\code{pNbody.tessel.}\bfcode{GetVoronoi}}{}{}
Get a list of segements corresponding to the voronoi.
\end{fulllineitems}
\index{InCircumCircle() (in module pNbody.tessel)}
\begin{fulllineitems}
\phantomsection\label{rst/C_tessel:pNbody.tessel.InCircumCircle}\pysiglinewithargsret{\code{pNbody.tessel.}\bfcode{InCircumCircle}}{}{}
Return if the circum circle of the triangle (P1,P2,P3) contains the point P4
\end{fulllineitems}
\index{InTriangle() (in module pNbody.tessel)}
\begin{fulllineitems}
\phantomsection\label{rst/C_tessel:pNbody.tessel.InTriangle}\pysiglinewithargsret{\code{pNbody.tessel.}\bfcode{InTriangle}}{}{}
Return if the triangle (P1,P2,P3) contains the point P4
\end{fulllineitems}
\index{InTriangleOrOutside() (in module pNbody.tessel)}
\begin{fulllineitems}
\phantomsection\label{rst/C_tessel:pNbody.tessel.InTriangleOrOutside}\pysiglinewithargsret{\code{pNbody.tessel.}\bfcode{InTriangleOrOutside}}{}{}
Return if the triangle (P1,P2,P3) contains the point P4
\end{fulllineitems}
\index{TriangleMedians() (in module pNbody.tessel)}
\begin{fulllineitems}
\phantomsection\label{rst/C_tessel:pNbody.tessel.TriangleMedians}\pysiglinewithargsret{\code{pNbody.tessel.}\bfcode{TriangleMedians}}{}{}
Get Triangle Medians
\end{fulllineitems}
\index{info() (in module pNbody.tessel)}
\begin{fulllineitems}
\phantomsection\label{rst/C_tessel:pNbody.tessel.info}\pysiglinewithargsret{\code{pNbody.tessel.}\bfcode{info}}{}{}
info on tesselation
\end{fulllineitems}
\index{test() (in module pNbody.tessel)}
\begin{fulllineitems}
\phantomsection\label{rst/C_tessel:pNbody.tessel.test}\pysiglinewithargsret{\code{pNbody.tessel.}\bfcode{test}}{}{}
Simple Test
\end{fulllineitems}
\section{the C treelib module}
\label{rst/C_treelib:module-pNbody.treelib}\label{rst/C_treelib::doc}\label{rst/C_treelib:the-c-treelib-module}\index{pNbody.treelib (module)}
Provides serial tree routines based on Gadget-2. Should be replaced by PyGadget.
\chapter{Indices and tables}
\label{index:indices-and-tables}\begin{itemize}
\item {}
\emph{genindex}
\item {}
\emph{modindex}
\item {}
\emph{search}
\end{itemize}
\renewcommand{\indexname}{Python Module Index}
\begin{theindex}
\def\bigletter#1{{\Large\sffamily#1}\nopagebreak\vspace{1mm}}
\bigletter{p}
\item {\texttt{pNbody.asciilib}}, \pageref{rst/C_asciilib:module-pNbody.asciilib}
\item {\texttt{pNbody.cooling\_with\_metals}}, \pageref{rst/C_cooling_with_metals:module-pNbody.cooling_with_metals}
\item {\texttt{pNbody.coolinglib}}, \pageref{rst/C_coolinglib:module-pNbody.coolinglib}
\item {\texttt{pNbody.cosmo}}, \pageref{rst/CosmoModule:module-pNbody.cosmo}
\item {\texttt{pNbody.cosmolib}}, \pageref{rst/C_cosmolib:module-pNbody.cosmolib}
\item {\texttt{pNbody.ctes}}, \pageref{rst/CtesModule:module-pNbody.ctes}
\item {\texttt{pNbody.fortranfile}}, \pageref{rst/FortranfileModule:module-pNbody.fortranfile}
\item {\texttt{pNbody.fourier}}, \pageref{rst/FourierModule:module-pNbody.fourier}
\item {\texttt{pNbody.geometry}}, \pageref{rst/GeometryModule:module-pNbody.geometry}
\item {\texttt{pNbody.ic}}, \pageref{rst/IcModule:module-pNbody.ic}
\item {\texttt{pNbody.iclib}}, \pageref{rst/C_iclib:module-pNbody.iclib}
\item {\texttt{pNbody.libdisk}}, \pageref{rst/LibdiskModule:module-pNbody.libdisk}
\item {\texttt{pNbody.libgrid}}, \pageref{rst/LibgridModule:module-pNbody.libgrid}
\item {\texttt{pNbody.liblog}}, \pageref{rst/LiblogModule:module-pNbody.liblog}
\item {\texttt{pNbody.libmiyamoto}}, \pageref{rst/LibmiyamotoModule:module-pNbody.libmiyamoto}
\item {\texttt{pNbody.libqt}}, \pageref{rst/LibqtModule:module-pNbody.libqt}
\item {\texttt{pNbody.libutil}}, \pageref{rst/LibutilModule:module-pNbody.libutil}
\item {\texttt{pNbody.main}}, \pageref{rst/MainModule:module-pNbody.main}
\item {\texttt{pNbody.mapping}}, \pageref{rst/C_mapping:module-pNbody.mapping}
\item {\texttt{pNbody.montecarlolib}}, \pageref{rst/C_montecarlolib:module-pNbody.montecarlolib}
\item {\texttt{pNbody.Movie}}, \pageref{rst/MovieModule:module-pNbody.Movie}
\item {\texttt{pNbody.mpi}}, \pageref{rst/MpiModule:module-pNbody.mpi}
\item {\texttt{pNbody.myNumeric}}, \pageref{rst/C_myNumeric:module-pNbody.myNumeric}
\item {\texttt{pNbody.nbdrklib}}, \pageref{rst/C_nbdrklib:module-pNbody.nbdrklib}
\item {\texttt{pNbody.nbodymodule}}, \pageref{rst/C_nbodymodule:module-pNbody.nbodymodule}
\item {\texttt{pNbody.palette}}, \pageref{rst/PaletteModule:module-pNbody.palette}
\item {\texttt{pNbody.param}}, \pageref{rst/ParamModule:module-pNbody.param}
\item {\texttt{pNbody.parameters}}, \pageref{rst/ParameterModule:module-pNbody.parameters}
\item {\texttt{pNbody.peanolib}}, \pageref{rst/C_peanolib:module-pNbody.peanolib}
\item {\texttt{pNbody.phot}}, \pageref{rst/PhotModule:module-pNbody.phot}
\item {\texttt{pNbody.plummer}}, \pageref{rst/PlummerModule:module-pNbody.plummer}
\item {\texttt{pNbody.profiles}}, \pageref{rst/ProfilesModule:module-pNbody.profiles}
\item {\texttt{pNbody.pyfits}}, \pageref{rst/PyfitsModule:module-pNbody.pyfits}
\item {\texttt{pNbody.pygsl}}, \pageref{rst/C_pygsl:module-pNbody.pygsl}
\item {\texttt{pNbody.rec}}, \pageref{rst/RecModule:module-pNbody.rec}
\item {\texttt{pNbody.talkgdisp}}, \pageref{rst/TalkgdispModule:module-pNbody.talkgdisp}
\item {\texttt{pNbody.tessel}}, \pageref{rst/C_tessel:module-pNbody.tessel}
\item {\texttt{pNbody.thermodyn}}, \pageref{rst/ThermodynModule:module-pNbody.thermodyn}
\item {\texttt{pNbody.treelib}}, \pageref{rst/C_treelib:module-pNbody.treelib}
\item {\texttt{pNbody.units}}, \pageref{rst/UnitsModule:module-pNbody.units}
\end{theindex}
\renewcommand{\indexname}{Python Module Index}
\begin{theindex}
\def\bigletter#1{{\Large\sffamily#1}\nopagebreak\vspace{1mm}}
\bigletter{p}
\item {\texttt{pNbody.asciilib}}, \pageref{rst/C_asciilib:module-pNbody.asciilib}
\item {\texttt{pNbody.cooling\_with\_metals}}, \pageref{rst/C_cooling_with_metals:module-pNbody.cooling_with_metals}
\item {\texttt{pNbody.coolinglib}}, \pageref{rst/C_coolinglib:module-pNbody.coolinglib}
\item {\texttt{pNbody.cosmo}}, \pageref{rst/CosmoModule:module-pNbody.cosmo}
\item {\texttt{pNbody.cosmolib}}, \pageref{rst/C_cosmolib:module-pNbody.cosmolib}
\item {\texttt{pNbody.ctes}}, \pageref{rst/CtesModule:module-pNbody.ctes}
\item {\texttt{pNbody.fortranfile}}, \pageref{rst/FortranfileModule:module-pNbody.fortranfile}
\item {\texttt{pNbody.fourier}}, \pageref{rst/FourierModule:module-pNbody.fourier}
\item {\texttt{pNbody.geometry}}, \pageref{rst/GeometryModule:module-pNbody.geometry}
\item {\texttt{pNbody.ic}}, \pageref{rst/IcModule:module-pNbody.ic}
\item {\texttt{pNbody.iclib}}, \pageref{rst/C_iclib:module-pNbody.iclib}
\item {\texttt{pNbody.libdisk}}, \pageref{rst/LibdiskModule:module-pNbody.libdisk}
\item {\texttt{pNbody.libgrid}}, \pageref{rst/LibgridModule:module-pNbody.libgrid}
\item {\texttt{pNbody.liblog}}, \pageref{rst/LiblogModule:module-pNbody.liblog}
\item {\texttt{pNbody.libmiyamoto}}, \pageref{rst/LibmiyamotoModule:module-pNbody.libmiyamoto}
\item {\texttt{pNbody.libqt}}, \pageref{rst/LibqtModule:module-pNbody.libqt}
\item {\texttt{pNbody.libutil}}, \pageref{rst/LibutilModule:module-pNbody.libutil}
\item {\texttt{pNbody.main}}, \pageref{rst/MainModule:module-pNbody.main}
\item {\texttt{pNbody.mapping}}, \pageref{rst/C_mapping:module-pNbody.mapping}
\item {\texttt{pNbody.montecarlolib}}, \pageref{rst/C_montecarlolib:module-pNbody.montecarlolib}
\item {\texttt{pNbody.Movie}}, \pageref{rst/MovieModule:module-pNbody.Movie}
\item {\texttt{pNbody.mpi}}, \pageref{rst/MpiModule:module-pNbody.mpi}
\item {\texttt{pNbody.myNumeric}}, \pageref{rst/C_myNumeric:module-pNbody.myNumeric}
\item {\texttt{pNbody.nbdrklib}}, \pageref{rst/C_nbdrklib:module-pNbody.nbdrklib}
\item {\texttt{pNbody.nbodymodule}}, \pageref{rst/C_nbodymodule:module-pNbody.nbodymodule}
\item {\texttt{pNbody.palette}}, \pageref{rst/PaletteModule:module-pNbody.palette}
\item {\texttt{pNbody.param}}, \pageref{rst/ParamModule:module-pNbody.param}
\item {\texttt{pNbody.parameters}}, \pageref{rst/ParameterModule:module-pNbody.parameters}
\item {\texttt{pNbody.peanolib}}, \pageref{rst/C_peanolib:module-pNbody.peanolib}
\item {\texttt{pNbody.phot}}, \pageref{rst/PhotModule:module-pNbody.phot}
\item {\texttt{pNbody.plummer}}, \pageref{rst/PlummerModule:module-pNbody.plummer}
\item {\texttt{pNbody.profiles}}, \pageref{rst/ProfilesModule:module-pNbody.profiles}
\item {\texttt{pNbody.pyfits}}, \pageref{rst/PyfitsModule:module-pNbody.pyfits}
\item {\texttt{pNbody.pygsl}}, \pageref{rst/C_pygsl:module-pNbody.pygsl}
\item {\texttt{pNbody.rec}}, \pageref{rst/RecModule:module-pNbody.rec}
\item {\texttt{pNbody.talkgdisp}}, \pageref{rst/TalkgdispModule:module-pNbody.talkgdisp}
\item {\texttt{pNbody.tessel}}, \pageref{rst/C_tessel:module-pNbody.tessel}
\item {\texttt{pNbody.thermodyn}}, \pageref{rst/ThermodynModule:module-pNbody.thermodyn}
\item {\texttt{pNbody.treelib}}, \pageref{rst/C_treelib:module-pNbody.treelib}
\item {\texttt{pNbody.units}}, \pageref{rst/UnitsModule:module-pNbody.units}
\end{theindex}
\renewcommand{\indexname}{Index}
\printindex
\end{document}

Event Timeline