Func_pyrough module¶
-
Func_pyrough.
Kurto
(z)¶ Calculates the kurtosis of a height distribution
Parameters: z (array) – height matrix Returns: Kurtosis
-
Func_pyrough.
align_poly
(vertices, angles)¶ Aligns the first facet with x-axis
Parameters: - vertices (array) – List of nodes
- angles (array) – List of angles
Returns: Rotated nodes
-
Func_pyrough.
base
(radius, nfaces)¶ Creates the base of the faceted wire from radius and number of faces.
Parameters: - radius (float) – Radius of the wire
- nfaces (int) – Number of faces
Returns: Points forming the base of the wire and angles associated to each face
-
Func_pyrough.
box
(width, length, height, ns, out_pre)¶ Parameters: - width (float) – Width of the box
- length (float) – Length of the box
- height (float) – Height of the box
- ns (float) – Mesh size
- out_pre (str) – Output file name if required
Returns: vertices and faces of box mesh
-
Func_pyrough.
cart2cyl
(matrix)¶ Calculates cylindrical coordinates from cartesian ones.
Parameters: matrix (array) – List of cartesian coordinates Returns: Cylindrical coordinates
-
Func_pyrough.
center_3d_dataset
(dataset)¶ Parameters: dataset (array) – Array of positions Returns: Centered position dataset
-
Func_pyrough.
concatenate_list_data
(a_list)¶ Combines the elements of a list into one element in the form of a string.
Parameters: a_list (list) – List with elements of type int Returns: A string
-
Func_pyrough.
coord_cart_sphere
(C1, C2, r, vertices, t, z, y, x)¶ Creates a new matrix with x, y, z in cartesian coordinates
Parameters: - C1 (float) – Roughness normalization factor
- C2 (float) – Roughness normalization factor constant for sphere
- r (int) – Roughness height matrix
- vertices (array) – List of nodes
- t (array) – x y z coordinates
- z (array) – z coordinates
- y (array) – y coordinates
- x (array) – x coordinates
Returns: Cartesian coordinates
-
Func_pyrough.
coord_sphere
(vertices)¶ Creates a matrix with the columns that correspond to the coordinates of either x, y, z and t which contains x y z coordinates in an array
Parameters: vertices (array) – List of nodes Returns: Coordinates
-
Func_pyrough.
cube
(length, ns, out_pre)¶ Parameters: - length (float) – Length of the cube
- ns (float) – Mesh size
- out_pre (str) – Output file name if required
Returns: vertices and faces of cube mesh
-
Func_pyrough.
cube_faces
(length)¶ Generates the points and faces of a cube
Parameters: length (float) – Size of the cube Returns: Points and faces of the cube
-
Func_pyrough.
cyl2cart
(matrix)¶ Calculates cartesian coordinates from cylindrical ones.
Parameters: matrix (array) – List of cylindrical coordinates Returns: Cartesian coordinates
-
Func_pyrough.
cylinder
(l, r, ns, out_pre)¶ Parameters: - l (float) – Length of the cylinder
- r (float) – Radius of the cylinder
- ns (float) – Mesh size
- out_pre (str) – Output file name if required
Returns: vertices and faces of cylinder mesh
-
Func_pyrough.
duplicate
(l, orien, lattice_par)¶ Takes in a length and an cristal orientation to calculate the duplication factor for atomsk.
Parameters: - l (int) – Length of one of the sides of the object
- orien (list) – Crystal orientaion
- lattice_par (float) – Lattice parameter
Returns: Duplication factor and string of orientations
-
Func_pyrough.
faces_normals
(obj_points, obj_faces)¶ Calculates each face’s normals.
Parameters: - obj_points (array) – List of points
- obj_faces (array) – List of faces
Returns: List of normals
-
Func_pyrough.
make_obj
(surfaces, energies, n_at, lattice_structure, lattice_parameter, material, orien_x, orien_y, orien_z, out_pre)¶ Creates an OBJ file of a faceted NP. Stores the points and faces from this file.
Parameters: - surfaces (list) – List of surfaces for Wulff theory
- energies (list) – List of energies associated to surfaces for Wulff theory
- n_at (int) – Number of atoms
- lattice_structure (str) – Atomic structure of the sample
- lattice_parameter (float) – Lattice parameter
- material (str) – Type of atom
- orien_x (list) – Orientation along x-axis
- orien_y (list) – Orientation along y-axis
- orien_z (list) – Orientation along z-axis
- out_pre (str) – Prefix for output files
Returns: List of points and faces of OBJ file
-
Func_pyrough.
make_rough
(type_sample, z, nodesurf, vertices, angles)¶ Applies roughness on the sample.
Parameters: - type_sample (str) – The type of the sample
- z (array) – Surface roughness to apply on the sample
- nodesurf (array) – List of nodes to be moved
- vertices (array) – Nodes of the sample
- angles (array) – List of angles to be followed by roughness (Only in the case of a faceted wire)
Returns: Rough sample
-
Func_pyrough.
make_rough_wulff
(vertices, B, C1, RMS, N, M, nodesurf, node_edge, node_corner, list_n)¶ Applies roughness on the sample in the case of a Wulff Shaped NP.
Parameters: - vertices (array) – Nodes of the sample
- B (float) – The degree of the roughness
- C1 (float) – Roughness normalization factor
- RMS (float) – Root Mean Square
- N (int) – Scaling cartesian position
- M (int) – Scaling cartesian position
- nodesurf (array) – List of surface nodes
- node_edge (array) – List of nodes located on edges
- node_corner (array) – List of nodes located on corners
- list_n (list) – List of face’s normals
Returns: Rough Wulff sample
-
Func_pyrough.
node_corner
(nodesurf)¶ From surface nodes, finds all nodes located on edges and corners.
Parameters: nodesurf (array) – List of surface nodes Returns: List of nodes located on edges and list of nodes located on corners
-
Func_pyrough.
node_indexing
(vertices)¶ Creates a column that has an assigned index number for each row in vertices and also the nodenumbers which is an array file from 0 - length of the vertices
Parameters: vertices (array) – Vector for the points Returns: Numbered vertices and raw numbers column.
-
Func_pyrough.
node_surface
(sample_type, vertices, nodenumber, points, faces)¶ Finds the nodes at the surface of the object. These nodes will have the surface roughness applied to it.
Parameters: - sample_type (str) – The name of the sample
- vertices (array) – List of nodes
- nodenumber (array) – Number of the corresponding node
:param points : Polygon shape (Faceted wire case) :type points: array :param faces: Facets list (Wulff case) type faces: array
Returns: Surface nodes
-
Func_pyrough.
normalize
(surf)¶ Normalizes the coordinates of points composing the surface.
Parameters: surf (array) – List of nodes of the surface Returns: Normalized surface
-
Func_pyrough.
phi
(t, z)¶ Calculates the arctan2 of an array filled with vector norms and an array filled with z coordinates which are the same size.
Parameters: - t (array) – Coordinates x y in a list
- z (array) – Z coordinates
Returns: An array of angles in radians
-
Func_pyrough.
poly
(length, base_points, ns, out_pre)¶ Parameters: - length (float) – Length of the faceted wire
- base_points (list) – Shape of the base
- ns (float) – Mesh size
- out_pre (str) – Output file name if required
Returns: vertices and faces of faceted wire mesh
-
Func_pyrough.
radius
(v)¶ Calculates the vector norm for the axis 1 of the values in the given array.
Parameters: v (array) – The vertices of the sphere Returns: A vector norm
-
Func_pyrough.
random_numbers
(sfrN, sfrM)¶ Generates the G and U matrices for the mathematical formulation of rough surfaces.
Parameters: - sfrN (array) – Vector for the N decomposition
- sfrM (array) – Vector for the M decomposition
Returns: G and U matrices
-
Func_pyrough.
random_surf2
(sample_type, m, n, N, M, B, xv, yv, sfrM, sfrN, C1, RMS, out_pre)¶ Returns an array with the Z values representing the surface roughness.
Parameters: - sample_type (str) – The type of the sample
- m (array) – Wavenumbers
- n (array) – Wavenumbers
- N (int) – Scaling cartesian position
- M (int) – Scaling cartesian position
- B (float) – The degree of the roughness
- xv (array) – Unique x coordinate values from the objects vertices
- yv (array) – Unique y coordinate values from the objects vertices
- sfrN (array) – Vector for the N decomposition
- sfrM (array) – Vector for the M decomposition
- C1 (float) – Roughness normalization factor
- RMS (float) – Root Mean Square
- out_pre (str) – Prefix of output files
Returns: Surface roughness
-
Func_pyrough.
rdnsurf
(m, n, B, xv, yv, sfrM, sfrN)¶ Generates random surface roughness that will replace the previous z values in the vertices matrix.
Parameters: - m (array) – Wavenumber
- n (array) – Wavenumber
- B (float) – The degree the roughness is dependent on
- xv (array) – Unique x coordinate values from the objects vertices
- yv (array) – Unique y coordinate values from the objects vertices
- sfrM (array) – Matrix of random numbers that range from 1 to 2N
- sfrN (array) – Matrix of random numbers that range from 1 to 2N
Returns: Roughness height matrix
-
Func_pyrough.
rdnsurf_2
(m, n, B, xv, yv, sfrM, sfrN)¶ Generates random surface roughness that will replace the previous z values in the vertices matrix.
Parameters: - m (array) – Wavenumber
- n (array) – Wavenumber
- B (float) – The degree the roughness is dependent on
- xv (array) – Unique x coordinate values from the objects vertices
- yv (array) – Unique y coordinate values from the objects vertices
- sfrM (array) – Matrix of random numbers that range from 1 to 2N
- sfrN (array) – Matrix of random numbers that range from 1 to 2N
Returns: Roughness height matrix
-
Func_pyrough.
read_stl
(sample_type, raw_stl, width, length, height, radius, ns, points, out_pre)¶ Reads an input stl file or creates a new one if no input
Parameters: - sample_type (str) – Name of the sample
- raw_stl (str) – Name of the input stl file
- width (float) – Width of the box
- length (float) – Length of the box/wire
- height (float) – Height of the box
- radius (float) – Radius of the wire/sphere
- ns (int) – The number of segments desired
- points (list) – List of points constituting the base (in case of faceted wire)
- out_pre (str) – Prefix of output files
Returns: List of points and faces
-
Func_pyrough.
read_stl_wulff
(raw_stl, obj_points, obj_faces, ns, out_pre)¶ Reads an input stl file or creates a new one if no input. Wulff case.
Parameters: - raw_stl (str) – Name of the input stl file
- obj_points (list) – List of points from OBJ file
- obj_faces (list) – List of faces from OBJ file
- ns (float) – Mesh size
- out_pre (str) – Prefix of output files
Returns: List of points and faces
-
Func_pyrough.
rebox
(file_lmp)¶ Fits the box dimensions with the sample. Also centers the sample.
Parameters: file_lmp (str) – .lmp file containing the atom positions Returns: Reboxed position file
-
Func_pyrough.
refine_3Dmesh
(type_sample, out_pre, ns, alpha, ext_fem)¶ Parameters: - type_sample (str) – Type of object
- out_pre (str) – Outfit file name
- ns (float) – Mesh size
- alpha (float) – Refine mesh factor
- ext_fem (list) – FEM extensions list
Returns: Refined 3D meshs for all required formats
-
Func_pyrough.
refine_box
(out_pre, ns, alpha, angle, ext_fem)¶ Parameters: - out_pre (str) – Outfit file name
- ns (float) – Mesh size
- alpha (float) – Refine mesh factor
- angle (float) – Angle value for facets detection
- ext_fem (list) – FEM extensions list
Returns: Refined box mesh
-
Func_pyrough.
refine_sphere
(out_pre, ns, alpha, angle, ext_fem)¶ Parameters: - out_pre (str) – Outfit file name
- ns (float) – Mesh size
- alpha (float) – Refine mesh factor
- angle (float) – Angle value for facets detection
- ext_fem (list) – FEM extensions list
Returns: Refined sphere mesh
-
Func_pyrough.
refine_wire
(out_pre, ns, alpha, angle, ext_fem)¶ Parameters: - out_pre (str) – Outfit file name
- ns (float) – Mesh size
- alpha (float) – Refine mesh factor
- angle (float) – Angle value for facets detection
- ext_fem (list) – FEM extensions list
Returns: Refined wire mesh
-
Func_pyrough.
remove_duplicates_2d_ordered
(data)¶ Parameters: data (list) – Initial list Returns: List with no duplicates
-
Func_pyrough.
rescale
(D, scale)¶ Rescales the height distribution between zmin and zmax
Parameters: - D (array) – Height matrix
- scale (list) – zmin and zmax
Returns: Rescaled matrix
-
Func_pyrough.
rho
(x, y)¶ The Pythagorean theorem equation is used to obtain a value for a side of a triangle.
Parameters: - x (int) – Represents the length of a side in the triangle
- y (int) – Represents the length of a side in the triangle
Returns: The length of hypotenuse
-
Func_pyrough.
rms_calc
(Z)¶ Calculates the RMS of a height distribution
Parameters: z (array) – height matrix Returns: RMS
-
Func_pyrough.
rot
(surf, n1)¶ Rotates a surface oriented along n1 axis in order to be oriented along z-axis.
Parameters: - surf (array) – List of nodes from the surface
- n1 (array) – Surface normal
Returns: Rotated surface
-
Func_pyrough.
rot_matrix
(n, theta)¶ Generates the rotation matrix. Initial orientation is n, and the angle of rotation is theta. Final orientation is the z-axis.
Parameters: - n (list) – Initial orientation
- theta (float) – Rotation angle
Returns: Rotation matrix
-
Func_pyrough.
rotate_obj_wulff
(obj_points, orien_x, orien_z)¶ Parameters: - obj_points (array) – Points describing the facets of the wulff-shape
- orien_x (list) – Orientation along x-axis
- orien_z (list) – Orientation along z-axis
Returns: Points respecting the desired orientation
-
Func_pyrough.
rough
(x, y, H, RMS, M, N)¶ Generates a rough surface
Parameters: - x (array) – List of x coordinates
- y (array) – List of y coordinates
- H (float) – Hurst exponent
- C1 (float) – Normalization factor
- M (int) – Scaling cartesian position
- N (int) – Scaling cartesian position
Returns: Height matrix
-
Func_pyrough.
rough_matrix_sphere
(nbPoint, B, thetaa, phii, vert_phi_theta, C1, RMS, r)¶ Creates the displacement values of the nodes on the surface of the sphere
Parameters: - nbPoint (int) – Number of points on the sphere
- B (float) – The degree the roughness is dependent on
- thetaa (array) – Arctan2 of x and y coordinates
- phii (array) – Arctan2 of vector norms and z coordinates
- vert_phi_theta (array) – Array filled with two elements that are the angles corresponding to the position of the node on the sphere.
- C1 (float) – Roughness normalization factor
- RMS (float) – Root Mean Square
- r (int) – Roughness height matrix
Returns: Rough matrix
-
Func_pyrough.
segment_intersects_plane
(S, P, a, b, c, d)¶ Parameters: - S (list) – Point defining segment with the origin
- P (list) – Plane normal
- a (float) – Plane equation (ax + by + cz + d = 0)
- b (float) – Plane equation (ax + by + cz + d = 0)
- c (float) – Plane equation (ax + by + cz + d = 0)
- d (float) – Plane equation (ax + by + cz + d = 0)
Returns: Boolean value for plane intersection or not
-
Func_pyrough.
sigma
(z)¶ Calculates the standard deviation of a height distribution
Parameters: z (array) – height matrix Returns: Standard deviation
-
Func_pyrough.
sk
(z)¶ Calculates the skewness of a height distribution
Parameters: z (array) – height matrix Returns: Skewness
-
Func_pyrough.
sphere
(r, ns, out_pre)¶ Parameters: - r (float) – Radius of the sphere
- ns (float) – Mesh size
- out_pre (str) – Output file name if required
Returns: vertices and faces of sphere mesh
-
Func_pyrough.
stat_analysis
(z, N, M, C1, B, sample_type, out_pre)¶ Displays the statistical analysis of the surface roughness generator
Parameters: - z (float) – Roughness height matrix
- N (int) – Scaling cartesian position
- M (int) – Scaling cartesian position
- C1 (float) – Roughness normalization factor
- B (float) – The degree the roughness is dependent on
- sample_type (str) – The name of the sample
- out_pre (str) – Prefix of output files
-
Func_pyrough.
stat_sphere
(r, C1, C2, out_pre)¶ Displays the statistical analysis of the surface roughness generator with regards to the sphere.
Parameters: - r (float) – Roughness height matrix
- C1 (float) – Roughness normalization factor
- C2 (float) – Roughness normalization factor constant for sphere
- out_pre (str) – Prefix of output files
-
Func_pyrough.
stl_file
(vertices, faces, out_pre)¶ Creates an stl file from the vertices and faces of the desired object.
Parameters: - vertices (array) – The coordinates obtained from the mesh
- faces – The faces of the triangles generated from the mesh
- out_pre (str) – Prefix of the output files
-
Func_pyrough.
theta
(x, y)¶ Calculates the arctan2 of two given arrays whose size are the same.
Parameters: - x (array) – x coordinates
- y (array) – y coordinates
Returns: An array of angles in radians
-
Func_pyrough.
vectors
(N, M)¶ Creates vector of integers between -N and N. Same for M
Parameters: - N (int) – Scaling cartesian position
- M (int) – Scaling cartesian position
Returns: Vectors
-
Func_pyrough.
vertex_tp
(x, y, t, z)¶ Creates an array filled with two elements that are the angles corresponding to the position of the node on the sphere.
Parameters: - x (array) – X coordinates
- y (array) – Y coordinates
- t (array) – x & y coordinates stored in a list
- z (array) – Z coordinates
Returns: An array with angles as elements
-
Func_pyrough.
write_stl
(filename, vertices, face_list)¶ Creates an STL file from faces and vertices.
Parameters: - filename (str) – name of the STL file
- vertices (array) – list of vertices
- face_list (array) – list of faces
-
Func_pyrough.
wulff
(points, faces, ns, out_pre)¶ Parameters: - points (list) – Vertices of Wulff-shape
- faces (list) – Facets of Wulff-shape
- ns (float) – Mesh size
- out_pre (str) – Output file name if required
Returns: vertices and faces of Wulff mesh