7.13 Graphical functions

display( parameters,[palette=None],[save=None])
Display the model using parameters parameters. This function allows to display or save an image from an Nbody object. It calls the method Map, and display or save it.

>>> from pNbody import *
>>> nb = Nbody('gadget_z00.dat',ftype='gadget')
>>> nb.display()
>>> nb.display(size=(10000,10000),shape=(256,256),palette='lut2')
>>> params = {"size":(10000,10000),"shape":(256,256),"filter_name":'convol'}
>>> nb.display(params,palette='rainbow4')

show( parameters)
This function is an alias to the function display.

>>> from pNbody import *
>>> nb = Nbody('gadget_z00.dat',ftype='gadget')
>>> nb.show()
>>> nb.show(size=(10000,10000),shape=(256,256),palette='lut2')
>>> params = {"size":(10000,10000),"shape":(256,256),"filter_name":'convol'}
>>> nb.show(params,palette='rainbow4')

Map( parameters)
This function creates a map using parameters defined in parameters, where parameters corresponds to parameters defined in section 6.1.

It calls the methods CombiMap that create the matrix mat.

Then, it makes an integer matrix (matint) calling the function set_ranges and optionally add contours or box, using the functions contours and add_box.

It finally returns a tuple (mat,matint,mn_opts,mx_opts,cd_opts)

>>> from pNbody import *
>>> nb = Nbody('gadget_z00.dat',ftype='gadget')
>>> mat,matint,mn_opt,mx_opt,cd_opt = nb.Map()
>>> mplot(matint)

CombiMap( parameters)

This function returns a Float numarray matrix corresponding to the physical value defined by the parameter mode. The function uses either ComputeMeanMap, ComputeSigmaMap, or use directely the function ComputeMap to compute the desired matrix. The meaning of the parameter mode is given in the following table.

Value Meaning Formula
"sr" dispertion in r $\sqrt{\langle\sum m  r^2\rangle/\langle\sum m\rangle-(\langle\sum m  r\rangle/\langle\sum m\rangle)^2}$
"svr" dispertion in vr $\sqrt{\langle\sum m  vr^2\rangle/\langle\sum m\rangle-(\langle\sum m  vr\rangle/\langle\sum m\rangle)^2}$
"svxyr" dispertion in vxy $\sqrt{\langle\sum m  vxy^2\rangle/\langle\sum m\rangle-(\langle\sum m  vxy\rangle/\langle\sum m\rangle)^2}$
"svtr" dispertion in vt $\sqrt{\langle\sum m  vt^2\rangle/\langle\sum m\rangle-(\langle\sum m  vt\rangle/\langle\sum m\rangle)^2}$
"szr" ratio sigma z/sigma r

If the value of mode may also be set to a variable or function name. In this case, a map using the function ComputeMeanMap, with a physical value taken as the given variable is returned.

>>> from pNbody import *
>>> nb = Nbody('gadget_z00.dat',ftype='gadget')
>>> nb = nb.select('gas')
>>> mat = nb.CombiMap(mode='T',filter_name='convol')
>>> matint,mn_opt,mx_opt,cd_opt = set_ranges(mat,scale='log',cd=0,mn=0,mx=0)
>>> mplot(matint,palette='rainbow4')
>>> mat = nb.CombiMap(mode='log10(nb.T())',filter_name='convol')
>>> matint,mn_opt,mx_opt,cd_opt = set_ranges(mat,scale='lin',cd=0,mn=7,mx=12)
>>> mplot(matint,palette='rainbow4')

ComputeMeanMap( parameters,mode1)
Compute the mean map of an observable and return int in an float32 numarray matrix.


\begin{displaymath}
M = \frac{M_1}{M_0}
\end{displaymath} (7.3)

$M_0$ is the zero momentum map and $M_1$ is the first momentum map of the variable given by mode1.

>>> from pNbody import *
>>> nb = Nbody('disk.dat',ftype='gadget')
>>> nb = nb.select('disk')
>>> mat = nb.ComputeMeanMap(filter_name='convol',size=(75,75),view='xy',mode1='z')
>>> matint,mn_opt,mx_opt,cd_opt = set_ranges(mat,scale='lin',cd=0,mn=-10,mx=10)
>>> mplot(matint,palette='rainbow4')

ComputeSigmaMap( parameters,mode1,mode2)
Compute the dispersion map an observable and return it in an float32 numarray matrix.


\begin{displaymath}
M = \sqrt{ \frac{M_2}{M_0} - \left( \frac{M_1}{M_0} \right)^2 }
\end{displaymath} (7.4)

$M_0$ is the zero momentum map and $M_1$($M_2$) is a first(second) momentum map of the variable given by mode1(mode2).

>>> from pNbody import *
>>> nb = Nbody('disk.dat',ftype='gadget')
>>> nb = nb.select('disk')
>>> mat = nb.ComputeSigmaMap(filter_name='convol',size=(75,75),view='xy',mode1='z',mode2='z2')
>>> matint,mn_opt,mx_opt,cd_opt = set_ranges(mat,scale='lin',cd=0,mn=-2,mx=2)
>>> mplot(matint,palette='rainbow4')

ComputeMap( parameters)

Compute the momentum map of an observable and return it in an float32 numarray matrix. It calls the functions :

  1. getval : If the physical value to plot is not dependent on the observer position, get it from mode.

  2. get_obs : if the observer position matrix obs is not defined, compute it using x0, xp, alpha, view, r_obs.

  3. expose : expose the model, using obs, eye, dist_eye, foc, space.

  4. getval : If the physical value to plot depends on the observer position, get it now from mode.

  5. frustrum or ortho : Project the model, using clip and size.

  6. getval : If the physical value to plot depends on the observer position, get it now from mode.

  7. None : Performe some selections

  8. viewport : perform viewport transformation using shape.

  9. mkmapsph or mkmap : compute the map using shape.

  10. apply_filter : apply filter on the map using filter_name and filter_opts.

The following table lists corresponding physical values fo the parameter mode that do not dependends on the observer position :

Value Meaning Formula
"0" zero momentum $\sum m$
"m" zero momentum $\sum m$
"x" first momentum in x
"y" first momentum in y
"z" first momentum in z
"x2" second momentum in x
"y2" second momentum in y
"z2" second momentum in z
"vx" first velocity momentum in x $\sum m  vx$
"vy" first velocity momentum in y $\sum m  vy$
"vz" first velocity momentum in z $\sum m  vz$
"vx2" second velocity momentum in x $\sum m  vx^2$
"vy2" second velocity momentum in y $\sum m  vy^2$
"vz2" second velocity momentum in z $\sum m  vz^2$
"lx" first specific kinetic momemtum in x
"ly" first specific kinetic momemtum in y
"lz" first specific kinetic momemtum in z
"Lx" first kinetic momemtum in x
"Ly" first kinetic momemtum in y
"Lz" first kinetic momemtum in z
"u" first momentum of specific energy
"rho" first momentum of density
"T" first momentum of temperature
"A" first momentum of entropy
"P" first momentum of pressure
"Tcool" first momentum of cooling time
"Lum" first momentum of luminosity
"Ne" first momentum of electronic density

The following table lists corresponding physical values fo the parameter mode that do dependends on the observer position :

Value Meaning Formula
"r" first momentum of radial distance
"r2" second momentum of radial distance
"vr" first momentum of radial velocity
"vr2" second momemtum of radial velocity
"vxyr" first momentum of radial velocity in the plane $\sum m  (x vx + y vy)/\sqrt{x^2+y^2}$
"vxyr2" second momentum of radial velocity in the plane $\sum m  [(x vx + y vy)/\sqrt{x^2+y^2}]^2$
"vtr" first momentum of tangential velocity in the plane $\sum m  (x vx - y vy)/\sqrt{x^2+y^2}$
"vtr2" second momentum of tangential velocity in the plane $\sum m  [(x vx - y vy)/\sqrt{x^2+y^2}]^2$

>>> from pNbody import *
>>> nb = Nbody('disk.dat',ftype='gadget')
>>> nb = nb.select('disk')
>>> nb.cmcenter()
>>> nb.rotate(axis='x',angle=pi/4)
>>> mat = nb.ComputeMap(filter_name='convol',size=(50,50),mode='vr')
>>> matint,mn_opt,mx_opt,cd_opt = set_ranges(mat,scale='lin',cd=0,mn=0,mx=0)
>>> mplot(matint,palette='rainbow4')
>>> mat = nb.ComputeMap(filter_name='convol',size=(50,50),mode='nb.rxyz()')
>>> matint,mn_opt,mx_opt,cd_opt = set_ranges(mat,scale='lin',cd=0,mn=0,mx=0.0004)
>>> mplot(matint,palette='rainbow4')
>>> mat = nb.ComputeMeanMap(filter_name='convol',size=(50,50),mode1='nb.rxyz()')
>>> matint,mn_opt,mx_opt,cd_opt = set_ranges(mat,scale='lin',cd=0,mn=0,mx=50)
>>> mplot(matint,palette='rainbow4')

expose( obs,[eye=None],[dist_eye=None],[foc=None],[space='pos'])
Rotate and translate the object in order to be seen as if the observer was in x0, looking at a point in xp.

See About this document... for information on suggesting changes.