entities.trajectory.annotations
entities.trajectory.annotations
Classes
AtomInfo
entities.trajectory.annotations.AtomInfo(trajectory)
Atom Info Trajectory Annotation
This annotation shows the atom info of a selection. This annotation can be added using the ‘add_atom_info’ method of the trajectory’s annotation manager: trajectory.annotations.add_atom_info(…)
Attributes
selection
str
MDAnalysis selection phrase to select the atom group
show_resid
bool
Whether or not to show the res ID along with the atom name
show_segid
bool
Whether or not to show the seg ID along with the atom name
Methods
bpy_image_to_pil_image
entities.trajectory.annotations.AtomInfo.bpy_image_to_pil_image(bpy_image)
Convert Blender image to PIL image
distance
entities.trajectory.annotations.AtomInfo.distance(v1, v2)
Distance between two vectors
Parameters
v1
Vector
A 3D or 2D vector or tuple
required
v2
Vector
A 3D or 2D vector or tuple
required
Returns
Distance between the two vectors
draw_bmesh
entities.trajectory.annotations.AtomInfo.draw_bmesh(bm, overrides= None )
Draw a Blender bmesh
Parameters
bm
bmesh .types .BMesh
A bmesh object. A copy is made for internal use. Users will have to free the passed in object
required
overrides
dict
Optional dictionary to override common annotation params
None
draw_bpy_image
entities.trajectory.annotations.AtomInfo.draw_bpy_image(
pos_2d,
image,
scale= 1.0 ,
)
Draw an image from bpy.data.images at the given 2D position (normalized co-ordinates) of Viewport.
Parameters
pos_2d
Vector
Normalized co-ordinates (0 - 1). (0, 0) is at bottom left. Bottom left of the image is placed at this position
required
image
bpy.types .Image
An image from bpy.data.images to draw at specified position
required
scale
float
Scale of the image to draw
1.0
draw_circle_2d
entities.trajectory.annotations.AtomInfo.draw_circle_2d(
center,
radius,
angle= 360.0 ,
start_dv= None ,
c_arrow= False ,
cc_arrow= False ,
overrides= None ,
)
Draw a circle around a 2D point (normalized coordinate) in the viewport space
Parameters
center
Vector
A 2D co-ordinate of the center. Normalized co-ordinate (0 - 1). (0, 0) is at bottom left
required
radius
float
The radius of the circle
required
angle
float
An angle less than 360 for partial circle (arc) - in degrees Default is 360 degrees
360.0
start_dv
Vector
The direction vector along which to start the circle (arc) If not provided, a random point in the circle plane is chosen
None
c_arrow
bool
Whether to display clockwise arrow. Default is False
False
cc_arrow
bool
Whether to display counter clockwise arrow. Default is False
False
overrides
dict
Optional dictionary to override common annotation params
None
draw_circle_3d
entities.trajectory.annotations.AtomInfo.draw_circle_3d(
center,
radius,
normal= None ,
angle= 360.0 ,
start_dv= None ,
c_arrow= False ,
cc_arrow= False ,
overrides= None ,
)
Draw a circle around a 3D point in the plane perpendicular to the given normal
Parameters
center
Vector
A 3D position vector of the center
required
radius
float
The radius of the circle
required
normal
Vector | None
The normal vector of the plane on which the cirle is to be drawn. When None, the circle is drawn in the viewport plane
None
angle
float
An angle less than 360 for partial circle (arc) - in degrees Default is 360 degrees
360.0
start_dv
Vector
The direction vector along which to start the circle (arc) If not provided, a random point in the plane perpendicular to the normal is chosen
None
c_arrow
bool
Whether to display clockwise arrow. Default is False
False
cc_arrow
bool
Whether to display counter clockwise arrow. Default is False
False
overrides
dict
Optional dictionary to override common annotation params
None
draw_cone
entities.trajectory.annotations.AtomInfo.draw_cone(
location= (0 , 0 , 0 ),
radius= 1.0 ,
height= 1.0 ,
axis= (0 , 0 , 1 ),
cap_ends= True ,
overrides= None ,
)
Draw a cone
Parameters
location
Vector
A 3D position vector of the base center
(0, 0, 0)
radius
float
Radius of the cone
1.0
height
float
Height of the cone
1.0
axis
Vector
Axis of the cone
(0, 0, 1)
cap_ends
bool
Whether to cap the base
True
overrides
dict
Optional dictionary to override common annotation params
None
draw_cylinder
entities.trajectory.annotations.AtomInfo.draw_cylinder(
location= (0 , 0 , 0 ),
radius= 1.0 ,
height= 1.0 ,
axis= (0 , 0 , 1 ),
cap_ends= True ,
overrides= None ,
)
Draw a cylinder
Parameters
location
Vector
A 3D position vector of the base center
(0, 0, 0)
radius
float
Radius of the cylinder
1.0
height
float
Height of the cylinder
1.0
axis
Vector
Axis of the cylinder
(0, 0, 1)
cap_ends
bool
Whether to cap the ends of cylinder
True
overrides
dict
Optional dictionary to override common annotation params
None
draw_line_2d
entities.trajectory.annotations.AtomInfo.draw_line_2d(
v1,
v2,
v1_text= None ,
v2_text= None ,
mid_text= None ,
v1_arrow= False ,
v2_arrow= False ,
overrides= None ,
)
Draw a line between two points (normalized co-ordinates) in 2D viewport space
Parameters
v1
Vector
2D co-ordinates of the first point. Normalized co-ordinate (0 - 1). (0, 0) is at bottom left
required
v2
Vector
2D co-ordinates of the second point. Normalized co-ordinate (0 - 1). (0, 0) is at bottom left
required
v1_text
str
Optional text to display at v1
None
v2_text
str
Optional text to display at v2
None
mid_text
str
Optional text to display at the middle of the line
None
v1_arrow
bool
Whether to display an arrow at v1
False
v2_arrow
bool
Whether to display an arrow at v2
False
overrides
dict
Optional dictionary to override common annotation params
None
draw_line_3d
entities.trajectory.annotations.AtomInfo.draw_line_3d(
v1,
v2,
v1_text= None ,
v2_text= None ,
mid_text= None ,
v1_arrow= False ,
v2_arrow= False ,
overrides= None ,
)
Draw a line between two points in 3D space
Parameters
v1
Vector
3D co-ordinates of the first point
required
v2
Vector
3D co-ordinates of the second point
required
v1_text
str
Optional text to display at v1
None
v2_text
str
Optional text to display at v2
None
mid_text
str
Optional text to display at the middle of the line
None
v1_arrow
bool
Whether to display an arrow at v1
False
v2_arrow
bool
Whether to display an arrow at v2
False
overrides
dict
Optional dictionary to override common annotation params
None
draw_n_sided_cylinder
entities.trajectory.annotations.AtomInfo.draw_n_sided_cylinder(
n= 6 ,
radius= 10 ,
height= 10 ,
origin= (0 , 0 , 0 ),
axis= (0 , 0 , 1 ),
cap_ends= True ,
overrides= None ,
)
Draw an n sided cylinder Eg: square, rectangle, triangular prism, cube, cuboid, hexagonal cell etc
Parameters
n
int
Number of sides
6
radius
float
Radius of the cylinder
10
height
float
Height of the cylinder
10
origin
Vector
Center of the base of the cylinder
(0, 0, 0)
axis
Vector
Axis of the cylinder
(0, 0, 1)
cap_ends
bool
Whether to cap the ends of cylinder
True
overrides
dict
Optional dictionary to override common annotation params
None
draw_n_sided_pyramid
entities.trajectory.annotations.AtomInfo.draw_n_sided_pyramid(
n= 6 ,
radius= 10 ,
height= 10 ,
origin= (0 , 0 , 0 ),
axis= (0 , 0 , 1 ),
cap_ends= True ,
overrides= None ,
)
Draw an n sided pyramid Eg: triangle, prism, square pyramid, pentagonal pyramid, etc
Parameters
n
int
Number of sides
6
radius
float
Radius of the pyramid
10
height
float
Height of the pyramid
10
origin
Vector
Center of the base of the pyramid
(0, 0, 0)
axis
Vector
Axis of the pyramid
(0, 0, 1)
cap_ends
bool
Whether to cap the ends of pyramid
True
overrides
dict
Optional dictionary to override common annotation params
None
draw_sphere
entities.trajectory.annotations.AtomInfo.draw_sphere(
location= (0 , 0 , 0 ),
radius= 1.0 ,
overrides= None ,
)
Draw a sphere
Parameters
location
Vector
A 3D position vector of the center
(0, 0, 0)
radius
float
Radius of the sphere
1.0
overrides
dict
Optional dictionary to override common annotation params
None
draw_text_2d
entities.trajectory.annotations.AtomInfo.draw_text_2d(
pos_2d,
text,
overrides= None ,
)
Draw text at a given 2D position (normalized co-ordinates) of Viewport.
Parameters
pos_2d
Vector
Normalized co-ordinates (0 - 1). (0, 0) is at bottom left
required
text
str
Text to display. ‘|’ as multi-line separator
required
overrides
dict
Optional dictionary to override common annotation params
None
draw_text_3d
entities.trajectory.annotations.AtomInfo.draw_text_3d(
pos_3d,
text,
overrides= None ,
)
Draw text at a given 3D position
Parameters
pos_3d
Vector
Co-ordinates in 3D world space (x, y, z)
required
text
str
Text to display. ‘|’ as multi-line separator
required
overrides
dict
Optional dictionary to override common annotation params
None
draw_triclinic_cell
entities.trajectory.annotations.AtomInfo.draw_triclinic_cell(
a= 10.0 ,
b= 10.0 ,
c= 10.0 ,
alpha= 90.0 ,
beta= 90.0 ,
gamma= 90.0 ,
origin= (0 , 0 , 0 ),
show_lattice= False ,
overrides= None ,
)
Draw a triclinic box based on box vector lengths and angles
Parameters
a
float
Box vector a length
10.0
b
float
Box vector b length
10.0
c
float
Box vector c length
10.0
alpha
float
Angle between box vectors bc
90.0
beta
float
Angle between box vectors ac
90.0
gamma
float
Angle between box vectors ab
90.0
origin
Vector
Origin of the box
(0, 0, 0)
show_lattice
bool
Whether to show a 3x3x3 lattice
False
overrides
dict
Optional dictionary to override common annotation params
None
draw_wigner_seitz_cell
entities.trajectory.annotations.AtomInfo.draw_wigner_seitz_cell(
triclinic_vectors,
center_to_origin= False ,
show_lattice= False ,
overrides= None ,
)
Draw a Wigner-Seitz cell from triclinic vectors
Parameters
triclinic_vectors
npt .ArrayLike
Vectors that represent the base triclinic cell
required
center_to_origin
bool
Move the center of the cell to origin (0, 0, 0)
False
show_lattice
bool
Whether to show a 3x3x3 lattice
False
overrides
dict
Optional dictionary to override common annotation params
None
pil_image_to_bpy_image
entities.trajectory.annotations.AtomInfo.pil_image_to_bpy_image(
pil_image,
name= 'PIL Image' ,
)
Convert PIL image to Blender image
Parameters
pil_image
Image.Image
PIL Image
required
name
str
Name of the bpy.data.images data block. Using an exisiting name will re-use the data block, whereas using a new name will create a new image data block.
'PIL Image'
COM
entities.trajectory.annotations.COM(trajectory)
Center-of-Mass Trajectory Annotation
This annotation shows the center-of-mass of a selection. This annotation can be added using the ‘add_com’ method of the trajectory’s annotation manager: trajectory.annotations.add_com(…)
Attributes
selection
str
MDAnalysis selection phrase to select the atom group
text
str
Text do display at the center-of-mass
Methods
bpy_image_to_pil_image
entities.trajectory.annotations.COM.bpy_image_to_pil_image(bpy_image)
Convert Blender image to PIL image
distance
entities.trajectory.annotations.COM.distance(v1, v2)
Distance between two vectors
Parameters
v1
Vector
A 3D or 2D vector or tuple
required
v2
Vector
A 3D or 2D vector or tuple
required
Returns
Distance between the two vectors
draw_bmesh
entities.trajectory.annotations.COM.draw_bmesh(bm, overrides= None )
Draw a Blender bmesh
Parameters
bm
bmesh .types .BMesh
A bmesh object. A copy is made for internal use. Users will have to free the passed in object
required
overrides
dict
Optional dictionary to override common annotation params
None
draw_bpy_image
entities.trajectory.annotations.COM.draw_bpy_image(pos_2d, image, scale= 1.0 )
Draw an image from bpy.data.images at the given 2D position (normalized co-ordinates) of Viewport.
Parameters
pos_2d
Vector
Normalized co-ordinates (0 - 1). (0, 0) is at bottom left. Bottom left of the image is placed at this position
required
image
bpy.types .Image
An image from bpy.data.images to draw at specified position
required
scale
float
Scale of the image to draw
1.0
draw_circle_2d
entities.trajectory.annotations.COM.draw_circle_2d(
center,
radius,
angle= 360.0 ,
start_dv= None ,
c_arrow= False ,
cc_arrow= False ,
overrides= None ,
)
Draw a circle around a 2D point (normalized coordinate) in the viewport space
Parameters
center
Vector
A 2D co-ordinate of the center. Normalized co-ordinate (0 - 1). (0, 0) is at bottom left
required
radius
float
The radius of the circle
required
angle
float
An angle less than 360 for partial circle (arc) - in degrees Default is 360 degrees
360.0
start_dv
Vector
The direction vector along which to start the circle (arc) If not provided, a random point in the circle plane is chosen
None
c_arrow
bool
Whether to display clockwise arrow. Default is False
False
cc_arrow
bool
Whether to display counter clockwise arrow. Default is False
False
overrides
dict
Optional dictionary to override common annotation params
None
draw_circle_3d
entities.trajectory.annotations.COM.draw_circle_3d(
center,
radius,
normal= None ,
angle= 360.0 ,
start_dv= None ,
c_arrow= False ,
cc_arrow= False ,
overrides= None ,
)
Draw a circle around a 3D point in the plane perpendicular to the given normal
Parameters
center
Vector
A 3D position vector of the center
required
radius
float
The radius of the circle
required
normal
Vector | None
The normal vector of the plane on which the cirle is to be drawn. When None, the circle is drawn in the viewport plane
None
angle
float
An angle less than 360 for partial circle (arc) - in degrees Default is 360 degrees
360.0
start_dv
Vector
The direction vector along which to start the circle (arc) If not provided, a random point in the plane perpendicular to the normal is chosen
None
c_arrow
bool
Whether to display clockwise arrow. Default is False
False
cc_arrow
bool
Whether to display counter clockwise arrow. Default is False
False
overrides
dict
Optional dictionary to override common annotation params
None
draw_cone
entities.trajectory.annotations.COM.draw_cone(
location= (0 , 0 , 0 ),
radius= 1.0 ,
height= 1.0 ,
axis= (0 , 0 , 1 ),
cap_ends= True ,
overrides= None ,
)
Draw a cone
Parameters
location
Vector
A 3D position vector of the base center
(0, 0, 0)
radius
float
Radius of the cone
1.0
height
float
Height of the cone
1.0
axis
Vector
Axis of the cone
(0, 0, 1)
cap_ends
bool
Whether to cap the base
True
overrides
dict
Optional dictionary to override common annotation params
None
draw_cylinder
entities.trajectory.annotations.COM.draw_cylinder(
location= (0 , 0 , 0 ),
radius= 1.0 ,
height= 1.0 ,
axis= (0 , 0 , 1 ),
cap_ends= True ,
overrides= None ,
)
Draw a cylinder
Parameters
location
Vector
A 3D position vector of the base center
(0, 0, 0)
radius
float
Radius of the cylinder
1.0
height
float
Height of the cylinder
1.0
axis
Vector
Axis of the cylinder
(0, 0, 1)
cap_ends
bool
Whether to cap the ends of cylinder
True
overrides
dict
Optional dictionary to override common annotation params
None
draw_line_2d
entities.trajectory.annotations.COM.draw_line_2d(
v1,
v2,
v1_text= None ,
v2_text= None ,
mid_text= None ,
v1_arrow= False ,
v2_arrow= False ,
overrides= None ,
)
Draw a line between two points (normalized co-ordinates) in 2D viewport space
Parameters
v1
Vector
2D co-ordinates of the first point. Normalized co-ordinate (0 - 1). (0, 0) is at bottom left
required
v2
Vector
2D co-ordinates of the second point. Normalized co-ordinate (0 - 1). (0, 0) is at bottom left
required
v1_text
str
Optional text to display at v1
None
v2_text
str
Optional text to display at v2
None
mid_text
str
Optional text to display at the middle of the line
None
v1_arrow
bool
Whether to display an arrow at v1
False
v2_arrow
bool
Whether to display an arrow at v2
False
overrides
dict
Optional dictionary to override common annotation params
None
draw_line_3d
entities.trajectory.annotations.COM.draw_line_3d(
v1,
v2,
v1_text= None ,
v2_text= None ,
mid_text= None ,
v1_arrow= False ,
v2_arrow= False ,
overrides= None ,
)
Draw a line between two points in 3D space
Parameters
v1
Vector
3D co-ordinates of the first point
required
v2
Vector
3D co-ordinates of the second point
required
v1_text
str
Optional text to display at v1
None
v2_text
str
Optional text to display at v2
None
mid_text
str
Optional text to display at the middle of the line
None
v1_arrow
bool
Whether to display an arrow at v1
False
v2_arrow
bool
Whether to display an arrow at v2
False
overrides
dict
Optional dictionary to override common annotation params
None
draw_n_sided_cylinder
entities.trajectory.annotations.COM.draw_n_sided_cylinder(
n= 6 ,
radius= 10 ,
height= 10 ,
origin= (0 , 0 , 0 ),
axis= (0 , 0 , 1 ),
cap_ends= True ,
overrides= None ,
)
Draw an n sided cylinder Eg: square, rectangle, triangular prism, cube, cuboid, hexagonal cell etc
Parameters
n
int
Number of sides
6
radius
float
Radius of the cylinder
10
height
float
Height of the cylinder
10
origin
Vector
Center of the base of the cylinder
(0, 0, 0)
axis
Vector
Axis of the cylinder
(0, 0, 1)
cap_ends
bool
Whether to cap the ends of cylinder
True
overrides
dict
Optional dictionary to override common annotation params
None
draw_n_sided_pyramid
entities.trajectory.annotations.COM.draw_n_sided_pyramid(
n= 6 ,
radius= 10 ,
height= 10 ,
origin= (0 , 0 , 0 ),
axis= (0 , 0 , 1 ),
cap_ends= True ,
overrides= None ,
)
Draw an n sided pyramid Eg: triangle, prism, square pyramid, pentagonal pyramid, etc
Parameters
n
int
Number of sides
6
radius
float
Radius of the pyramid
10
height
float
Height of the pyramid
10
origin
Vector
Center of the base of the pyramid
(0, 0, 0)
axis
Vector
Axis of the pyramid
(0, 0, 1)
cap_ends
bool
Whether to cap the ends of pyramid
True
overrides
dict
Optional dictionary to override common annotation params
None
draw_sphere
entities.trajectory.annotations.COM.draw_sphere(
location= (0 , 0 , 0 ),
radius= 1.0 ,
overrides= None ,
)
Draw a sphere
Parameters
location
Vector
A 3D position vector of the center
(0, 0, 0)
radius
float
Radius of the sphere
1.0
overrides
dict
Optional dictionary to override common annotation params
None
draw_text_2d
entities.trajectory.annotations.COM.draw_text_2d(pos_2d, text, overrides= None )
Draw text at a given 2D position (normalized co-ordinates) of Viewport.
Parameters
pos_2d
Vector
Normalized co-ordinates (0 - 1). (0, 0) is at bottom left
required
text
str
Text to display. ‘|’ as multi-line separator
required
overrides
dict
Optional dictionary to override common annotation params
None
draw_text_3d
entities.trajectory.annotations.COM.draw_text_3d(pos_3d, text, overrides= None )
Draw text at a given 3D position
Parameters
pos_3d
Vector
Co-ordinates in 3D world space (x, y, z)
required
text
str
Text to display. ‘|’ as multi-line separator
required
overrides
dict
Optional dictionary to override common annotation params
None
draw_triclinic_cell
entities.trajectory.annotations.COM.draw_triclinic_cell(
a= 10.0 ,
b= 10.0 ,
c= 10.0 ,
alpha= 90.0 ,
beta= 90.0 ,
gamma= 90.0 ,
origin= (0 , 0 , 0 ),
show_lattice= False ,
overrides= None ,
)
Draw a triclinic box based on box vector lengths and angles
Parameters
a
float
Box vector a length
10.0
b
float
Box vector b length
10.0
c
float
Box vector c length
10.0
alpha
float
Angle between box vectors bc
90.0
beta
float
Angle between box vectors ac
90.0
gamma
float
Angle between box vectors ab
90.0
origin
Vector
Origin of the box
(0, 0, 0)
show_lattice
bool
Whether to show a 3x3x3 lattice
False
overrides
dict
Optional dictionary to override common annotation params
None
draw_wigner_seitz_cell
entities.trajectory.annotations.COM.draw_wigner_seitz_cell(
triclinic_vectors,
center_to_origin= False ,
show_lattice= False ,
overrides= None ,
)
Draw a Wigner-Seitz cell from triclinic vectors
Parameters
triclinic_vectors
npt .ArrayLike
Vectors that represent the base triclinic cell
required
center_to_origin
bool
Move the center of the cell to origin (0, 0, 0)
False
show_lattice
bool
Whether to show a 3x3x3 lattice
False
overrides
dict
Optional dictionary to override common annotation params
None
pil_image_to_bpy_image
entities.trajectory.annotations.COM.pil_image_to_bpy_image(
pil_image,
name= 'PIL Image' ,
)
Convert PIL image to Blender image
Parameters
pil_image
Image.Image
PIL Image
required
name
str
Name of the bpy.data.images data block. Using an exisiting name will re-use the data block, whereas using a new name will create a new image data block.
'PIL Image'
COMDistance
entities.trajectory.annotations.COMDistance(trajectory)
Distance between Center-of-Masses Trajectory Annotation
This annotation shows the distance between center-of-masses of two selections. This annotation can be added using the ‘add_com_distance’ method of the trajectory’s annotation manager: trajectory.annotations.add_com_distance(…)
Attributes
selection1
str
MDAnalysis selection phrase to select the first atom group
selection2
str
MDAnalysis selection phrase to select the second atom group
text1
str
Text do display at the first center-of-mass
text2
str
Text do display at the second center-of-mass
Methods
bpy_image_to_pil_image
entities.trajectory.annotations.COMDistance.bpy_image_to_pil_image(bpy_image)
Convert Blender image to PIL image
distance
entities.trajectory.annotations.COMDistance.distance(v1, v2)
Distance between two vectors
Parameters
v1
Vector
A 3D or 2D vector or tuple
required
v2
Vector
A 3D or 2D vector or tuple
required
Returns
Distance between the two vectors
draw_bmesh
entities.trajectory.annotations.COMDistance.draw_bmesh(bm, overrides= None )
Draw a Blender bmesh
Parameters
bm
bmesh .types .BMesh
A bmesh object. A copy is made for internal use. Users will have to free the passed in object
required
overrides
dict
Optional dictionary to override common annotation params
None
draw_bpy_image
entities.trajectory.annotations.COMDistance.draw_bpy_image(
pos_2d,
image,
scale= 1.0 ,
)
Draw an image from bpy.data.images at the given 2D position (normalized co-ordinates) of Viewport.
Parameters
pos_2d
Vector
Normalized co-ordinates (0 - 1). (0, 0) is at bottom left. Bottom left of the image is placed at this position
required
image
bpy.types .Image
An image from bpy.data.images to draw at specified position
required
scale
float
Scale of the image to draw
1.0
draw_circle_2d
entities.trajectory.annotations.COMDistance.draw_circle_2d(
center,
radius,
angle= 360.0 ,
start_dv= None ,
c_arrow= False ,
cc_arrow= False ,
overrides= None ,
)
Draw a circle around a 2D point (normalized coordinate) in the viewport space
Parameters
center
Vector
A 2D co-ordinate of the center. Normalized co-ordinate (0 - 1). (0, 0) is at bottom left
required
radius
float
The radius of the circle
required
angle
float
An angle less than 360 for partial circle (arc) - in degrees Default is 360 degrees
360.0
start_dv
Vector
The direction vector along which to start the circle (arc) If not provided, a random point in the circle plane is chosen
None
c_arrow
bool
Whether to display clockwise arrow. Default is False
False
cc_arrow
bool
Whether to display counter clockwise arrow. Default is False
False
overrides
dict
Optional dictionary to override common annotation params
None
draw_circle_3d
entities.trajectory.annotations.COMDistance.draw_circle_3d(
center,
radius,
normal= None ,
angle= 360.0 ,
start_dv= None ,
c_arrow= False ,
cc_arrow= False ,
overrides= None ,
)
Draw a circle around a 3D point in the plane perpendicular to the given normal
Parameters
center
Vector
A 3D position vector of the center
required
radius
float
The radius of the circle
required
normal
Vector | None
The normal vector of the plane on which the cirle is to be drawn. When None, the circle is drawn in the viewport plane
None
angle
float
An angle less than 360 for partial circle (arc) - in degrees Default is 360 degrees
360.0
start_dv
Vector
The direction vector along which to start the circle (arc) If not provided, a random point in the plane perpendicular to the normal is chosen
None
c_arrow
bool
Whether to display clockwise arrow. Default is False
False
cc_arrow
bool
Whether to display counter clockwise arrow. Default is False
False
overrides
dict
Optional dictionary to override common annotation params
None
draw_cone
entities.trajectory.annotations.COMDistance.draw_cone(
location= (0 , 0 , 0 ),
radius= 1.0 ,
height= 1.0 ,
axis= (0 , 0 , 1 ),
cap_ends= True ,
overrides= None ,
)
Draw a cone
Parameters
location
Vector
A 3D position vector of the base center
(0, 0, 0)
radius
float
Radius of the cone
1.0
height
float
Height of the cone
1.0
axis
Vector
Axis of the cone
(0, 0, 1)
cap_ends
bool
Whether to cap the base
True
overrides
dict
Optional dictionary to override common annotation params
None
draw_cylinder
entities.trajectory.annotations.COMDistance.draw_cylinder(
location= (0 , 0 , 0 ),
radius= 1.0 ,
height= 1.0 ,
axis= (0 , 0 , 1 ),
cap_ends= True ,
overrides= None ,
)
Draw a cylinder
Parameters
location
Vector
A 3D position vector of the base center
(0, 0, 0)
radius
float
Radius of the cylinder
1.0
height
float
Height of the cylinder
1.0
axis
Vector
Axis of the cylinder
(0, 0, 1)
cap_ends
bool
Whether to cap the ends of cylinder
True
overrides
dict
Optional dictionary to override common annotation params
None
draw_line_2d
entities.trajectory.annotations.COMDistance.draw_line_2d(
v1,
v2,
v1_text= None ,
v2_text= None ,
mid_text= None ,
v1_arrow= False ,
v2_arrow= False ,
overrides= None ,
)
Draw a line between two points (normalized co-ordinates) in 2D viewport space
Parameters
v1
Vector
2D co-ordinates of the first point. Normalized co-ordinate (0 - 1). (0, 0) is at bottom left
required
v2
Vector
2D co-ordinates of the second point. Normalized co-ordinate (0 - 1). (0, 0) is at bottom left
required
v1_text
str
Optional text to display at v1
None
v2_text
str
Optional text to display at v2
None
mid_text
str
Optional text to display at the middle of the line
None
v1_arrow
bool
Whether to display an arrow at v1
False
v2_arrow
bool
Whether to display an arrow at v2
False
overrides
dict
Optional dictionary to override common annotation params
None
draw_line_3d
entities.trajectory.annotations.COMDistance.draw_line_3d(
v1,
v2,
v1_text= None ,
v2_text= None ,
mid_text= None ,
v1_arrow= False ,
v2_arrow= False ,
overrides= None ,
)
Draw a line between two points in 3D space
Parameters
v1
Vector
3D co-ordinates of the first point
required
v2
Vector
3D co-ordinates of the second point
required
v1_text
str
Optional text to display at v1
None
v2_text
str
Optional text to display at v2
None
mid_text
str
Optional text to display at the middle of the line
None
v1_arrow
bool
Whether to display an arrow at v1
False
v2_arrow
bool
Whether to display an arrow at v2
False
overrides
dict
Optional dictionary to override common annotation params
None
draw_n_sided_cylinder
entities.trajectory.annotations.COMDistance.draw_n_sided_cylinder(
n= 6 ,
radius= 10 ,
height= 10 ,
origin= (0 , 0 , 0 ),
axis= (0 , 0 , 1 ),
cap_ends= True ,
overrides= None ,
)
Draw an n sided cylinder Eg: square, rectangle, triangular prism, cube, cuboid, hexagonal cell etc
Parameters
n
int
Number of sides
6
radius
float
Radius of the cylinder
10
height
float
Height of the cylinder
10
origin
Vector
Center of the base of the cylinder
(0, 0, 0)
axis
Vector
Axis of the cylinder
(0, 0, 1)
cap_ends
bool
Whether to cap the ends of cylinder
True
overrides
dict
Optional dictionary to override common annotation params
None
draw_n_sided_pyramid
entities.trajectory.annotations.COMDistance.draw_n_sided_pyramid(
n= 6 ,
radius= 10 ,
height= 10 ,
origin= (0 , 0 , 0 ),
axis= (0 , 0 , 1 ),
cap_ends= True ,
overrides= None ,
)
Draw an n sided pyramid Eg: triangle, prism, square pyramid, pentagonal pyramid, etc
Parameters
n
int
Number of sides
6
radius
float
Radius of the pyramid
10
height
float
Height of the pyramid
10
origin
Vector
Center of the base of the pyramid
(0, 0, 0)
axis
Vector
Axis of the pyramid
(0, 0, 1)
cap_ends
bool
Whether to cap the ends of pyramid
True
overrides
dict
Optional dictionary to override common annotation params
None
draw_sphere
entities.trajectory.annotations.COMDistance.draw_sphere(
location= (0 , 0 , 0 ),
radius= 1.0 ,
overrides= None ,
)
Draw a sphere
Parameters
location
Vector
A 3D position vector of the center
(0, 0, 0)
radius
float
Radius of the sphere
1.0
overrides
dict
Optional dictionary to override common annotation params
None
draw_text_2d
entities.trajectory.annotations.COMDistance.draw_text_2d(
pos_2d,
text,
overrides= None ,
)
Draw text at a given 2D position (normalized co-ordinates) of Viewport.
Parameters
pos_2d
Vector
Normalized co-ordinates (0 - 1). (0, 0) is at bottom left
required
text
str
Text to display. ‘|’ as multi-line separator
required
overrides
dict
Optional dictionary to override common annotation params
None
draw_text_3d
entities.trajectory.annotations.COMDistance.draw_text_3d(
pos_3d,
text,
overrides= None ,
)
Draw text at a given 3D position
Parameters
pos_3d
Vector
Co-ordinates in 3D world space (x, y, z)
required
text
str
Text to display. ‘|’ as multi-line separator
required
overrides
dict
Optional dictionary to override common annotation params
None
draw_triclinic_cell
entities.trajectory.annotations.COMDistance.draw_triclinic_cell(
a= 10.0 ,
b= 10.0 ,
c= 10.0 ,
alpha= 90.0 ,
beta= 90.0 ,
gamma= 90.0 ,
origin= (0 , 0 , 0 ),
show_lattice= False ,
overrides= None ,
)
Draw a triclinic box based on box vector lengths and angles
Parameters
a
float
Box vector a length
10.0
b
float
Box vector b length
10.0
c
float
Box vector c length
10.0
alpha
float
Angle between box vectors bc
90.0
beta
float
Angle between box vectors ac
90.0
gamma
float
Angle between box vectors ab
90.0
origin
Vector
Origin of the box
(0, 0, 0)
show_lattice
bool
Whether to show a 3x3x3 lattice
False
overrides
dict
Optional dictionary to override common annotation params
None
draw_wigner_seitz_cell
entities.trajectory.annotations.COMDistance.draw_wigner_seitz_cell(
triclinic_vectors,
center_to_origin= False ,
show_lattice= False ,
overrides= None ,
)
Draw a Wigner-Seitz cell from triclinic vectors
Parameters
triclinic_vectors
npt .ArrayLike
Vectors that represent the base triclinic cell
required
center_to_origin
bool
Move the center of the cell to origin (0, 0, 0)
False
show_lattice
bool
Whether to show a 3x3x3 lattice
False
overrides
dict
Optional dictionary to override common annotation params
None
pil_image_to_bpy_image
entities.trajectory.annotations.COMDistance.pil_image_to_bpy_image(
pil_image,
name= 'PIL Image' ,
)
Convert PIL image to Blender image
Parameters
pil_image
Image.Image
PIL Image
required
name
str
Name of the bpy.data.images data block. Using an exisiting name will re-use the data block, whereas using a new name will create a new image data block.
'PIL Image'
CanonicalDihedrals
entities.trajectory.annotations.CanonicalDihedrals(trajectory)
Canonical Dihedrals of a given residue
Attributes
resid
int
The residue number
show_atom_names
bool
Whether or not to show the individual atom names in the residue
show_direction
bool
Whether or not to show the arc indicating the angle direction
Methods
bpy_image_to_pil_image
entities.trajectory.annotations.CanonicalDihedrals.bpy_image_to_pil_image(
bpy_image,
)
Convert Blender image to PIL image
distance
entities.trajectory.annotations.CanonicalDihedrals.distance(v1, v2)
Distance between two vectors
Parameters
v1
Vector
A 3D or 2D vector or tuple
required
v2
Vector
A 3D or 2D vector or tuple
required
Returns
Distance between the two vectors
draw_bmesh
entities.trajectory.annotations.CanonicalDihedrals.draw_bmesh(
bm,
overrides= None ,
)
Draw a Blender bmesh
Parameters
bm
bmesh .types .BMesh
A bmesh object. A copy is made for internal use. Users will have to free the passed in object
required
overrides
dict
Optional dictionary to override common annotation params
None
draw_bpy_image
entities.trajectory.annotations.CanonicalDihedrals.draw_bpy_image(
pos_2d,
image,
scale= 1.0 ,
)
Draw an image from bpy.data.images at the given 2D position (normalized co-ordinates) of Viewport.
Parameters
pos_2d
Vector
Normalized co-ordinates (0 - 1). (0, 0) is at bottom left. Bottom left of the image is placed at this position
required
image
bpy.types .Image
An image from bpy.data.images to draw at specified position
required
scale
float
Scale of the image to draw
1.0
draw_circle_2d
entities.trajectory.annotations.CanonicalDihedrals.draw_circle_2d(
center,
radius,
angle= 360.0 ,
start_dv= None ,
c_arrow= False ,
cc_arrow= False ,
overrides= None ,
)
Draw a circle around a 2D point (normalized coordinate) in the viewport space
Parameters
center
Vector
A 2D co-ordinate of the center. Normalized co-ordinate (0 - 1). (0, 0) is at bottom left
required
radius
float
The radius of the circle
required
angle
float
An angle less than 360 for partial circle (arc) - in degrees Default is 360 degrees
360.0
start_dv
Vector
The direction vector along which to start the circle (arc) If not provided, a random point in the circle plane is chosen
None
c_arrow
bool
Whether to display clockwise arrow. Default is False
False
cc_arrow
bool
Whether to display counter clockwise arrow. Default is False
False
overrides
dict
Optional dictionary to override common annotation params
None
draw_circle_3d
entities.trajectory.annotations.CanonicalDihedrals.draw_circle_3d(
center,
radius,
normal= None ,
angle= 360.0 ,
start_dv= None ,
c_arrow= False ,
cc_arrow= False ,
overrides= None ,
)
Draw a circle around a 3D point in the plane perpendicular to the given normal
Parameters
center
Vector
A 3D position vector of the center
required
radius
float
The radius of the circle
required
normal
Vector | None
The normal vector of the plane on which the cirle is to be drawn. When None, the circle is drawn in the viewport plane
None
angle
float
An angle less than 360 for partial circle (arc) - in degrees Default is 360 degrees
360.0
start_dv
Vector
The direction vector along which to start the circle (arc) If not provided, a random point in the plane perpendicular to the normal is chosen
None
c_arrow
bool
Whether to display clockwise arrow. Default is False
False
cc_arrow
bool
Whether to display counter clockwise arrow. Default is False
False
overrides
dict
Optional dictionary to override common annotation params
None
draw_cone
entities.trajectory.annotations.CanonicalDihedrals.draw_cone(
location= (0 , 0 , 0 ),
radius= 1.0 ,
height= 1.0 ,
axis= (0 , 0 , 1 ),
cap_ends= True ,
overrides= None ,
)
Draw a cone
Parameters
location
Vector
A 3D position vector of the base center
(0, 0, 0)
radius
float
Radius of the cone
1.0
height
float
Height of the cone
1.0
axis
Vector
Axis of the cone
(0, 0, 1)
cap_ends
bool
Whether to cap the base
True
overrides
dict
Optional dictionary to override common annotation params
None
draw_cylinder
entities.trajectory.annotations.CanonicalDihedrals.draw_cylinder(
location= (0 , 0 , 0 ),
radius= 1.0 ,
height= 1.0 ,
axis= (0 , 0 , 1 ),
cap_ends= True ,
overrides= None ,
)
Draw a cylinder
Parameters
location
Vector
A 3D position vector of the base center
(0, 0, 0)
radius
float
Radius of the cylinder
1.0
height
float
Height of the cylinder
1.0
axis
Vector
Axis of the cylinder
(0, 0, 1)
cap_ends
bool
Whether to cap the ends of cylinder
True
overrides
dict
Optional dictionary to override common annotation params
None
draw_line_2d
entities.trajectory.annotations.CanonicalDihedrals.draw_line_2d(
v1,
v2,
v1_text= None ,
v2_text= None ,
mid_text= None ,
v1_arrow= False ,
v2_arrow= False ,
overrides= None ,
)
Draw a line between two points (normalized co-ordinates) in 2D viewport space
Parameters
v1
Vector
2D co-ordinates of the first point. Normalized co-ordinate (0 - 1). (0, 0) is at bottom left
required
v2
Vector
2D co-ordinates of the second point. Normalized co-ordinate (0 - 1). (0, 0) is at bottom left
required
v1_text
str
Optional text to display at v1
None
v2_text
str
Optional text to display at v2
None
mid_text
str
Optional text to display at the middle of the line
None
v1_arrow
bool
Whether to display an arrow at v1
False
v2_arrow
bool
Whether to display an arrow at v2
False
overrides
dict
Optional dictionary to override common annotation params
None
draw_line_3d
entities.trajectory.annotations.CanonicalDihedrals.draw_line_3d(
v1,
v2,
v1_text= None ,
v2_text= None ,
mid_text= None ,
v1_arrow= False ,
v2_arrow= False ,
overrides= None ,
)
Draw a line between two points in 3D space
Parameters
v1
Vector
3D co-ordinates of the first point
required
v2
Vector
3D co-ordinates of the second point
required
v1_text
str
Optional text to display at v1
None
v2_text
str
Optional text to display at v2
None
mid_text
str
Optional text to display at the middle of the line
None
v1_arrow
bool
Whether to display an arrow at v1
False
v2_arrow
bool
Whether to display an arrow at v2
False
overrides
dict
Optional dictionary to override common annotation params
None
draw_n_sided_cylinder
entities.trajectory.annotations.CanonicalDihedrals.draw_n_sided_cylinder(
n= 6 ,
radius= 10 ,
height= 10 ,
origin= (0 , 0 , 0 ),
axis= (0 , 0 , 1 ),
cap_ends= True ,
overrides= None ,
)
Draw an n sided cylinder Eg: square, rectangle, triangular prism, cube, cuboid, hexagonal cell etc
Parameters
n
int
Number of sides
6
radius
float
Radius of the cylinder
10
height
float
Height of the cylinder
10
origin
Vector
Center of the base of the cylinder
(0, 0, 0)
axis
Vector
Axis of the cylinder
(0, 0, 1)
cap_ends
bool
Whether to cap the ends of cylinder
True
overrides
dict
Optional dictionary to override common annotation params
None
draw_n_sided_pyramid
entities.trajectory.annotations.CanonicalDihedrals.draw_n_sided_pyramid(
n= 6 ,
radius= 10 ,
height= 10 ,
origin= (0 , 0 , 0 ),
axis= (0 , 0 , 1 ),
cap_ends= True ,
overrides= None ,
)
Draw an n sided pyramid Eg: triangle, prism, square pyramid, pentagonal pyramid, etc
Parameters
n
int
Number of sides
6
radius
float
Radius of the pyramid
10
height
float
Height of the pyramid
10
origin
Vector
Center of the base of the pyramid
(0, 0, 0)
axis
Vector
Axis of the pyramid
(0, 0, 1)
cap_ends
bool
Whether to cap the ends of pyramid
True
overrides
dict
Optional dictionary to override common annotation params
None
draw_sphere
entities.trajectory.annotations.CanonicalDihedrals.draw_sphere(
location= (0 , 0 , 0 ),
radius= 1.0 ,
overrides= None ,
)
Draw a sphere
Parameters
location
Vector
A 3D position vector of the center
(0, 0, 0)
radius
float
Radius of the sphere
1.0
overrides
dict
Optional dictionary to override common annotation params
None
draw_text_2d
entities.trajectory.annotations.CanonicalDihedrals.draw_text_2d(
pos_2d,
text,
overrides= None ,
)
Draw text at a given 2D position (normalized co-ordinates) of Viewport.
Parameters
pos_2d
Vector
Normalized co-ordinates (0 - 1). (0, 0) is at bottom left
required
text
str
Text to display. ‘|’ as multi-line separator
required
overrides
dict
Optional dictionary to override common annotation params
None
draw_text_3d
entities.trajectory.annotations.CanonicalDihedrals.draw_text_3d(
pos_3d,
text,
overrides= None ,
)
Draw text at a given 3D position
Parameters
pos_3d
Vector
Co-ordinates in 3D world space (x, y, z)
required
text
str
Text to display. ‘|’ as multi-line separator
required
overrides
dict
Optional dictionary to override common annotation params
None
draw_triclinic_cell
entities.trajectory.annotations.CanonicalDihedrals.draw_triclinic_cell(
a= 10.0 ,
b= 10.0 ,
c= 10.0 ,
alpha= 90.0 ,
beta= 90.0 ,
gamma= 90.0 ,
origin= (0 , 0 , 0 ),
show_lattice= False ,
overrides= None ,
)
Draw a triclinic box based on box vector lengths and angles
Parameters
a
float
Box vector a length
10.0
b
float
Box vector b length
10.0
c
float
Box vector c length
10.0
alpha
float
Angle between box vectors bc
90.0
beta
float
Angle between box vectors ac
90.0
gamma
float
Angle between box vectors ab
90.0
origin
Vector
Origin of the box
(0, 0, 0)
show_lattice
bool
Whether to show a 3x3x3 lattice
False
overrides
dict
Optional dictionary to override common annotation params
None
draw_wigner_seitz_cell
entities.trajectory.annotations.CanonicalDihedrals.draw_wigner_seitz_cell(
triclinic_vectors,
center_to_origin= False ,
show_lattice= False ,
overrides= None ,
)
Draw a Wigner-Seitz cell from triclinic vectors
Parameters
triclinic_vectors
npt .ArrayLike
Vectors that represent the base triclinic cell
required
center_to_origin
bool
Move the center of the cell to origin (0, 0, 0)
False
show_lattice
bool
Whether to show a 3x3x3 lattice
False
overrides
dict
Optional dictionary to override common annotation params
None
pil_image_to_bpy_image
entities.trajectory.annotations.CanonicalDihedrals.pil_image_to_bpy_image(
pil_image,
name= 'PIL Image' ,
)
Convert PIL image to Blender image
Parameters
pil_image
Image.Image
PIL Image
required
name
str
Name of the bpy.data.images data block. Using an exisiting name will re-use the data block, whereas using a new name will create a new image data block.
'PIL Image'
TrajectoryAnnotation
entities.trajectory.annotations.TrajectoryAnnotation(trajectory)
Base class for a Trajectory Annotation
All trajectory annotations should derive from this base class and implement the ‘draw’ method. All derived classes will have access to the trajectory instance (self.trajectory) and all the annotation inputs and common params via self.interface.
An optional ‘defaults’ method can be provided to set default values to the annotation.
Methods
bpy_image_to_pil_image
entities.trajectory.annotations.TrajectoryAnnotation.bpy_image_to_pil_image(
bpy_image,
)
Convert Blender image to PIL image
defaults
entities.trajectory.annotations.TrajectoryAnnotation.defaults()
Optional method to set default annotation params This is called only once when the annotation instance is created
distance
entities.trajectory.annotations.TrajectoryAnnotation.distance(v1, v2)
Distance between two vectors
Parameters
v1
Vector
A 3D or 2D vector or tuple
required
v2
Vector
A 3D or 2D vector or tuple
required
Returns
Distance between the two vectors
draw
entities.trajectory.annotations.TrajectoryAnnotation.draw()
The main draw method for an annotation This is called multiple times in the 3D viewport draw handler
draw_bmesh
entities.trajectory.annotations.TrajectoryAnnotation.draw_bmesh(
bm,
overrides= None ,
)
Draw a Blender bmesh
Parameters
bm
bmesh .types .BMesh
A bmesh object. A copy is made for internal use. Users will have to free the passed in object
required
overrides
dict
Optional dictionary to override common annotation params
None
draw_bpy_image
entities.trajectory.annotations.TrajectoryAnnotation.draw_bpy_image(
pos_2d,
image,
scale= 1.0 ,
)
Draw an image from bpy.data.images at the given 2D position (normalized co-ordinates) of Viewport.
Parameters
pos_2d
Vector
Normalized co-ordinates (0 - 1). (0, 0) is at bottom left. Bottom left of the image is placed at this position
required
image
bpy.types .Image
An image from bpy.data.images to draw at specified position
required
scale
float
Scale of the image to draw
1.0
draw_circle_2d
entities.trajectory.annotations.TrajectoryAnnotation.draw_circle_2d(
center,
radius,
angle= 360.0 ,
start_dv= None ,
c_arrow= False ,
cc_arrow= False ,
overrides= None ,
)
Draw a circle around a 2D point (normalized coordinate) in the viewport space
Parameters
center
Vector
A 2D co-ordinate of the center. Normalized co-ordinate (0 - 1). (0, 0) is at bottom left
required
radius
float
The radius of the circle
required
angle
float
An angle less than 360 for partial circle (arc) - in degrees Default is 360 degrees
360.0
start_dv
Vector
The direction vector along which to start the circle (arc) If not provided, a random point in the circle plane is chosen
None
c_arrow
bool
Whether to display clockwise arrow. Default is False
False
cc_arrow
bool
Whether to display counter clockwise arrow. Default is False
False
overrides
dict
Optional dictionary to override common annotation params
None
draw_circle_3d
entities.trajectory.annotations.TrajectoryAnnotation.draw_circle_3d(
center,
radius,
normal= None ,
angle= 360.0 ,
start_dv= None ,
c_arrow= False ,
cc_arrow= False ,
overrides= None ,
)
Draw a circle around a 3D point in the plane perpendicular to the given normal
Parameters
center
Vector
A 3D position vector of the center
required
radius
float
The radius of the circle
required
normal
Vector | None
The normal vector of the plane on which the cirle is to be drawn. When None, the circle is drawn in the viewport plane
None
angle
float
An angle less than 360 for partial circle (arc) - in degrees Default is 360 degrees
360.0
start_dv
Vector
The direction vector along which to start the circle (arc) If not provided, a random point in the plane perpendicular to the normal is chosen
None
c_arrow
bool
Whether to display clockwise arrow. Default is False
False
cc_arrow
bool
Whether to display counter clockwise arrow. Default is False
False
overrides
dict
Optional dictionary to override common annotation params
None
draw_cone
entities.trajectory.annotations.TrajectoryAnnotation.draw_cone(
location= (0 , 0 , 0 ),
radius= 1.0 ,
height= 1.0 ,
axis= (0 , 0 , 1 ),
cap_ends= True ,
overrides= None ,
)
Draw a cone
Parameters
location
Vector
A 3D position vector of the base center
(0, 0, 0)
radius
float
Radius of the cone
1.0
height
float
Height of the cone
1.0
axis
Vector
Axis of the cone
(0, 0, 1)
cap_ends
bool
Whether to cap the base
True
overrides
dict
Optional dictionary to override common annotation params
None
draw_cylinder
entities.trajectory.annotations.TrajectoryAnnotation.draw_cylinder(
location= (0 , 0 , 0 ),
radius= 1.0 ,
height= 1.0 ,
axis= (0 , 0 , 1 ),
cap_ends= True ,
overrides= None ,
)
Draw a cylinder
Parameters
location
Vector
A 3D position vector of the base center
(0, 0, 0)
radius
float
Radius of the cylinder
1.0
height
float
Height of the cylinder
1.0
axis
Vector
Axis of the cylinder
(0, 0, 1)
cap_ends
bool
Whether to cap the ends of cylinder
True
overrides
dict
Optional dictionary to override common annotation params
None
draw_line_2d
entities.trajectory.annotations.TrajectoryAnnotation.draw_line_2d(
v1,
v2,
v1_text= None ,
v2_text= None ,
mid_text= None ,
v1_arrow= False ,
v2_arrow= False ,
overrides= None ,
)
Draw a line between two points (normalized co-ordinates) in 2D viewport space
Parameters
v1
Vector
2D co-ordinates of the first point. Normalized co-ordinate (0 - 1). (0, 0) is at bottom left
required
v2
Vector
2D co-ordinates of the second point. Normalized co-ordinate (0 - 1). (0, 0) is at bottom left
required
v1_text
str
Optional text to display at v1
None
v2_text
str
Optional text to display at v2
None
mid_text
str
Optional text to display at the middle of the line
None
v1_arrow
bool
Whether to display an arrow at v1
False
v2_arrow
bool
Whether to display an arrow at v2
False
overrides
dict
Optional dictionary to override common annotation params
None
draw_line_3d
entities.trajectory.annotations.TrajectoryAnnotation.draw_line_3d(
v1,
v2,
v1_text= None ,
v2_text= None ,
mid_text= None ,
v1_arrow= False ,
v2_arrow= False ,
overrides= None ,
)
Draw a line between two points in 3D space
Parameters
v1
Vector
3D co-ordinates of the first point
required
v2
Vector
3D co-ordinates of the second point
required
v1_text
str
Optional text to display at v1
None
v2_text
str
Optional text to display at v2
None
mid_text
str
Optional text to display at the middle of the line
None
v1_arrow
bool
Whether to display an arrow at v1
False
v2_arrow
bool
Whether to display an arrow at v2
False
overrides
dict
Optional dictionary to override common annotation params
None
draw_n_sided_cylinder
entities.trajectory.annotations.TrajectoryAnnotation.draw_n_sided_cylinder(
n= 6 ,
radius= 10 ,
height= 10 ,
origin= (0 , 0 , 0 ),
axis= (0 , 0 , 1 ),
cap_ends= True ,
overrides= None ,
)
Draw an n sided cylinder Eg: square, rectangle, triangular prism, cube, cuboid, hexagonal cell etc
Parameters
n
int
Number of sides
6
radius
float
Radius of the cylinder
10
height
float
Height of the cylinder
10
origin
Vector
Center of the base of the cylinder
(0, 0, 0)
axis
Vector
Axis of the cylinder
(0, 0, 1)
cap_ends
bool
Whether to cap the ends of cylinder
True
overrides
dict
Optional dictionary to override common annotation params
None
draw_n_sided_pyramid
entities.trajectory.annotations.TrajectoryAnnotation.draw_n_sided_pyramid(
n= 6 ,
radius= 10 ,
height= 10 ,
origin= (0 , 0 , 0 ),
axis= (0 , 0 , 1 ),
cap_ends= True ,
overrides= None ,
)
Draw an n sided pyramid Eg: triangle, prism, square pyramid, pentagonal pyramid, etc
Parameters
n
int
Number of sides
6
radius
float
Radius of the pyramid
10
height
float
Height of the pyramid
10
origin
Vector
Center of the base of the pyramid
(0, 0, 0)
axis
Vector
Axis of the pyramid
(0, 0, 1)
cap_ends
bool
Whether to cap the ends of pyramid
True
overrides
dict
Optional dictionary to override common annotation params
None
draw_sphere
entities.trajectory.annotations.TrajectoryAnnotation.draw_sphere(
location= (0 , 0 , 0 ),
radius= 1.0 ,
overrides= None ,
)
Draw a sphere
Parameters
location
Vector
A 3D position vector of the center
(0, 0, 0)
radius
float
Radius of the sphere
1.0
overrides
dict
Optional dictionary to override common annotation params
None
draw_text_2d
entities.trajectory.annotations.TrajectoryAnnotation.draw_text_2d(
pos_2d,
text,
overrides= None ,
)
Draw text at a given 2D position (normalized co-ordinates) of Viewport.
Parameters
pos_2d
Vector
Normalized co-ordinates (0 - 1). (0, 0) is at bottom left
required
text
str
Text to display. ‘|’ as multi-line separator
required
overrides
dict
Optional dictionary to override common annotation params
None
draw_text_3d
entities.trajectory.annotations.TrajectoryAnnotation.draw_text_3d(
pos_3d,
text,
overrides= None ,
)
Draw text at a given 3D position
Parameters
pos_3d
Vector
Co-ordinates in 3D world space (x, y, z)
required
text
str
Text to display. ‘|’ as multi-line separator
required
overrides
dict
Optional dictionary to override common annotation params
None
draw_triclinic_cell
entities.trajectory.annotations.TrajectoryAnnotation.draw_triclinic_cell(
a= 10.0 ,
b= 10.0 ,
c= 10.0 ,
alpha= 90.0 ,
beta= 90.0 ,
gamma= 90.0 ,
origin= (0 , 0 , 0 ),
show_lattice= False ,
overrides= None ,
)
Draw a triclinic box based on box vector lengths and angles
Parameters
a
float
Box vector a length
10.0
b
float
Box vector b length
10.0
c
float
Box vector c length
10.0
alpha
float
Angle between box vectors bc
90.0
beta
float
Angle between box vectors ac
90.0
gamma
float
Angle between box vectors ab
90.0
origin
Vector
Origin of the box
(0, 0, 0)
show_lattice
bool
Whether to show a 3x3x3 lattice
False
overrides
dict
Optional dictionary to override common annotation params
None
draw_wigner_seitz_cell
entities.trajectory.annotations.TrajectoryAnnotation.draw_wigner_seitz_cell(
triclinic_vectors,
center_to_origin= False ,
show_lattice= False ,
overrides= None ,
)
Draw a Wigner-Seitz cell from triclinic vectors
Parameters
triclinic_vectors
npt .ArrayLike
Vectors that represent the base triclinic cell
required
center_to_origin
bool
Move the center of the cell to origin (0, 0, 0)
False
show_lattice
bool
Whether to show a 3x3x3 lattice
False
overrides
dict
Optional dictionary to override common annotation params
None
pil_image_to_bpy_image
entities.trajectory.annotations.TrajectoryAnnotation.pil_image_to_bpy_image(
pil_image,
name= 'PIL Image' ,
)
Convert PIL image to Blender image
Parameters
pil_image
Image.Image
PIL Image
required
name
str
Name of the bpy.data.images data block. Using an exisiting name will re-use the data block, whereas using a new name will create a new image data block.
'PIL Image'
validate
entities.trajectory.annotations.TrajectoryAnnotation.validate(input_name= None )
Optional method to validate annotation inputs This is called during annotation creation and any time the inputs change either through the API or GUI. Can return False or raise an exception when validation fails. Returns True when all validations succeed.
Note: This method gets called when any inputs change, so updating values in here will lead to a recursive loop and should not be done.
Parameters
input_name
str
The input name update that trigged this validation callback. When no specific input name is available, None is passed.
None
TrajectoryAnnotationManager
entities.trajectory.annotations.TrajectoryAnnotationManager(entity)
Annotation Manager for Trajectory Entity
Attributes
visible
Visibility of all annotations - getter
Methods
clear
entities.trajectory.annotations.TrajectoryAnnotationManager.clear()
Remove all annotations
get
entities.trajectory.annotations.TrajectoryAnnotationManager.get(name)
Get an annotation by name
register_class
entities.trajectory.annotations.TrajectoryAnnotationManager.register_class(
annotation_class,
)
Register an annotation class
This method adds the annotation class to the entity specific class registry (classes) and adds a new method (add ) to the manager with a signature that matches the annotation inputs.
remove
entities.trajectory.annotations.TrajectoryAnnotationManager.remove(annotation)
Remove an annotation by name or instance
When a name is used, all annotations that match the name will be removed
unregister_type
entities.trajectory.annotations.TrajectoryAnnotationManager.unregister_type(
annotation_type,
)
Unregister a registered annotation type
This method removes the annotation type from the entity speicific class registry and removes the ‘add_<>’ method from the manager
UniverseInfo
entities.trajectory.annotations.UniverseInfo(trajectory)
Universe Info Trajectory Annotation
Attributes
location
tuple [float , float ]
Normalized coordinates (0.0 - 1.0) of the postion in viewport / render
show_frame
bool
Whether or not to show the frame number
show_time
bool
Whether or not to show the timestep time
show_step
bool
Whether or not to show the timestep step
show_topology
bool
Whether or not to show the topology filename
show_trajectory
bool
Whether or not to show the trajectory filename
show_atoms
bool
Whether or not to show the number of atoms
custom_text
str
Any custom text to add at the end of the annotation
Methods
bpy_image_to_pil_image
entities.trajectory.annotations.UniverseInfo.bpy_image_to_pil_image(bpy_image)
Convert Blender image to PIL image
distance
entities.trajectory.annotations.UniverseInfo.distance(v1, v2)
Distance between two vectors
Parameters
v1
Vector
A 3D or 2D vector or tuple
required
v2
Vector
A 3D or 2D vector or tuple
required
Returns
Distance between the two vectors
draw_bmesh
entities.trajectory.annotations.UniverseInfo.draw_bmesh(bm, overrides= None )
Draw a Blender bmesh
Parameters
bm
bmesh .types .BMesh
A bmesh object. A copy is made for internal use. Users will have to free the passed in object
required
overrides
dict
Optional dictionary to override common annotation params
None
draw_bpy_image
entities.trajectory.annotations.UniverseInfo.draw_bpy_image(
pos_2d,
image,
scale= 1.0 ,
)
Draw an image from bpy.data.images at the given 2D position (normalized co-ordinates) of Viewport.
Parameters
pos_2d
Vector
Normalized co-ordinates (0 - 1). (0, 0) is at bottom left. Bottom left of the image is placed at this position
required
image
bpy.types .Image
An image from bpy.data.images to draw at specified position
required
scale
float
Scale of the image to draw
1.0
draw_circle_2d
entities.trajectory.annotations.UniverseInfo.draw_circle_2d(
center,
radius,
angle= 360.0 ,
start_dv= None ,
c_arrow= False ,
cc_arrow= False ,
overrides= None ,
)
Draw a circle around a 2D point (normalized coordinate) in the viewport space
Parameters
center
Vector
A 2D co-ordinate of the center. Normalized co-ordinate (0 - 1). (0, 0) is at bottom left
required
radius
float
The radius of the circle
required
angle
float
An angle less than 360 for partial circle (arc) - in degrees Default is 360 degrees
360.0
start_dv
Vector
The direction vector along which to start the circle (arc) If not provided, a random point in the circle plane is chosen
None
c_arrow
bool
Whether to display clockwise arrow. Default is False
False
cc_arrow
bool
Whether to display counter clockwise arrow. Default is False
False
overrides
dict
Optional dictionary to override common annotation params
None
draw_circle_3d
entities.trajectory.annotations.UniverseInfo.draw_circle_3d(
center,
radius,
normal= None ,
angle= 360.0 ,
start_dv= None ,
c_arrow= False ,
cc_arrow= False ,
overrides= None ,
)
Draw a circle around a 3D point in the plane perpendicular to the given normal
Parameters
center
Vector
A 3D position vector of the center
required
radius
float
The radius of the circle
required
normal
Vector | None
The normal vector of the plane on which the cirle is to be drawn. When None, the circle is drawn in the viewport plane
None
angle
float
An angle less than 360 for partial circle (arc) - in degrees Default is 360 degrees
360.0
start_dv
Vector
The direction vector along which to start the circle (arc) If not provided, a random point in the plane perpendicular to the normal is chosen
None
c_arrow
bool
Whether to display clockwise arrow. Default is False
False
cc_arrow
bool
Whether to display counter clockwise arrow. Default is False
False
overrides
dict
Optional dictionary to override common annotation params
None
draw_cone
entities.trajectory.annotations.UniverseInfo.draw_cone(
location= (0 , 0 , 0 ),
radius= 1.0 ,
height= 1.0 ,
axis= (0 , 0 , 1 ),
cap_ends= True ,
overrides= None ,
)
Draw a cone
Parameters
location
Vector
A 3D position vector of the base center
(0, 0, 0)
radius
float
Radius of the cone
1.0
height
float
Height of the cone
1.0
axis
Vector
Axis of the cone
(0, 0, 1)
cap_ends
bool
Whether to cap the base
True
overrides
dict
Optional dictionary to override common annotation params
None
draw_cylinder
entities.trajectory.annotations.UniverseInfo.draw_cylinder(
location= (0 , 0 , 0 ),
radius= 1.0 ,
height= 1.0 ,
axis= (0 , 0 , 1 ),
cap_ends= True ,
overrides= None ,
)
Draw a cylinder
Parameters
location
Vector
A 3D position vector of the base center
(0, 0, 0)
radius
float
Radius of the cylinder
1.0
height
float
Height of the cylinder
1.0
axis
Vector
Axis of the cylinder
(0, 0, 1)
cap_ends
bool
Whether to cap the ends of cylinder
True
overrides
dict
Optional dictionary to override common annotation params
None
draw_line_2d
entities.trajectory.annotations.UniverseInfo.draw_line_2d(
v1,
v2,
v1_text= None ,
v2_text= None ,
mid_text= None ,
v1_arrow= False ,
v2_arrow= False ,
overrides= None ,
)
Draw a line between two points (normalized co-ordinates) in 2D viewport space
Parameters
v1
Vector
2D co-ordinates of the first point. Normalized co-ordinate (0 - 1). (0, 0) is at bottom left
required
v2
Vector
2D co-ordinates of the second point. Normalized co-ordinate (0 - 1). (0, 0) is at bottom left
required
v1_text
str
Optional text to display at v1
None
v2_text
str
Optional text to display at v2
None
mid_text
str
Optional text to display at the middle of the line
None
v1_arrow
bool
Whether to display an arrow at v1
False
v2_arrow
bool
Whether to display an arrow at v2
False
overrides
dict
Optional dictionary to override common annotation params
None
draw_line_3d
entities.trajectory.annotations.UniverseInfo.draw_line_3d(
v1,
v2,
v1_text= None ,
v2_text= None ,
mid_text= None ,
v1_arrow= False ,
v2_arrow= False ,
overrides= None ,
)
Draw a line between two points in 3D space
Parameters
v1
Vector
3D co-ordinates of the first point
required
v2
Vector
3D co-ordinates of the second point
required
v1_text
str
Optional text to display at v1
None
v2_text
str
Optional text to display at v2
None
mid_text
str
Optional text to display at the middle of the line
None
v1_arrow
bool
Whether to display an arrow at v1
False
v2_arrow
bool
Whether to display an arrow at v2
False
overrides
dict
Optional dictionary to override common annotation params
None
draw_n_sided_cylinder
entities.trajectory.annotations.UniverseInfo.draw_n_sided_cylinder(
n= 6 ,
radius= 10 ,
height= 10 ,
origin= (0 , 0 , 0 ),
axis= (0 , 0 , 1 ),
cap_ends= True ,
overrides= None ,
)
Draw an n sided cylinder Eg: square, rectangle, triangular prism, cube, cuboid, hexagonal cell etc
Parameters
n
int
Number of sides
6
radius
float
Radius of the cylinder
10
height
float
Height of the cylinder
10
origin
Vector
Center of the base of the cylinder
(0, 0, 0)
axis
Vector
Axis of the cylinder
(0, 0, 1)
cap_ends
bool
Whether to cap the ends of cylinder
True
overrides
dict
Optional dictionary to override common annotation params
None
draw_n_sided_pyramid
entities.trajectory.annotations.UniverseInfo.draw_n_sided_pyramid(
n= 6 ,
radius= 10 ,
height= 10 ,
origin= (0 , 0 , 0 ),
axis= (0 , 0 , 1 ),
cap_ends= True ,
overrides= None ,
)
Draw an n sided pyramid Eg: triangle, prism, square pyramid, pentagonal pyramid, etc
Parameters
n
int
Number of sides
6
radius
float
Radius of the pyramid
10
height
float
Height of the pyramid
10
origin
Vector
Center of the base of the pyramid
(0, 0, 0)
axis
Vector
Axis of the pyramid
(0, 0, 1)
cap_ends
bool
Whether to cap the ends of pyramid
True
overrides
dict
Optional dictionary to override common annotation params
None
draw_sphere
entities.trajectory.annotations.UniverseInfo.draw_sphere(
location= (0 , 0 , 0 ),
radius= 1.0 ,
overrides= None ,
)
Draw a sphere
Parameters
location
Vector
A 3D position vector of the center
(0, 0, 0)
radius
float
Radius of the sphere
1.0
overrides
dict
Optional dictionary to override common annotation params
None
draw_text_2d
entities.trajectory.annotations.UniverseInfo.draw_text_2d(
pos_2d,
text,
overrides= None ,
)
Draw text at a given 2D position (normalized co-ordinates) of Viewport.
Parameters
pos_2d
Vector
Normalized co-ordinates (0 - 1). (0, 0) is at bottom left
required
text
str
Text to display. ‘|’ as multi-line separator
required
overrides
dict
Optional dictionary to override common annotation params
None
draw_text_3d
entities.trajectory.annotations.UniverseInfo.draw_text_3d(
pos_3d,
text,
overrides= None ,
)
Draw text at a given 3D position
Parameters
pos_3d
Vector
Co-ordinates in 3D world space (x, y, z)
required
text
str
Text to display. ‘|’ as multi-line separator
required
overrides
dict
Optional dictionary to override common annotation params
None
draw_triclinic_cell
entities.trajectory.annotations.UniverseInfo.draw_triclinic_cell(
a= 10.0 ,
b= 10.0 ,
c= 10.0 ,
alpha= 90.0 ,
beta= 90.0 ,
gamma= 90.0 ,
origin= (0 , 0 , 0 ),
show_lattice= False ,
overrides= None ,
)
Draw a triclinic box based on box vector lengths and angles
Parameters
a
float
Box vector a length
10.0
b
float
Box vector b length
10.0
c
float
Box vector c length
10.0
alpha
float
Angle between box vectors bc
90.0
beta
float
Angle between box vectors ac
90.0
gamma
float
Angle between box vectors ab
90.0
origin
Vector
Origin of the box
(0, 0, 0)
show_lattice
bool
Whether to show a 3x3x3 lattice
False
overrides
dict
Optional dictionary to override common annotation params
None
draw_wigner_seitz_cell
entities.trajectory.annotations.UniverseInfo.draw_wigner_seitz_cell(
triclinic_vectors,
center_to_origin= False ,
show_lattice= False ,
overrides= None ,
)
Draw a Wigner-Seitz cell from triclinic vectors
Parameters
triclinic_vectors
npt .ArrayLike
Vectors that represent the base triclinic cell
required
center_to_origin
bool
Move the center of the cell to origin (0, 0, 0)
False
show_lattice
bool
Whether to show a 3x3x3 lattice
False
overrides
dict
Optional dictionary to override common annotation params
None
pil_image_to_bpy_image
entities.trajectory.annotations.UniverseInfo.pil_image_to_bpy_image(
pil_image,
name= 'PIL Image' ,
)
Convert PIL image to Blender image
Parameters
pil_image
Image.Image
PIL Image
required
name
str
Name of the bpy.data.images data block. Using an exisiting name will re-use the data block, whereas using a new name will create a new image data block.
'PIL Image'