znvis package

Subpackages

Module contents

ZnVis: A Zincwarecode package.

License

This program and the accompanying materials are made available under the terms of the Eclipse Public License v2.0 which accompanies this distribution, and is available at https://www.eclipse.org/legal/epl-v20.html SPDX-License-Identifier: EPL-2.0 Copyright Contributors to the Zincwarecode Project. Contact Information ——————- email: zincwarecode@gmail.com github: https://github.com/zincware web: https://zincwarecode.com/ Citation ——– If you use this module please cite us with:

Summary

init file for the main ZnVis package.

class znvis.CustomMesh(colour: numpy.ndarray = array([0, 0, 0]), file: Optional[str] = None)[source]

Bases: znvis.mesh.mesh.Mesh

A class to produce cylinder meshes.

Attributes
filestr

Path to mesh file.

create_mesh(starting_position: numpy.ndarray, starting_orientation: Optional[numpy.ndarray] = None) open3d.cpu.pybind.geometry.TriangleMesh[source]

Create a mesh object defined by the dataclass.

Parameters
starting_positionnp.ndarray shape=(3,)

Starting position of the mesh.

starting_orientationnp.ndarray shape=(3,) (default = None)

Starting orientation of the mesh.

Returns
mesho3d.geometry.TriangleMesh
file: str = None
class znvis.Cylinder(colour: numpy.ndarray = array([0, 0, 0]), radius: float = 1.0, height: float = 3.0, split: int = 1, resolution: int = 10)[source]

Bases: znvis.mesh.mesh.Mesh

A class to produce cylinder meshes.

Attributes
radiusfloat

Radius of the sphere.

heightfloat

Height of the cylinder.

splitint

Number of segment the mesh will be split into.

resolutionint

Resolution of the sphere.

create_mesh(starting_position: numpy.ndarray, starting_orientation: Optional[numpy.ndarray] = None) open3d.cpu.pybind.geometry.TriangleMesh[source]

Create a mesh object defined by the dataclass.

Parameters
starting_positionnp.ndarray shape=(3,)

Starting position of the mesh.

starting_orientationnp.ndarray shape=(3,) (default = None)

Starting orientation of the mesh.

Returns
mesho3d.geometry.TriangleMesh
height: float = 3.0
radius: float = 1.0
resolution: int = 10
split: int = 1
class znvis.Particle(name: str, mesh: Optional[znvis.mesh.mesh.Mesh] = None, position: Optional[numpy.ndarray] = None, velocity: Optional[numpy.ndarray] = None, force: Optional[numpy.ndarray] = None, director: Optional[numpy.ndarray] = None, mesh_dict: Optional[dict] = None)[source]

Bases: object

Parent class for a ZnVis particle.

Attributes
namestr

Name of the particle

meshMesh

Mesh to use e.g. sphere

positionnp.ndarray

Position tensor of the shape (n_confs, n_particles, n_dims)

velocitynp.ndarray

Velocity tensor of the shape (n_confs, n_particles, n_dims)

forcenp.ndarray

Force tensor of the shape (n_confs, n_particles, n_dims)

director: np.ndarray

Director tensor of the shape (n_confs, n_particles, n_dims)

mesh_dictdict

A list of mesh objects, one for each time step.

construct_mesh_dict()[source]

Constructor the mesh dict for the class.

The mesh dict is a list of mesh objects for each time step in the parsed trajectory.

Returns
Updates the class attributes mesh_dict
director: numpy.ndarray = None
force: numpy.ndarray = None
mesh: znvis.mesh.mesh.Mesh = None
mesh_dict: dict = None
name: str
position: numpy.ndarray = None
velocity: numpy.ndarray = None
class znvis.Sphere(colour: numpy.ndarray = array([0, 0, 0]), radius: float = 1.0, resolution: int = 10)[source]

Bases: znvis.mesh.mesh.Mesh

A class to produce sphere meshes.

Attributes
radiusfloat

Radius of the sphere

resolutionint

Resolution of the sphere.

create_mesh(starting_position: numpy.ndarray, starting_orientation: Optional[numpy.ndarray] = None) open3d.cpu.pybind.geometry.TriangleMesh[source]

Create a mesh object defined by the dataclass.

Parameters
starting_positionnp.ndarray shape=(3,)

Starting position of the mesh.

starting_orientationnp.ndarray shape=(3,) (default = None)

Starting orientation of the mesh.

Returns
mesho3d.geometry.TriangleMesh
radius: float = 1.0
resolution: int = 10
class znvis.Visualizer(particles: List[znvis.particle.particle.Particle], frame_rate: int = 24, number_of_steps: Optional[int] = None)[source]

Bases: object

Main class to perform visualization.

Attributes
particleslist[znvis.Particle]

A list of particle objects to add to the visualizer.

appo3d.gui.Application.instance

An open3d application.

viso3d.visualization.O3DVisualizer

An open3d visualizer window

counterint

Internally stored counter to track which configuration is currently being viewed.

run_visualization()[source]

Run the visualization.

Returns
Launches the visualization.