SimPhoNy Plugin¶
AViz tools are available in the SimPhoNy library through the
visualisation plug-in named aviz
.
e.g:
from simphony.visualisation import aviz
Visualizing CUDS¶
The show()
function is available to
visualise the Particles CUDS dataset. The function will open a
AViz and allow the user to view and analyze the particles.
The snapshot()
create a snapshot of
the Particles CUDS dataset. The function will create a PNG image
of dataset.
Here is an example illustrating visualizing a particles dataset in Aviz as well as using the Aviz plugin to take a snapshot:
from simphony.visualisation import aviz
from simphony.cuds.particles import Particles, Particle
from simphony.core.cuba import CUBA
positions = [(1.0, 1.0, 1.0),
(2.0, 2.0, 2.0),
(1.5, 1.8, 1.9),
(2.0, 1.0, 1.5)]
velocities = [(1.0, 1.0, 1.0),
(2.0, 2.0, 2.0),
(1.5, 1.8, 1.9),
(2.0, 1.0, 1.5)]
mass = [1.0, 2.0, 10.0, 20]
# add particles
particles = [Particle(coordinates=positions[index],
data={CUBA.VELOCITY: velocities[index],
CUBA.MASS: mass[index]})
for index, position in enumerate(positions)]
my_particles = Particles("test")
my_particles.add(particles)
aviz.show(my_particles)
aviz.snapshot(my_particles, "test.png")
The different attributes of the particles can be selected in AViz:
CUBA Attributes¶
Aviz can show up to 8 properties. To determine which properties should be displayed, the individual particles of the dataset are queried. If there are more than 8 properties, then the first 8 which were encountered are used.
Aviz displays floating point values so all integer values are converted to floats when transferred to Aviz. Any attributes which have a type other than integer or float are ignored.
Note
Once simphony-aviz determines which attributes it will display, it assumes that each particle in the dataset contains those attributes.
Creating XYZ files¶
The simphony_aviz
also provides a way to directly convert CUDS datasets
to xyz input files for AViz:
from simphony.visualisation import aviz
from simphony.cuds.particles import Particles, Particle
from simphony.core.cuba import CUBA
positions = [(1.0, 1.0, 1.0),
(2.0, 2.0, 2.0),
(1.5, 1.8, 1.9),
(2.0, 1.0, 1.5)]
velocities = [(1.0, 1.0, 1.0),
(2.0, 2.0, 2.0),
(1.5, 1.8, 1.9),
(2.0, 1.0, 1.5)]
mass = [1.0, 2.0, 10.0, 20]
# add particles
particles = [Particle(coordinates=positions[index],
data={CUBA.VELOCITY: velocities[index],
CUBA.MASS: mass[index]})
for index, position in enumerate(positions)]
my_particles = Particles("test")
my_particles.add_particles(particles)
aviz.create_xyz_file(my_particles, "test.xyz")