4.4. graph_2.py¶
This module contains the basic graph components of atomic graphs.
- class graph_2.Vertex(index, im_coor_x, im_coor_y, r, scale, zeta=0, advanced_species='Un_1', n=3, atomic_species='Un', void=False, parent_graph=None)¶
A vertex is object is an atomic graph component.
A vertex contains a lot of the local information of the parent atomic graph.
- Variables
parent_graph (
graph_2.AtomicGraph
) – A reference to the AtomicGraph object that the vertex belongs to.- Parameters
index (int) – Index of the vertex. Must be unique.
im_coor_x (float) – x-coordinate of the center of the column in the image which the vertex represents.
im_coor_y (float) – y-coordinate of the center of the column in the image which the vertex represents.
r (int) – The “approximate atomic radii” in pixels.
scale (float) – The scale of the HAADF-STEM image in pm/pixel
zeta (int) – (Optional) The initial zeta value of the vertex (0 or 1). Defaults to 0.
advanced_species (str) – (Optional) The initial “advanced species category” of the vertex. Defaults to
'Un_1'
.atomic_species (str) – (Optional) The initial “atomic species category” of the vertex. Defaults to
'Un'
.void (bool) – (Optional) Whether the vertex is void or not. Defaults to
False
.parent_graph (
graph_2.AtomicGraph
) – (Optional) A reference to the graph object that the vertex belongs to. Defaults toNone
.
- determine_species_from_probability_vector()¶
Set the atomic species of the vertex based on the advanced probability vector
First determine the advanced species from the advanced probability vector, and then set the atomic species of the vertex based on which atomic species the advanced species maps to. Also set the symmetry number ‘n’.
- im_pos()¶
Returns a triple with the image coordinates of the vertex.
- Returns
(x, y, z), where x, y and z are the image coordinates of the vertex.
- Return type
(float, float, float)
- report()¶
Create a report summarizing the contents of the vertex instance and return it as a string
- Returns
A vertex summary
- Return type
str
- reset_probability_vector(bias='Un_1')¶
Reset the probability vector with a certain bias
This method will set all the atomic species probabilities equal to each other. If an advanced species bias is given, then that advanced species will be slightly larger than the others. The bias defaults to ‘Un_1’ if no bias is given.
- Parameters
bias (string) – Default to this advanced species (optional, default=’Un_1’)
- set_probability_from_advanced()¶
Set atomic species probability vector by summarizing the probabilities of the every advanced species.
If, for instance, the advanced probability vector is:
advanced_species
advanced probability
Si_1
0.01
Si_2
0.2
Al_1
0.09
Al_2
0.7
Then the probability vector will be set to:
Atomic species
probability
Si
0.2 + 0.01 = 0.21
Al
0.09 + 0.7 = 0.79
- spatial_pos()¶
Returns a triple with the spatial coordinates of the vertex.
- Returns
(x, y, z), where x, y and z are the spatial coordinates of the vertex.
- Return type
(float, float, float)