Page MenuHomec4science

IcModule.html
No OneTemporary

File Metadata

Created
Sun, May 26, 01:15

IcModule.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>the ic module &mdash; pNbody v4 documentation</title>
<link rel="stylesheet" href="../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '4',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<link rel="top" title="pNbody v4 documentation" href="../index.html" />
<link rel="up" title="Reference" href="Reference.html" />
<link rel="next" title="the io module" href="IoModule.html" />
<link rel="prev" title="the main module" href="MainModule.html" />
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="../np-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="IoModule.html" title="the io module"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="MainModule.html" title="the main module"
accesskey="P">previous</a> |</li>
<li><a href="../index.html">pNbody v4 documentation</a> &raquo;</li>
<li><a href="Reference.html" accesskey="U">Reference</a> &raquo;</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="module-pNbody.ic">
<span id="the-ic-module"></span><h1>the ic module<a class="headerlink" href="#module-pNbody.ic" title="Permalink to this headline"></a></h1>
<dl class="function">
<dt id="pNbody.ic.ComputeGridParameters">
<tt class="descclassname">pNbody.ic.</tt><tt class="descname">ComputeGridParameters</tt><big>(</big><em>n</em>, <em>args</em>, <em>rmax</em>, <em>M</em>, <em>pr_fct</em>, <em>mr_fct</em>, <em>Neps_des</em>, <em>rc</em>, <em>ng</em><big>)</big><a class="headerlink" href="#pNbody.ic.ComputeGridParameters" title="Permalink to this definition"></a></dt>
<dd><p>This function computes dR, the appropriate grid used to approximate Mr.</p>
<p>The grid is set in order to have &#8220;Neps_des&#8221; particles
in the first division of the grid. Then, the radius of the grid
follows an exponnential distribution up to rmax.</p>
<ol class="arabic">
<li><p class="first">from the density distribution, the total mass and the number of particles,
using a newton algorithm, it computes eps, the radius that will contains &#8220;Neps_des&#8221; particles</p>
</li>
<li><p class="first">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.</p>
<p>if the computation of rc fails, we use the default value of rc</p>
</li>
</ol>
<p>The function takes the following arguments</p>
<p>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</p>
<p>Neps_des : desired number of point in the first beam
rc : default size of the first beam
ng : number of grid divisions</p>
<p>it returns :</p>
<p>Rs : grid points
eps : radius containing about Neps_des particles
Neps : number of particles in eps</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.ic.ComputeGridParameters2">
<tt class="descclassname">pNbody.ic.</tt><tt class="descname">ComputeGridParameters2</tt><big>(</big><em>eps</em>, <em>nmax</em>, <em>args</em>, <em>rmax</em>, <em>M</em>, <em>pr_fct</em>, <em>mr_fct</em>, <em>Neps_des</em>, <em>rc</em>, <em>ng</em><big>)</big><a class="headerlink" href="#pNbody.ic.ComputeGridParameters2" title="Permalink to this definition"></a></dt>
<dd><p>This function computes dR, the appropriate grid used to approximate Mr.</p>
<p>The number of particle of the model is set in order to have &#8220;Neps_des&#8221; particles
in the first division of the grid. Then, the radius of the grid
follows an exponnential distribution up to rmax.</p>
<ol class="arabic">
<li><p class="first">n is set from the total mass and Neps_des</p>
</li>
<li><p class="first">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.</p>
<p>if the computation of rc fails, we use the default value of rc</p>
</li>
</ol>
<p>The function takes the following arguments</p>
<p>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</p>
<p>Neps_des : desired number of point in the first beam
rc : default size of the first beam
ng : number of grid divisions</p>
<p>it returns :</p>
<p>n : number of particles
Rs : grid points
rc : parameter of the scaling fct
g : scaling fct
gm : inverse of scaling fct</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.ic.box">
<tt class="descclassname">pNbody.ic.</tt><tt class="descname">box</tt><big>(</big><em>n</em>, <em>a</em>, <em>b</em>, <em>c</em>, <em>name='box.dat'</em>, <em>ftype='binary'</em>, <em>verbose=False</em><big>)</big><a class="headerlink" href="#pNbody.ic.box" title="Permalink to this definition"></a></dt>
<dd><p>Return an Nbody object that contains n particules distributed
in an homogeneous box of dimension a,b,c, centred at the origin
radius rmax.</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.ic.burkert">
<tt class="descclassname">pNbody.ic.</tt><tt class="descname">burkert</tt><big>(</big><em>n</em>, <em>rs</em>, <em>Rmax</em>, <em>dR</em>, <em>Rs=None</em>, <em>name='burkert.dat'</em>, <em>ftype='binary'</em>, <em>verbose=False</em><big>)</big><a class="headerlink" href="#pNbody.ic.burkert" title="Permalink to this definition"></a></dt>
<dd><p>Return an Nbody object that contains n particules following
a burkert profile.</p>
<p>rhob = 1 / ( ( 1 + r/rs ) * ( 1 + (r/rs)**2 ) )</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.ic.dl2">
<tt class="descclassname">pNbody.ic.</tt><tt class="descname">dl2</tt><big>(</big><em>n</em>, <em>a</em>, <em>b</em>, <em>c</em>, <em>eps</em>, <em>rmax</em>, <em>name='dl2.dat'</em>, <em>ftype='binary'</em>, <em>verbose=False</em><big>)</big><a class="headerlink" href="#pNbody.ic.dl2" title="Permalink to this definition"></a></dt>
<dd><p>Return an Nbody object that contains n particules distributed as</p>
<p>rho = (1.-eps*(r/rmax)**2)</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.ic.dl2_mr">
<tt class="descclassname">pNbody.ic.</tt><tt class="descname">dl2_mr</tt><big>(</big><em>r</em>, <em>args</em><big>)</big><a class="headerlink" href="#pNbody.ic.dl2_mr" title="Permalink to this definition"></a></dt>
<dd><p>Mass in the radius r for the distribution</p>
<p>rho = (1.-eps*(r/rmax)**2)</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.ic.expd">
<tt class="descclassname">pNbody.ic.</tt><tt class="descname">expd</tt><big>(</big><em>n</em>, <em>Hr</em>, <em>Hz</em>, <em>Rmax</em>, <em>Zmax</em>, <em>irand=1</em>, <em>name='expd.dat'</em>, <em>ftype='binary'</em>, <em>verbose=False</em><big>)</big><a class="headerlink" href="#pNbody.ic.expd" title="Permalink to this definition"></a></dt>
<dd><p>Exonential disk</p>
<p>rho = 1/(1+(r/rc)**2)</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.ic.expd_mr">
<tt class="descclassname">pNbody.ic.</tt><tt class="descname">expd_mr</tt><big>(</big><em>r</em>, <em>args</em><big>)</big><a class="headerlink" href="#pNbody.ic.expd_mr" title="Permalink to this definition"></a></dt>
<dd><p>Mass in the radius r for the distribution</p>
<p>Sigma = epx(-r)</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.ic.generic2c">
<tt class="descclassname">pNbody.ic.</tt><tt class="descname">generic2c</tt><big>(</big><em>n</em>, <em>rs</em>, <em>a</em>, <em>b</em>, <em>Rmax</em>, <em>dR</em>, <em>Rs=None</em>, <em>name='nfwg.dat'</em>, <em>ftype='binary'</em>, <em>verbose=False</em><big>)</big><a class="headerlink" href="#pNbody.ic.generic2c" title="Permalink to this definition"></a></dt>
<dd><p>Return an Nbody object that contains n particules following
an nfw modifed profile.</p>
<p>rho = 1/( (r/rs)**a * (1+r/rs)**(b-a) )</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.ic.generic_Mr">
<tt class="descclassname">pNbody.ic.</tt><tt class="descname">generic_Mr</tt><big>(</big><em>n</em>, <em>rmax</em>, <em>R=None</em>, <em>Mr=None</em>, <em>name='sphere_Mr.dat'</em>, <em>ftype='binary'</em>, <em>verbose=False</em><big>)</big><a class="headerlink" href="#pNbody.ic.generic_Mr" title="Permalink to this definition"></a></dt>
<dd><p>Distribute particles in order to reproduce M(R) given by Mr</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.ic.generic_Mx">
<tt class="descclassname">pNbody.ic.</tt><tt class="descname">generic_Mx</tt><big>(</big><em>n</em>, <em>xmax</em>, <em>x=None</em>, <em>Mx=None</em>, <em>name='box_Mx.dat'</em>, <em>ftype='binary'</em>, <em>verbose=False</em><big>)</big><a class="headerlink" href="#pNbody.ic.generic_Mx" title="Permalink to this definition"></a></dt>
<dd><p>Distribute particles in a box. The density in x is defined in order to reproduce M(x) given by Mx</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.ic.generic_alpha">
<tt class="descclassname">pNbody.ic.</tt><tt class="descname">generic_alpha</tt><big>(</big><em>n</em>, <em>a</em>, <em>e</em>, <em>rmax</em>, <em>irand=1</em>, <em>fct=None</em>, <em>name='generic_alpha.dat'</em>, <em>ftype='binary'</em>, <em>verbose=False</em><big>)</big><a class="headerlink" href="#pNbody.ic.generic_alpha" title="Permalink to this definition"></a></dt>
<dd><p>Generic alpha distribution : rho ~ (r+e)^a</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.ic.hernquist">
<tt class="descclassname">pNbody.ic.</tt><tt class="descname">hernquist</tt><big>(</big><em>n</em>, <em>rs</em>, <em>Rmax</em>, <em>dR</em>, <em>Rs=None</em>, <em>name='hernquist.dat'</em>, <em>ftype='binary'</em>, <em>verbose=False</em><big>)</big><a class="headerlink" href="#pNbody.ic.hernquist" title="Permalink to this definition"></a></dt>
<dd><p>Return an Nbody object that contains n particules following
a hernquist modifed profile.</p>
<p>rho = 1/( (r/rs) * (1+r/rs)**3 )</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.ic.homodisk">
<tt class="descclassname">pNbody.ic.</tt><tt class="descname">homodisk</tt><big>(</big><em>n</em>, <em>a</em>, <em>b</em>, <em>dz</em>, <em>name='homodisk.dat'</em>, <em>ftype='binary'</em>, <em>verbose=False</em><big>)</big><a class="headerlink" href="#pNbody.ic.homodisk" title="Permalink to this definition"></a></dt>
<dd><p>Return an Nbody object that contains n particules distributed
in an homogeneous oval of radius a and b, and of thickness dz.</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.ic.homosphere">
<tt class="descclassname">pNbody.ic.</tt><tt class="descname">homosphere</tt><big>(</big><em>n</em>, <em>a</em>, <em>b</em>, <em>c</em>, <em>name='homosphere.dat'</em>, <em>ftype='binary'</em>, <em>verbose=False</em><big>)</big><a class="headerlink" href="#pNbody.ic.homosphere" title="Permalink to this definition"></a></dt>
<dd><p>Return an Nbody object that contains n particules distributed
in an homogeneous triaxial sphere of axis a,b,c.</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.ic.invert">
<tt class="descclassname">pNbody.ic.</tt><tt class="descname">invert</tt><big>(</big><em>x</em>, <em>rmin</em>, <em>rmax</em>, <em>fct</em>, <em>args</em>, <em>eps=1e-10</em><big>)</big><a class="headerlink" href="#pNbody.ic.invert" title="Permalink to this definition"></a></dt>
<dd><p>return vector r that corresponds to
fct(r,args)=x
This routine uses a simple bissector algorithm</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.ic.isothm">
<tt class="descclassname">pNbody.ic.</tt><tt class="descname">isothm</tt><big>(</big><em>n</em>, <em>rc</em>, <em>rmax</em>, <em>name='isothm.dat'</em>, <em>ftype='binary'</em>, <em>verbose=False</em><big>)</big><a class="headerlink" href="#pNbody.ic.isothm" title="Permalink to this definition"></a></dt>
<dd><p>Return an Nbody object that contains n particules distributed as</p>
<p>rho = 1/(1+r/rc)**2</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.ic.isothm_mr">
<tt class="descclassname">pNbody.ic.</tt><tt class="descname">isothm_mr</tt><big>(</big><em>r</em>, <em>args</em><big>)</big><a class="headerlink" href="#pNbody.ic.isothm_mr" title="Permalink to this definition"></a></dt>
<dd><p>Mass in the radius r for the distribution</p>
<p>rho = 1/(1+r/rc)**2</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.ic.kuzmin">
<tt class="descclassname">pNbody.ic.</tt><tt class="descname">kuzmin</tt><big>(</big><em>n</em>, <em>eps</em>, <em>dz</em>, <em>name='kuzmin.dat'</em>, <em>ftype='binary'</em>, <em>verbose=False</em><big>)</big><a class="headerlink" href="#pNbody.ic.kuzmin" title="Permalink to this definition"></a></dt>
<dd><p>Return an Nbody object that contains n particules distributed
in a kuzmin (infinitely thin) disk</p>
<p>rho = eps*M/(2*pi*(R**2+eps**2)**(3/2))</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.ic.miyamoto_nagai">
<tt class="descclassname">pNbody.ic.</tt><tt class="descname">miyamoto_nagai</tt><big>(</big><em>n</em>, <em>a</em>, <em>b</em>, <em>Rmax</em>, <em>Zmax</em>, <em>irand=1</em>, <em>fct=None</em>, <em>fRmax=0</em>, <em>name='miyamoto.dat'</em>, <em>ftype='binary'</em>, <em>verbose=False</em><big>)</big><a class="headerlink" href="#pNbody.ic.miyamoto_nagai" title="Permalink to this definition"></a></dt>
<dd><p>Miyamoto Nagai distribution</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.ic.nfw">
<tt class="descclassname">pNbody.ic.</tt><tt class="descname">nfw</tt><big>(</big><em>n</em>, <em>rs</em>, <em>Rmax</em>, <em>dR</em>, <em>Rs=None</em>, <em>name='nfw.dat'</em>, <em>ftype='binary'</em>, <em>verbose=False</em><big>)</big><a class="headerlink" href="#pNbody.ic.nfw" title="Permalink to this definition"></a></dt>
<dd><p>Return an Nbody object that contains n particules following
an nfw profile.</p>
<p>rho = 1/[ (r/rs)(1+r/rs)^2 ]</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.ic.nfw_mr">
<tt class="descclassname">pNbody.ic.</tt><tt class="descname">nfw_mr</tt><big>(</big><em>r</em>, <em>args</em><big>)</big><a class="headerlink" href="#pNbody.ic.nfw_mr" title="Permalink to this definition"></a></dt>
<dd><p>Mass in the radius r for the nfw distribution</p>
<p>rho = rhos/[ (r/rs)(1+r/rs)^2 ]</p>
<p>mr = 4*pi*rhos*rs**3 <a href="#id1"><span class="problematic" id="id2">*</span></a>(log(1+r/rs)-r/(rs+r))</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.ic.nfwg">
<tt class="descclassname">pNbody.ic.</tt><tt class="descname">nfwg</tt><big>(</big><em>n</em>, <em>rs</em>, <em>gamma</em>, <em>Rmax</em>, <em>dR</em>, <em>Rs=None</em>, <em>name='nfwg.dat'</em>, <em>ftype='binary'</em>, <em>verbose=False</em><big>)</big><a class="headerlink" href="#pNbody.ic.nfwg" title="Permalink to this definition"></a></dt>
<dd><p>Return an Nbody object that contains n particules following
an nfw modifed profile.</p>
<p>rho = 1/[ ((r/rs))**(gamma)(1+r/rs)^2 ]**(0.5*(3-gamma))</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.ic.pisothm">
<tt class="descclassname">pNbody.ic.</tt><tt class="descname">pisothm</tt><big>(</big><em>n</em>, <em>rc</em>, <em>rmax</em>, <em>rmin=0</em>, <em>name='pisothm.dat'</em>, <em>ftype='binary'</em>, <em>verbose=False</em><big>)</big><a class="headerlink" href="#pNbody.ic.pisothm" title="Permalink to this definition"></a></dt>
<dd><p>Pseudo-isothermal sphere
Mass in the radius r for the distribution</p>
<p>rho = 1/(1+(r/rc)**2)</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.ic.pisothm_mr">
<tt class="descclassname">pNbody.ic.</tt><tt class="descname">pisothm_mr</tt><big>(</big><em>r</em>, <em>args</em><big>)</big><a class="headerlink" href="#pNbody.ic.pisothm_mr" title="Permalink to this definition"></a></dt>
<dd><p>Mass in the radius r for the distribution</p>
<p>rho = 1/(1+(r/rc)**2)</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.ic.plummer">
<tt class="descclassname">pNbody.ic.</tt><tt class="descname">plummer</tt><big>(</big><em>n</em>, <em>a</em>, <em>b</em>, <em>c</em>, <em>eps</em>, <em>rmax</em>, <em>M=1.0</em>, <em>vel='no'</em>, <em>name='plummer.dat'</em>, <em>ftype='binary'</em>, <em>verbose=False</em><big>)</big><a class="headerlink" href="#pNbody.ic.plummer" title="Permalink to this definition"></a></dt>
<dd><p>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.</p>
<p>rho = (1.+(r/eps)**2)**(-5/2)</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.ic.shell">
<tt class="descclassname">pNbody.ic.</tt><tt class="descname">shell</tt><big>(</big><em>n</em>, <em>r</em>, <em>name='cell.dat'</em>, <em>ftype='binary'</em>, <em>verbose=False</em><big>)</big><a class="headerlink" href="#pNbody.ic.shell" title="Permalink to this definition"></a></dt>
<dd><p>Shell of radius r</p>
</dd></dl>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<p class="logo"><a href="../index.html">
<img class="logo" src="../_static/icon-small.jpg" alt="Logo"/>
</a></p>
<h4>Previous topic</h4>
<p class="topless"><a href="MainModule.html"
title="previous chapter">the main module</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="IoModule.html"
title="next chapter">the io module</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/rst/IcModule.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="../search.html" method="get">
<input type="text" name="q" size="18" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="../np-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="IoModule.html" title="the io module"
>next</a> |</li>
<li class="right" >
<a href="MainModule.html" title="the main module"
>previous</a> |</li>
<li><a href="../index.html">pNbody v4 documentation</a> &raquo;</li>
<li><a href="Reference.html" >Reference</a> &raquo;</li>
</ul>
</div>
<div class="footer">
&copy; Copyright 2011, Yves Revaz.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.4.
</div>
</body>
</html>

Event Timeline