Documentation

constants

astrohut.core.constants.DOUBLE

floating point precision

alias of c_float

astrohut.core.constants.LIB = <CDLL '/home/juan/.anaconda3/lib/python3.4/site-packages/astrohut-0.0.12-py3.4-linux-x86_64.egg/astrohut/core/astrohutc.cpython-34m.so', handle 26c67e0 at 7ff2c77c7fd0>

CDLL instance of the shared library

astrohut.core.constants.PATH = '/home/juan/.anaconda3/lib/python3.4/site-packages/astrohut-0.0.12-py3.4-linux-x86_64.egg/astrohut/core/astrohutc.cpython-34m.so'

path to the C shared library

core

astrohut.core.core.createArray(pos, speeds, acc=None)

Creates and array containing the whole properties of the system.

np.ndarray: appends pos, speeds and acc if any.

astrohut.core.core.generateSpeeds(positions, G, mass_unit)

Generates rotation speeds based on positions, G constants and mass_unit value.

Returns:
np.ndarray: array like positions.

interface

class astrohut.core.interface.Simulation(data, dim, mass_unit=1.0, G=1.0, tau=0.5, dt=0.0001, epsilon=0.0001, read_kwargs={})

Main class of astrohut. In order to evolve a system and study them a simulation instance must be launch.

animate2d(i, values, points, boxes)

Method to be used with matplotlib FuncAnimation.

animate3d(i, values, points, boxes)

Method to be used with matplotlib FuncAnimation.

calcRelaxationTime()

Calculates the relaxation time required for the simulation to reach equilibrium.

Returns:
float: relaxation time of the system.
configPlot(figsize=(6, 4.5), xlabel=None, ylabel=None, zlabel=None)

Configures the plot.

Returns:
matplotlib.figure: figure containing the main plot. matplotlib.axes: axes containing all the dots and boxes frames (if boxed).
getEnergies()
Returns:
np.ndarray: contains the energy of the system at every saved instant of time.
makeAnimation(boxed=False, color=None, alpha=0.5)

Makes an animation of data.

Args:

boxed (bool): If True draws the boxes frames.

color (string):If None, multiplecolors are used. If string is passed a monochrome color is used.

alpha (float): Alpha channel argument.

Returns:
matplotlib.animation.FuncAnimation: animation of the data.
setConstants()

Sets the current constants at the C shared library.

setFilePrefix(prefix='')

Sets the file prefix at the C shared library.

start(Ninstants, threads=0, save_to_file_every=0, save_to_array_every=1, print_progress=False)

Starts a simulation, evolves the system N Ninstants of time.

Returns:
np.ndarray: 3d array of the form (instants, Nbodies, properties).
Properties are positions, speeds, accelerations and energy. Non scalar properties are arranged as components.
np.ndarray: 3d array of the form (instants, Nboxes, (center, box)).
For every instant there are Nboxes rows, describing each box. First two or three columns are the coordinates of the center of the box. Next columns describe the corners of the box, first the x components, then y, and finally z if dim is 3.

structs2d

class astrohut.core.structs2d.body2d

Defines a body2d structure.

class astrohut.core.structs2d.node2d

Defines a node2d structure.

class astrohut.core.structs2d.point2d

Defines a point2d structure.

structs3d

class astrohut.core.structs3d.body3d

Defines a body2d structure.

class astrohut.core.structs3d.node3d

Defines a node2d structure.

class astrohut.core.structs3d.point3d

Defines a point2d structure.