Page MenuHomec4science

LibutilModule.html
No OneTemporary

File Metadata

Created
Sun, Nov 3, 16:36

LibutilModule.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 libutil 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 param module" href="ParamModule.html" />
<link rel="prev" title="the mpi module" href="MpiModule.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="ParamModule.html" title="the param module"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="MpiModule.html" title="the mpi 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.libutil">
<span id="the-libutil-module"></span><h1>the libutil module<a class="headerlink" href="#module-pNbody.libutil" title="Permalink to this headline"></a></h1>
<dl class="function">
<dt id="pNbody.libutil.Extract1dMeanFrom2dMap">
<tt class="descclassname">pNbody.libutil.</tt><tt class="descname">Extract1dMeanFrom2dMap</tt><big>(</big><em>x</em>, <em>y</em>, <em>mass</em>, <em>val</em>, <em>kx</em>, <em>ky</em>, <em>nmin</em>, <em>momentum=0</em><big>)</big><a class="headerlink" href="#pNbody.libutil.Extract1dMeanFrom2dMap" title="Permalink to this definition"></a></dt>
<dd><p>Extract the mean along one axis, from a 2d mean or sigma matrix</p>
<p>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</p>
<p>kx : number of bins in x
ky : number of bins in y</p>
<p>nmin : min number of particles needed to compute value</p>
<p>momentum : 0,1,2 (-1=number)</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.libutil.GetMassMap">
<tt class="descclassname">pNbody.libutil.</tt><tt class="descname">GetMassMap</tt><big>(</big><em>pos</em>, <em>mass</em>, <em>shape</em><big>)</big><a class="headerlink" href="#pNbody.libutil.GetMassMap" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="pNbody.libutil.GetMeanMap">
<tt class="descclassname">pNbody.libutil.</tt><tt class="descname">GetMeanMap</tt><big>(</big><em>m0</em>, <em>m1</em><big>)</big><a class="headerlink" href="#pNbody.libutil.GetMeanMap" title="Permalink to this definition"></a></dt>
<dd><p>Return a MeanMap using the 0 and 1 momentum</p>
<p>m0 : zero momentum
m1 : first momentum</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.libutil.GetMeanValMap">
<tt class="descclassname">pNbody.libutil.</tt><tt class="descname">GetMeanValMap</tt><big>(</big><em>pos</em>, <em>mass</em>, <em>val</em>, <em>shape</em><big>)</big><a class="headerlink" href="#pNbody.libutil.GetMeanValMap" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="pNbody.libutil.GetNumberMap">
<tt class="descclassname">pNbody.libutil.</tt><tt class="descname">GetNumberMap</tt><big>(</big><em>pos</em>, <em>shape</em><big>)</big><a class="headerlink" href="#pNbody.libutil.GetNumberMap" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="pNbody.libutil.GetSigmaMap">
<tt class="descclassname">pNbody.libutil.</tt><tt class="descname">GetSigmaMap</tt><big>(</big><em>m0</em>, <em>m1</em>, <em>m2</em><big>)</big><a class="headerlink" href="#pNbody.libutil.GetSigmaMap" title="Permalink to this definition"></a></dt>
<dd><p>Return a MeanMap using the 0 and 1 and 2 momentum</p>
<p>m0 : zero momentum
m1 : first momentum
m2 : second momentum</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.libutil.GetSigmaValMap">
<tt class="descclassname">pNbody.libutil.</tt><tt class="descname">GetSigmaValMap</tt><big>(</big><em>pos</em>, <em>mass</em>, <em>val</em>, <em>shape</em><big>)</big><a class="headerlink" href="#pNbody.libutil.GetSigmaValMap" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="pNbody.libutil.RotateAround">
<tt class="descclassname">pNbody.libutil.</tt><tt class="descname">RotateAround</tt><big>(</big><em>angle</em>, <em>axis</em>, <em>point</em>, <em>ObsM</em><big>)</big><a class="headerlink" href="#pNbody.libutil.RotateAround" title="Permalink to this definition"></a></dt>
<dd><p>this should be C</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.libutil.add_box">
<tt class="descclassname">pNbody.libutil.</tt><tt class="descname">add_box</tt><big>(</big><em>matint</em>, <em>shape=(256</em>, <em>256)</em>, <em>size=(30.0</em>, <em>30.0)</em>, <em>center=None</em>, <em>box_opts=(1</em>, <em>None</em>, <em>None</em>, <em>255)</em><big>)</big><a class="headerlink" href="#pNbody.libutil.add_box" title="Permalink to this definition"></a></dt>
<dd><p>add a box on the frame</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.libutil.apply_filter">
<tt class="descclassname">pNbody.libutil.</tt><tt class="descname">apply_filter</tt><big>(</big><em>mat</em>, <em>name=None</em>, <em>opt=None</em><big>)</big><a class="headerlink" href="#pNbody.libutil.apply_filter" title="Permalink to this definition"></a></dt>
<dd><p>Apply a filter to an image</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.libutil.compress_from_lst">
<tt class="descclassname">pNbody.libutil.</tt><tt class="descname">compress_from_lst</tt><big>(</big><em>x</em>, <em>num</em>, <em>lst</em>, <em>reject=False</em><big>)</big><a class="headerlink" href="#pNbody.libutil.compress_from_lst" title="Permalink to this definition"></a></dt>
<dd><p>Return the compression of x</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.libutil.contours">
<tt class="descclassname">pNbody.libutil.</tt><tt class="descname">contours</tt><big>(</big><em>m</em>, <em>matint</em>, <em>nl</em>, <em>mn</em>, <em>mx</em>, <em>kx</em>, <em>ky</em>, <em>color</em>, <em>crush='no'</em><big>)</big><a class="headerlink" href="#pNbody.libutil.contours" title="Permalink to this definition"></a></dt>
<dd><p>Compute iso-contours on a n x m float array.
If &#8220;l_min&#8221; equal &#8220;l_max&#8221;, levels are automatically between the minimum and
maximum values of the matrix &#8220;mat&#8221;.</p>
<p>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</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.libutil.drawxticks">
<tt class="descclassname">pNbody.libutil.</tt><tt class="descname">drawxticks</tt><big>(</big><em>matint</em>, <em>m0</em>, <em>d0</em>, <em>n0</em>, <em>h0</em>, <em>shape</em>, <em>size</em>, <em>center</em>, <em>color</em><big>)</big><a class="headerlink" href="#pNbody.libutil.drawxticks" title="Permalink to this definition"></a></dt>
<dd><p>draw x ticks in a matrix</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.libutil.drawyticks">
<tt class="descclassname">pNbody.libutil.</tt><tt class="descname">drawyticks</tt><big>(</big><em>matint</em>, <em>m0</em>, <em>d0</em>, <em>n0</em>, <em>h0</em>, <em>shape</em>, <em>size</em>, <em>center</em>, <em>color</em><big>)</big><a class="headerlink" href="#pNbody.libutil.drawyticks" title="Permalink to this definition"></a></dt>
<dd><p>draw x ticks in a matrix</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.libutil.extract_parameters">
<tt class="descclassname">pNbody.libutil.</tt><tt class="descname">extract_parameters</tt><big>(</big><em>arg</em>, <em>kw</em>, <em>defaultparams</em><big>)</big><a class="headerlink" href="#pNbody.libutil.extract_parameters" title="Permalink to this definition"></a></dt>
<dd><p>this function extract parameters given to a function
it returns a dictionary of parameters with respective value</p>
<p>defaultparams : dictionary of default parameters</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.libutil.get_eyes">
<tt class="descclassname">pNbody.libutil.</tt><tt class="descname">get_eyes</tt><big>(</big><em>x0</em>, <em>xp</em>, <em>alpha</em>, <em>dr</em><big>)</big><a class="headerlink" href="#pNbody.libutil.get_eyes" title="Permalink to this definition"></a></dt>
<dd><p>Return the position of two eyes.</p>
<p>x0 : position of the head
xp : looking point
theta : rotation of the head
dr : distance of the eyes</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.libutil.get_image">
<tt class="descclassname">pNbody.libutil.</tt><tt class="descname">get_image</tt><big>(</big><em>mat</em>, <em>name=None</em>, <em>palette_name='light'</em>, <em>mode='RGB'</em><big>)</big><a class="headerlink" href="#pNbody.libutil.get_image" title="Permalink to this definition"></a></dt>
<dd><p>Return an image (PIL object).</p>
<p>data : numpy 2x2 object
name : name of the output
palette_name : name of a palette</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.libutil.geter">
<tt class="descclassname">pNbody.libutil.</tt><tt class="descname">geter</tt><big>(</big><em>n</em>, <em>rmin</em>, <em>rmax</em>, <em>g</em>, <em>gm</em><big>)</big><a class="headerlink" href="#pNbody.libutil.geter" title="Permalink to this definition"></a></dt>
<dd><p>Generate a one dimentional non linear array of r</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.libutil.geter2">
<tt class="descclassname">pNbody.libutil.</tt><tt class="descname">geter2</tt><big>(</big><em>n</em>, <em>rmin</em>, <em>rmax</em>, <em>g</em>, <em>gm</em><big>)</big><a class="headerlink" href="#pNbody.libutil.geter2" title="Permalink to this definition"></a></dt>
<dd><p>Generate a one dimentional non linear array of r</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.libutil.getr">
<tt class="descclassname">pNbody.libutil.</tt><tt class="descname">getr</tt><big>(</big><em>nr=31</em>, <em>nt=32</em>, <em>rm=100.0</em><big>)</big><a class="headerlink" href="#pNbody.libutil.getr" title="Permalink to this definition"></a></dt>
<dd><p>Return a sequence of number (n x 1 array),
where n=nr+1 defined by: Pfenniger &amp; Friedli (1994)</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.libutil.getval">
<tt class="descclassname">pNbody.libutil.</tt><tt class="descname">getval</tt><big>(</big><em>nb</em>, <em>mode='m'</em>, <em>obs=None</em><big>)</big><a class="headerlink" href="#pNbody.libutil.getval" title="Permalink to this definition"></a></dt>
<dd><p>For each point, return a specific value linked to this point</p>
<p>0 : moment 0
m : moment 0</p>
<p>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</p>
<p>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</p>
<p>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</p>
<p>u : specific energy
rho : density
T : temperature
A : entropy
P : pressure
Tcool : cooling time
Lum : luminosity
Ne : local electro density</p>
<p># depends on projection</p>
<p>r : first momemtum of radial distance
r2 : second momemtum of radial distance</p>
<p>vr : first momemtum of radial velocity
vr2 : second momemtum of radial velocity</p>
<p>vxyr : first momemtum of radial velocity in the plane
vxyr2 : second momemtum of radial velocity in the plane</p>
<p>vtr : first momemtum of tangential velocity in the plane
vtr2 : second momemtum of tangential velocity in the plane</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.libutil.getvaltype">
<tt class="descclassname">pNbody.libutil.</tt><tt class="descname">getvaltype</tt><big>(</big><em>mode='m'</em><big>)</big><a class="headerlink" href="#pNbody.libutil.getvaltype" title="Permalink to this definition"></a></dt>
<dd><p>list values that depends on projection</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.libutil.invgetr">
<tt class="descclassname">pNbody.libutil.</tt><tt class="descname">invgetr</tt><big>(</big><em>r</em>, <em>nr=31</em>, <em>nt=32</em>, <em>rm=100.0</em><big>)</big><a class="headerlink" href="#pNbody.libutil.invgetr" title="Permalink to this definition"></a></dt>
<dd><p>From r, return the corresponding indexes.
Inverse of getr function.</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.libutil.log_filter">
<tt class="descclassname">pNbody.libutil.</tt><tt class="descname">log_filter</tt><big>(</big><em>x</em>, <em>xmin</em>, <em>xmax</em>, <em>xc</em>, <em>kx=1.0</em><big>)</big><a class="headerlink" href="#pNbody.libutil.log_filter" title="Permalink to this definition"></a></dt>
<dd><p>map a value between 0 and kx</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.libutil.log_filter_inv">
<tt class="descclassname">pNbody.libutil.</tt><tt class="descname">log_filter_inv</tt><big>(</big><em>k</em>, <em>xmin</em>, <em>xmax</em>, <em>xc</em>, <em>kx=1.0</em><big>)</big><a class="headerlink" href="#pNbody.libutil.log_filter_inv" title="Permalink to this definition"></a></dt>
<dd><p>map a value betwen xmin and xmax</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.libutil.mplot">
<tt class="descclassname">pNbody.libutil.</tt><tt class="descname">mplot</tt><big>(</big><em>mat</em>, <em>palette='light'</em>, <em>save=None</em>, <em>marker=None</em>, <em>header=None</em><big>)</big><a class="headerlink" href="#pNbody.libutil.mplot" title="Permalink to this definition"></a></dt>
<dd><p>plot a 2d array</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.libutil.myhistogram">
<tt class="descclassname">pNbody.libutil.</tt><tt class="descname">myhistogram</tt><big>(</big><em>a</em>, <em>bins</em><big>)</big><a class="headerlink" href="#pNbody.libutil.myhistogram" title="Permalink to this definition"></a></dt>
<dd><p>Return the histogram (n x 1 float array) of the
n x 1 array &#8220;a&#8221;.
&#8220;bins&#8221; (m x 1 array) specify the bins of the histogram.</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.libutil.phys2img">
<tt class="descclassname">pNbody.libutil.</tt><tt class="descname">phys2img</tt><big>(</big><em>shape</em>, <em>size</em>, <em>center</em>, <em>x</em>, <em>y</em><big>)</big><a class="headerlink" href="#pNbody.libutil.phys2img" title="Permalink to this definition"></a></dt>
<dd><p>convert physical position into the image pixel</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.libutil.sbox">
<tt class="descclassname">pNbody.libutil.</tt><tt class="descname">sbox</tt><big>(</big><em>shape</em>, <em>size</em>, <em>lweight=1</em>, <em>xticks=None</em>, <em>yticks=None</em>, <em>color=255</em><big>)</big><a class="headerlink" href="#pNbody.libutil.sbox" title="Permalink to this definition"></a></dt>
<dd><p>simple box</p>
<p>return a matrix of integer, containing a box with labels</p>
<p>xticks = (m0,d0,h0,m1,d1,h1)</p>
<p>0 = big
1 = small</p>
<p>m0,m1 = dist between ticks
d0,d1 = first tick
h0,h1 = height of the ticks</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.libutil.set_ranges">
<tt class="descclassname">pNbody.libutil.</tt><tt class="descname">set_ranges</tt><big>(</big><em>mat</em>, <em>scale='log'</em>, <em>mn=None</em>, <em>mx=None</em>, <em>cd=None</em><big>)</big><a class="headerlink" href="#pNbody.libutil.set_ranges" title="Permalink to this definition"></a></dt>
<dd><p>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.</p>
<p>mat : the matrice
scale : lin or log
mn : lower value for the cutoff
mx : higer value for the cutoff
cd : parameter</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.libutil.tranfert_functions">
<tt class="descclassname">pNbody.libutil.</tt><tt class="descname">tranfert_functions</tt><big>(</big><em>rmin</em>, <em>rmax</em>, <em>g=None</em>, <em>gm=None</em><big>)</big><a class="headerlink" href="#pNbody.libutil.tranfert_functions" title="Permalink to this definition"></a></dt>
<dd><p>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</p>
<p>example of g:</p>
<blockquote>
g = lambda r:log(r/rc+1)
gm = lambda r:rc*(exp(r)-1)</blockquote>
</dd></dl>
<dl class="function">
<dt id="pNbody.libutil.vel_cart2cyl">
<tt class="descclassname">pNbody.libutil.</tt><tt class="descname">vel_cart2cyl</tt><big>(</big><em>pos</em>, <em>vel</em><big>)</big><a class="headerlink" href="#pNbody.libutil.vel_cart2cyl" title="Permalink to this definition"></a></dt>
<dd><p>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.</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.libutil.vel_cyl2cart">
<tt class="descclassname">pNbody.libutil.</tt><tt class="descname">vel_cyl2cart</tt><big>(</big><em>pos=None</em>, <em>vel=None</em><big>)</big><a class="headerlink" href="#pNbody.libutil.vel_cyl2cart" title="Permalink to this definition"></a></dt>
<dd><p>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.</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="MpiModule.html"
title="previous chapter">the mpi module</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="ParamModule.html"
title="next chapter">the param module</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/rst/LibutilModule.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="ParamModule.html" title="the param module"
>next</a> |</li>
<li class="right" >
<a href="MpiModule.html" title="the mpi 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