Table Of Contents

Previous topic

pyparticles Package

Next topic

demo Package

This Page

animation Package

animation Package

animation Module

class pyparticles.animation.animation.Animation

Bases: object

Base abstract class used for controling the simulation.
This class should be used as a base class for building and runnig a simulation problem. The class animation contains all foudamental element for working with a PyParticles in an easy way.
The user must overide the methods:
build_animation: For setting up averithing data_stream: for performing a simulation step or runnig the main loop start: start the smulation

In a few word you must follow this procedure:

# Construct a new object
a = MyAnimation()

# setup the particles set
a.pset = pset

# setup the numeric integration 
a.ode_solver = solver

# max number of steps
a.steps = steps

# set up everythings 
a.build_animation()

# start!
a.start()
add_measure(measure)

Add a class delegeted for performing a measure

build_animation()
closing_procedure()
data_stream()
fps

get the current FPS

fps_print

Toggle the printing of the FPS (True | False)

fps_steps

get and set the steps used for computing the fps

get_fps()
get_fps_print()
get_fps_steps()
get_measure(name)

return the measure named ‘name’

get_measure_value(name)

get the value of the measure named ‘name’

get_measure_value_str(name)

return a string containig the value of the measure

get_measures_names()

Return a list containg the names of the executed measured.

get_ode_solver()
get_pset()
get_steps()
get_trajectory()
get_trajectory_step()
get_xlim()
get_ylim()
get_zlim()
measures_cnt()
ode_solver
perform_measurement()

Execute all listed measures

pset
set_fps_print(f)
set_fps_steps(stp)
set_ode_solver(solver)
set_pset(pset)
set_steps(steps)
set_trajectory(tr)
set_trajectory_step(trs)
set_xlim(xl)
set_ylim(yl)
set_zlim(zl)
start()
steps
trajectory

enable or disable the trajectory

trajectory_step

set or get the step for drawing the trajectory

update_fps()

Update the FPS, this method must be called every step.

Returns:True if the FPS has been updated
xlim
ylim
zlim

animated_ogl Module

class pyparticles.animation.animated_ogl.AnimatedGl

Bases: pyparticles.animation.animation.Animation

add_vector_field_fun(fun, unit, density=1.0, color_fun=None)
build_animation()
data_stream()
draw_vector_field

enable or disable (True of False) vector filed drawing (if available)

get_draw_vector_field()
get_light()
get_perspective()
get_pset()
get_rot_angle()
get_rotation()
get_rotation_axis()
get_trackball()
get_trajectory()
get_trajectory_step()
get_translate_scene()
get_translation()
get_win_size()
init_rotation(angle, axis)
light

enable or disable (True or False) the opengl lighting

perspective
pset
rotatation
rotatation_axis
rotation_angle
set_draw_vector_field(f)
set_light(sw)
set_perspective(perspective)
set_pset(pset)
set_rot_angle(angle)
set_rotation(rot_xyz)
set_rotation_axis(rot_xyz_ax)
set_trajectory(tr)
set_trajectory_step(trs)
set_translation(transl)
set_win_size(w_size)
start()
trackball
trajectory

enable or disable (True or False) the trajectory

trajectory_step

set or get the step for drawing the trajectory

translate_scene
translation
win_size

get or set the size of the current window. The size is a tuple: (w,h)

zoom_scene(f)
pyparticles.animation.animated_ogl.DrawGLScene()

Draw the current particle scene.

pyparticles.animation.animated_ogl.InitGL(Width, Height, ReSizeFun)

Initialize OpenGl

pyparticles.animation.animated_ogl.InitLight()
pyparticles.animation.animated_ogl.KeyPressed(c, x, y)
pyparticles.animation.animated_ogl.MouseMotion(x, y)
pyparticles.animation.animated_ogl.MousePressed(button, state, x, y)
pyparticles.animation.animated_ogl.ReSizeGLScene(Width, Height)
pyparticles.animation.animated_ogl.Set2DMode()
pyparticles.animation.animated_ogl.SetPerspective(animation)
pyparticles.animation.animated_ogl.disableLight()
pyparticles.animation.animated_ogl.enableLight()
pyparticles.animation.animated_ogl.glut_print(x, y, font, text, r, g, b, a)
pyparticles.animation.animated_ogl.joystick_func(button_mask, x, y, z)
pyparticles.animation.animated_ogl.print_fps(fps)
pyparticles.animation.animated_ogl.print_help()
pyparticles.animation.animated_ogl.print_measures()

animated_scatter Module

class pyparticles.animation.animated_scatter.AnimatedScatter(numpoints=50)

Bases: pyparticles.animation.animation.Animation

build_animation()
data_stream()
setup_plot()
start()
update(i)

Update the scatter plot.

test_animation Module

class pyparticles.animation.test_animation.TestAnimation

Bases: pyparticles.animation.animation.Animation

Test the free fall with the fluid drag

analytical_sol
build_animation()
data_stream()
get_analytical_sol()
get_ip()
init_pset()
ip
set_analytical_sol(f)
set_ip(i)
start()
class pyparticles.animation.test_animation.TestAnimationDampedHarmonic

Bases: pyparticles.animation.test_animation.TestAnimation

Test the damped harmonic motion with two particles.

build_animation()
init_pset()
class pyparticles.animation.test_animation.TestAnimationHarmonic

Bases: pyparticles.animation.test_animation.TestAnimation

Test the harmonic motion with two particles.

build_animation()
init_pset()
pyparticles.animation.test_animation.damp_harmonic(t)
pyparticles.animation.test_animation.free_fall(t, m=1.0, g=10.0, k=1.0)
pyparticles.animation.test_animation.harmonic(t)