plot_util

Short description

@author: Moritz F P Becker

pyrid.observables.plot_util.cuboid_data(origin, size=[1, 1, 1])[source]

Returns the vertex array of a cuboid given an origin vector.

Parameters
originfloat64[3]

Origin of the cuboid

sizefloat64[3]

Extend of the cuboid in each dimension. Default = [1,1,1]

pyrid.observables.plot_util.draw_cuboid(positions, sizes=None, colors=None, edgecolor='k', edgewidth=1, edgealpha=1)[source]

Draws a cuboid of a given size at a given position.

Parameters
positionsfloat[:]

Position vector

sizefloat[3]

Extend of the cuboid in each dimension. Default = [1,1,1]

colorsarray_like

Array of face colors

edgecolorstring

Edge color. Default = k

edgewidthfloat

Width of the cuboid edges. Default = 1

edgealphafloat

Opacity of the cuboid edges. Default = 1

Returns
tuple(object, object)

Poly3DCollection, Line3DCollection

pyrid.observables.plot_util.draw_sphere(ax, pos, radius, col)[source]

Draws a sphere of given radius and centered at a given position vector.

Parameters
axobject

Axis object of a matplotlib figure

posfloat[3]

Position of the sphere center

radiusfloat

Sphere radius

colstring

Sphere color

Returns
float[2,3]

Lower left and upper right sphere vertices (Used to set figure aspect ratio).

pyrid.observables.plot_util.plot_cell_grid(Simulation, save_fig=False, fig_name=None, fig_path=None, Compartments=None, show=True)[source]

Visualization of the cell grid that divides the simulation box into different cells/voxels.

Parameters
Simulationobject

Instance of the Simulation class.

save_figboolean

If True, the plot is exported to a .png file.

fig_namestring

Name of the figure

fig_pathstring

Path to which the figure is exported

Compartmentsnb.types.DictType(nb.int64, Compartment.class_type.instance_type)

Dictionary keeping the index of each compartment in the simulation and the corresponding instances of the Compartment class.

showboolean

If True, the plot is shown directly, otherwise only after the simulation has ended.

pyrid.observables.plot_util.plot_compartment_0(Simulation, System, vertices, triangles, Compartments, comp_name, save_fig=False, fig_name=None, fig_path=None, face_groups=True, show_normals=True, mol_traj=None, indices=None, projection='orthographic', plot_cube=True, plane='-xz', alpha=None, show=True)[source]

Plots a compartment mesh and highlights any face groups and borders/edges using the plotly library. Also plots the triangle normal vectors.

Parameters
Simulationobject

Instance of the Simulation class

Systemobject

Instance of the System class

verticesfloat64[N,3]

Coordinates of the N vertices in each dimension.

trianglesint64[N,3]

Indices of the vertices that make up each triangle (3 vertices per triangle).

Compartmentsnb.types.DictType(nb.int64, Compartment.class_type.instance_type)

Dictionary keeping the index of each compartment in the simulation and the corresponding instances of the Compartment class.

save_figboolean

If True, the plot is exported to a .png file.

fig_namestring

Name of the figure

fig_pathstring

Path to which the figure is exported

comp_namestring

Name of the compartment which to plot

face_groupsboolean

If True, the face groups of the compartment are highlighted

show_normalsboolean

If True, the triangle normal vectors are plotted

mol_trajfloat64[T,N,3]

Molecule trajectories can be passed which are then plotted as lines in 3D. T is the number of time steps, N the number of molecules. Molecules whose trajectory to plot can also be selected in addition by the parameter indces.

indicesint64[:]

Indices of the molecules whose trajectory to plot

projectionstring

Projection type. Default = orthographic

plot_cube = `boolean`

If True, the simulation box is visualized in addition to the selected compartment

planestring (‘-xy’, ‘xy’, ‘-yz’, ‘yz’, ‘-xz’, ‘xz’)

Defines the plane to which the camera is oriented. Default = -xz

alphafloat64 in [0,1]

Sets the opacity of the mesh faces.

showboolean

If True, the plot is shown directly, otherwise only after the simualtion has ended.

pyrid.observables.plot_util.plot_compartments(Simulation, save_fig=False, fig_name=None, fig_path=None, comp_name=None, face_groups=True, show_normals=True, mol_traj=None, indices=None, projection='orthographic', plot_cube=True, plane='-xz', alpha=None, show=True)[source]

Plots the compartment meshes and highlights any face groups and borders/edges using the plotly library. Also plots the triangle normal vectors.

Parameters
Simulationobject

Instance of the Simulation class

save_figboolean

If True, the plot is exported to a .png file.

fig_namestring

Name of the figure

fig_pathstring

Path to which the figure is exported

comp_namestring

Name of the compartment which to plot

face_groupsboolean

If True, the face groups of the compartment are highlighted

show_normalsboolean

If True, the triangle normal vectors are plotted

mol_trajfloat64[T,N,3]

Molecule trajectories can be passed which are then plotted as lines in 3D. T is the number of time steps, N the number of molecules. Molecules whose trajectory to plot can also be selected in addition by the parameter indces.

indicesint64[:]

Indices of the molecules whose trajectory to plot

projectionstring

Projection type. Default = orthographic

plot_cube = `boolean`

If True, the simulation box is visualized in addition to the selected compartment

planestring (‘-xy’, ‘xy’, ‘-yz’, ‘yz’, ‘-xz’, ‘xz’)

Defines the plane to which the camera is oriented. Default = -xz

alphafloat64 in [0,1]

Sets the opacity of the mesh faces.

showboolean

If True, the plot is shown directly, otherwise only after the simulation has ended.

pyrid.observables.plot_util.plot_concentration_profile(Simulation, axis=0, save_fig=False, fig_name=None, fig_path=None, show=True)[source]

Plots the concentration/density profile of molecules along a given axes.

Parameters
Simulationobject

Instance of the Simulation class.

axis0, 1 or 2

Axes along which to plot the concentration profile.

save_figboolean

If True, the plot is exported to a .png file.

fig_namestring

Name of the figure

fig_pathstring

Path to which the figure is exported

showboolean

If True, the plot is shown directly, otherwise only after the simulation has ended.

pyrid.observables.plot_util.plot_mobility_matrix(molecule, Simulation, save_fig=False, fig_name=None, fig_path=None, color_scheme='colored', show=True)[source]

Plots the mobility tensor (also see diffusion tensor) of a molecule type.

Parameters
moleculestring

Name of the molecule type

Simulationobject

Instance of the Simulation class.

save_figboolean

If True, the plot is exported to a .png file.

fig_namestring

Name of the figure

fig_pathstring

Path to which the figure is exported

color_schemestring

Available color schemes: ‘colored’, ‘flat’. Default = ‘colored’

showboolean

If True, the plot is shown directly, otherwise only after the simulation has ended.

pyrid.observables.plot_util.plot_path(file_path, molecule, indices, show=True)[source]

Plots the trajectory of one or several molecules of a specific type in 3D.

Parameters
file_pathstring

Directory of the hdf5 file that contains the molecule trajectory data.

moleculestring

Name of the molecule type.

indicesint64[:]

List of molecule indices for which to plot the molecule trajectory

showboolean

If False, the plot is not shown. Default = True

pyrid.observables.plot_util.plot_path_mesh(file_path, molecule, indices, show=True)[source]

Plots the trajectory of one or several molecules of a specific type in 3D and includes a 3d mesh compartment.

Parameters
file_pathstring

Directory of the hdf5 file that contains the molecule trajectory data.

moleculestring

Name of the molecule type.

indicesint64[:]

List of molecule indices for which to plot the molecule trajectory

showboolean

If False, the plot is not shown. Default = True

pyrid.observables.plot_util.plot_potential(Simulation, Potentials, yU_limits=None, yF_limits=None, r_limits=None, show=True, save_fig=False)[source]

Plots a range of given energy potential functions and the corresponding force functions.

Parameters
Simulationobject

Instance of the Simulation class.

Potentialslist

List of functions which to plot.

yU_limitsfloat64[2]

Lower and upper limits for the y axes of the potential energy plot. Default = None

yF_limitsfloat64[2]

Lower and upper limits for the y axes of the force plot. Default = None

r_limitsfloat64[2]

Lower and upper limits for the inter-particle distance. Default = None

showboolean

If True, the plot is shown directly, otherwise only after the simulation has ended.

save_figboolean

If True, the plot is exported to a .png file.

pyrid.observables.plot_util.plot_scene(Simulation, save_fig=False, fig_name=None, fig_path=None, projection='orthographic', plane='-xz', show=True)[source]

Plots the simulation scene with all its compartments and molecule positions. Molecule positions are represented by a scatter plot.

Parameters
Simulationobject

Instance of the Simulation class

save_figboolean

If True, the plot is exported to a .png file.

fig_namestring

Name of the figure

fig_pathstring

Path to which the figure is exported

projectionstring

Projection type. Default = orthographic

planestring (‘-xy’, ‘xy’, ‘-yz’, ‘yz’, ‘-xz’, ‘xz’)

Defines the plane to which the camera is oriented. Default = -xz

showboolean

If True, the plot is shown directly, otherwise only after the simualtion has ended.

pyrid.observables.plot_util.plot_sphere_packing(Compartment_Number, Simulation, points, ptype, save_fig=False, fig_name=None, fig_path=None, show=True)[source]

Visualization of the molecule distribution where molecules are represented as spheres.

Parameters
Compartmentsint64

Index of the compartment which to include in the plot.

Simulationobject

Instance of the Simulation class.

pointsfloat64[:,3]

Coordinates of the molecules.

ptypeint64[:]

List of molecule type indices corresponding to the molecule coordinates given by the parameter points.

save_figboolean

If True, the plot is exported to a .png file.

fig_namestring

Name of the figure

fig_pathstring

Path to which the figure is exported

showboolean

If True, the plot is shown directly, otherwise only after the simulation has ended.

pyrid.observables.plot_util.plot_triangle(p0, p1, p2, ax, show=True)[source]

Plots a triangle in 3D.

Parameters
p0float64[3]

Vertex 1

p1float64[3]

Vertex 2

p2float64[3]

Vertex 3

axobject

Axis object of a matplotlib figure

pyrid.observables.plot_util.plot_triangles(Simulation, triangle_ids, points=None)[source]

Plots a range of triangles in 3D.

Parameters
Simulationobject

Instance of the Simulation class

triangles_idsint64[N]

Triangle indices.