ipymd.visualise package¶
Subpackages¶
- ipymd.visualise.opengl package
- Subpackages
- ipymd.visualise.opengl.postprocessing package
- ipymd.visualise.opengl.renderers package
- Subpackages
- Submodules
- ipymd.visualise.opengl.renderers.atom module
- ipymd.visualise.opengl.renderers.base module
- ipymd.visualise.opengl.renderers.box module
- ipymd.visualise.opengl.renderers.hexagon module
- ipymd.visualise.opengl.renderers.line module
- ipymd.visualise.opengl.renderers.point module
- ipymd.visualise.opengl.renderers.sphere module
- ipymd.visualise.opengl.renderers.sphere_imp module
- ipymd.visualise.opengl.renderers.triangle module
- ipymd.visualise.opengl.renderers.triangles module
- Module contents
- Submodules
- ipymd.visualise.opengl.buffers module
- ipymd.visualise.opengl.camera module
- ipymd.visualise.opengl.qchemlabwidget module
- ipymd.visualise.opengl.qtviewer module
- ipymd.visualise.opengl.shaders module
- ipymd.visualise.opengl.textures module
- Module contents
- Subpackages
Submodules¶
ipymd.visualise.visualise_sim module¶
Created on Sun May 1 23:47:03 2016
@author: cjs14
-
class
ipymd.visualise.visualise_sim.
Visualise_Sim
(units='real')[source]¶ Bases:
object
For units real, these are the units:
mass = grams/mole distance = Angstroms time = femtoseconds energy = Kcal/mole velocity = Angstroms/femtosecond force = Kcal/mole-Angstrom torque = Kcal/mole temperature = Kelvin pressure = atmospheres dynamic viscosity = Poise charge = multiple of electron charge (1.0 is a proton) dipole = charge*Angstroms electric field = volts/Angstrom density = gram/cm^dim-
add_atoms
(atoms_df, spheres=True, illustrate=False)[source]¶ add atoms to visualisation
- atoms_df : pandas.DataFrame
- a table of atom data, must contain columns; x, y, z, radius, color and transparency
- spheres : bool
- whether the atoms are rendered as spheres or points
- illustrate : str
- if True, atom shading is more indicative of an illustration
-
add_axes
(axes=[[1, 0, 0], [0, 1, 0], [0, 0, 1]], length=1.0, offset=(-1.2, 0.2), colors=('red', 'green', 'blue'), width=1.5)[source]¶ add axes
- axes : np.array(3,3)
- to turn off axes, set to None
- axes_offset : tuple
- x, y offset from top top-left atom
-
add_bonds
(atoms_df, bonds_df, cylinders=False, illustrate=False, linewidth=5)[source]¶ add bonds to visualisation
- atoms_df : pandas.DataFrame
- a table of atom data, must contain columns; x, y, z
- bonds_df : list
- a table of bond data, must contain; start, end, radius, color, transparency to/from refer to the atoms_df iloc (not necessarily the index number!)
- cylinders : bool
- whether the bonds are rendered as cylinders or lines
- illustrate : str
- if True, atom shading is more indicative of an illustration
-
add_box
(a, b, c, origin=[0, 0, 0], color='black', width=1)[source]¶ add wireframed box to visualisation
- a : np.ndarray(3, dtype=float)
- The a vectors representing the sides of the box.
- b : np.ndarray(3, dtype=float)
- The b vectors representing the sides of the box.
- c : np.ndarray(3, dtype=float)
- The c vectors representing the sides of the box.
- origin : np.ndarray((3,3), dtype=float), default to zero
- The origin of the box.
- color : str
- the color of the wireframe, in chemlab colors
-
add_box_from_meta
(meta, color='black', width=1)[source]¶ a shortcut for adding boxes using a panda.Series containing a,b,c,origin
-
add_hexagon
(vectors, origin=<Mock object>, color='black', width=1)[source]¶ add wireframed hexagonal prism to visualisation
- vectors : np.ndarray((2,3), dtype=float)
- The two vectors representing the orthogonal a,c directions.
- origin : np.ndarray((3,3), dtype=float), default to zero
- The origin of the hexagon (representing center of hexagon)
- color : str
- the color of the wireframe, in chemlab colors
-
add_plane
(vectors, origin=<Mock object>, rev_normal=False, color='red', alpha=1.0)[source]¶ add square plane to visualisation
- vectors : np.ndarray((2,3), dtype=float)
- The two vectors representing the edges of the plane.
- origin : np.ndarray((3,3), dtype=float), default to zero
- The origin of the plane.
- rev_normal : bool
- whether to reverse direction of normal (for lighting calculations)
- color : str
- the color of the plane, in chemlab colors
-
basic_vis
(atoms_df=None, meta=None, spheres=True, illustrate=False, xrot=0, yrot=0, zrot=0, fov=10.0, axes=<Mock object>, axes_length=1.0, axes_offset=(-1.2, 0.2), size=400, quality=5)[source]¶ basic visualisation shortcut
invoking add_atoms, add_box (if meta), add_axes, get_image and visualise functions
-
create_textline_image
(text, fontsize=10, color=(0, 0, 0), background=(255, 255, 255), boxsize=(1000, 20))[source]¶ create a PIL image from a line of text
-
get_image
(xrot=0, yrot=0, zrot=0, fov=5.0, size=400, quality=5, zoom_extents=None, trim_whitespace=True)[source]¶ get image of visualisation
NB: x-axis horizontal, y-axis vertical, z-axis out of page
Parameters: - rotx (float) – rotation about x (degrees)
- roty (float) – rotation about y (degrees)
- rotz (float) – rotation about z (degrees)
- fov (float) – field of view angle (degrees)
- size (float) – size of image
- quality (float) – quality of image (pixels per point), note: higher quality will take longer to render
- zoom_extents (None or np.ndarray((N, 3))) – define an array of points to autozoom image, if None then computed automatically
- trim_whitespace (bool) – whether to trim whitspace around image
Returns: image
Return type: PIL.Image
-
open_qtview
(xrot=0, yrot=0, zrot=0, fov=5.0, thickness=1, zoom_extents=None)[source]¶ open a qt viewer of the objects
Parameters: - rotx (float) – rotation about x (degrees)
- roty (float) – rotation about y (degrees)
- rotz (float) – rotation about z (degrees)
- fov (float) – field of view angle (degrees)
- thickness (float) – multiplier for thickness of lines for some objects
- zoom_extents (None or np.ndarray((N, 3))) – define an array of points to autozoom image, if None then computed automatically
Returns: viewer – the qt viewing window
Return type: PyQt4.QtGui.QMainWindow
-