|
Topological Material Analysis 0.5
Analyse the structures of materials using tools from TDA
|
Public Member Functions | |
| __init__ (self, inputfile=None, backbone=None, flow=None, radii=None, M=None, m=None, grid_size=50, t_step=50, PREV_DATA=(None, None, None, None), periodic=True, fat_radius=1, covering=np.array([-1, 1]), reeb_stride=1, swap_res_grid_and_balls=False, transform_points=None, relax_z_axis=None, verbose=False, MP=False, save_RAM=True, stride=1) | |
| setup_grid (self, balls_centres=None, balls_radii=None, M=None, m=None) | |
| transform_backbone (self, balls_centres=None, balls_radii=None, M=None, m=None) | |
| affine_transform (self, points, radii, V, v, M, m) | |
| produce_res_grid (self, balls_centres=None, balls_radii=None, M=None, m=None) | |
| make_reeb_graph (self, axis=-1, old=False, plot=False) | |
| reeb_graph (self, grid, axis=-1, D_=None) | |
| reeb_graph_old (self, grid, axis=-1, D_=None) | |
| build_graph (self, E, weights, fun, emb) | |
| compute_max_flow (self, D_=None) | |
| compute_tunnels (self, n=10, D_=None, independent=False, plot=False) | |
| plot_reeb (self) | |
| plot_tunnel (self, path, D) | |
| network_plot_3D (self, fun, D=None) | |
| plot_res_grid (self, three_d=False, heights_=None, axis=-1) | |
| plot_path_connected_comp (self, comps, three_d=False, boundaries=False, plot_reeb=False, plot_sorrounding=True) | |
| make_tunnel_matrix (self) | |
| compute_bottlenecks (self, D_=None, plot=False, col_thresh=-0.001, plot_thresh=400, include_deadlocks=False) | |
| compute_sorrounding_structure (self, path, boundaries=False) | |
Public Attributes | |
| radii = radii | |
| t_step = t_step | |
| M = M | |
| m = m | |
| grid_size = grid_size | |
| axes = np.array([0,1]) | |
| int | dim = 3 |
| backbone = backbone | |
| flow = flow | |
| distances_to_balls_aux = None | |
| atoms_kinds_aux = None | |
| periodic = periodic | |
| fat_radius = fat_radius | |
| reeb_stride = reeb_stride | |
| covering = covering | |
| swap_res_grid_and_balls = swap_res_grid_and_balls | |
| transform_points = transform_points | |
| bool | simply_connected_top_bottom = False |
| relax_z_axis = np.array([self.covering[-1]+1,-1]) | |
| verbose = verbose | |
| save_RAM = save_RAM | |
| stride = stride | |
| MP = MP | |
| nx | |
| ny | |
| tuple | nz = (self.grid_size, self.grid_size, self.grid_size) |
| x = np.linspace(self.m[0], self.M[0], self.nx+tmp)[:-1] | |
| y = np.linspace(self.m[1], self.M[1], self.ny+tmp)[:-1] | |
| z = np.linspace(self.m[2], self.M[2], self.nz+tmp)[:-1] | |
| d_x = self.x[1]-self.x[0] | |
| d_y = self.y[1]-self.y[0] | |
| d_z = self.z[1]-self.z[0] | |
| float | r_graph = np.sqrt(self.d_x**2 + self.d_y**2 + self.d_z**2)*1.001*self.fat_radius |
| grid = np.zeros((self.nx*self.ny*self.nz,self.dim)) | |
| N = len(self.grid) | |
| unit_3d = np.prod(self.M-self.m)/self.N | |
| unit_2d = np.prod(self.M[:-1]-self.m[:-1])/(self.nx*self.ny) | |
| z_0 = z[0]+self.d_z*k | |
| z_1 = z[-1]-self.d_z*k | |
| distances_to_balls = np.inf*np.ones_like(self.grid[:,0]) | |
| int | atoms_kinds = -1*np.ones_like(self.grid[:,0]).astype(int) |
| tuple | idxs = (idxs + aux_top + aux_bottom)>0 |
| balls_centres = self.grid[self.idxs] | |
| balls_radii = np.ones_like(self.idxs)*r | |
| res_grid = self.grid[self.idxs] | |
| graph = csr_matrix((np.ones_like(A[:,0]), (A[:,0],A[:,1])), shape=(N, N)) | |
| G = self.build_graph(E, weights, fun, emb) | |
| measure_path_comp = fun | |
| axis = axis | |
| float | delta = 1.001*delta |
| tuple | norm = ((self.delta*np.max(self.covering))//(self.d_z*self.reeb_stride)) + 1 |
| int | REEB_GRAPH = -1*np.ones((grid.shape[0],reeb_size)).astype(int) |
| int | n = len(emb)-1 |
| E = E | |
| D_reeb_w = np.zeros((len(emb),len(emb))) | |
| reeb_connected = np.multiply(D_0,D_1) | |
| max_flow = maximum_flow(graph,0,N) | |
| D_flow = self.max_flow.flow | |
| list | PATHS = [] |
| list | MIN = [] |
| list | VOL = [] |
| m_x | |
| m_y | |
| m_z | |
| DIV = np.zeros((self.n+1,)) | |
| z_axis_boundaries | |
| inputfile | |
Reeb Graph Class
| reeb_graph.Reeb_Graph.__init__ | ( | self, | |
| inputfile = None, | |||
| backbone = None, | |||
| flow = None, | |||
| radii = None, | |||
| M = None, | |||
| m = None, | |||
| grid_size = 50, | |||
| t_step = 50, | |||
| PREV_DATA = (None,None,None,None), | |||
| periodic = True, | |||
| fat_radius = 1, | |||
| covering = np.array([-1,1]), | |||
| reeb_stride = 1, | |||
| swap_res_grid_and_balls = False, | |||
| transform_points = None, | |||
| relax_z_axis = None, | |||
| verbose = False, | |||
| MP = False, | |||
| save_RAM = True, | |||
| stride = 1 ) |
LEGEND
radii -> vector or real value determining the radius around the atoms of the backbone, inducing the void region;
axes -> the axis along which keep the boundary conditions. The remaining axis is "unrolled";
PREV_DATA -> use to pass from previous calculations the distances between grid and backbone;
simply_connected_top_bottom -> consider top and bottom layer as simply connected,
ignoring the forbidden region in such sets;
swap_res_grid_and_balls -> swap forbidden region and residual grid;
fat_radius -> scalar saying how many times the diamater of a cell is multiplied to obtain a neighborhood of the graph;
reeb_stride -> the stride along the axis to make the Reeb graph;
covering -> e.g. [-1,0] or [-1,1] determine the thickness of the "level sets": (v-delta,v) or (v-delta,v+delta).
Other values different from -1,1 can be tried but can cause topological errors in the graph;
relax_z_axis -> [a,-b] puts the first a layers of the cube on top of it and the last b on the bottom: less or equal than a,
greater then -b;
transform_points -> change atoms location with affine transformation Vxpts+v
stride -> the stride to subdivide the calculations of the distances between backbone and the grid
| reeb_graph.Reeb_Graph.affine_transform | ( | self, | |
| points, | |||
| radii, | |||
| V, | |||
| v, | |||
| M, | |||
| m ) |
| reeb_graph.Reeb_Graph.build_graph | ( | self, | |
| E, | |||
| weights, | |||
| fun, | |||
| emb ) |
| reeb_graph.Reeb_Graph.compute_bottlenecks | ( | self, | |
| D_ = None, | |||
| plot = False, | |||
| col_thresh = -0.001, | |||
| plot_thresh = 400, | |||
| include_deadlocks = False ) |
| reeb_graph.Reeb_Graph.compute_max_flow | ( | self, | |
| D_ = None ) |
| reeb_graph.Reeb_Graph.compute_sorrounding_structure | ( | self, | |
| path, | |||
| boundaries = False ) |
path -> a subset of the vertices of the reeb graph (not the indexes! the actual vertices!)
| reeb_graph.Reeb_Graph.compute_tunnels | ( | self, | |
| n = 10, | |||
| D_ = None, | |||
| independent = False, | |||
| plot = False ) |
| reeb_graph.Reeb_Graph.make_reeb_graph | ( | self, | |
| axis = -1, | |||
| old = False, | |||
| plot = False ) |
| reeb_graph.Reeb_Graph.make_tunnel_matrix | ( | self | ) |
| reeb_graph.Reeb_Graph.network_plot_3D | ( | self, | |
| fun, | |||
| D = None ) |
| reeb_graph.Reeb_Graph.plot_path_connected_comp | ( | self, | |
| comps, | |||
| three_d = False, | |||
| boundaries = False, | |||
| plot_reeb = False, | |||
| plot_sorrounding = True ) |
comps -> a set of path connected components, indexed as the vertices of the reeb graph
| reeb_graph.Reeb_Graph.plot_reeb | ( | self | ) |
| reeb_graph.Reeb_Graph.plot_res_grid | ( | self, | |
| three_d = False, | |||
| heights_ = None, | |||
| axis = -1 ) |
| reeb_graph.Reeb_Graph.plot_tunnel | ( | self, | |
| path, | |||
| D ) |
| reeb_graph.Reeb_Graph.produce_res_grid | ( | self, | |
| balls_centres = None, | |||
| balls_radii = None, | |||
| M = None, | |||
| m = None ) |
| reeb_graph.Reeb_Graph.reeb_graph | ( | self, | |
| grid, | |||
| axis = -1, | |||
| D_ = None ) |
| reeb_graph.Reeb_Graph.reeb_graph_old | ( | self, | |
| grid, | |||
| axis = -1, | |||
| D_ = None ) |
| reeb_graph.Reeb_Graph.setup_grid | ( | self, | |
| balls_centres = None, | |||
| balls_radii = None, | |||
| M = None, | |||
| m = None ) |
| reeb_graph.Reeb_Graph.transform_backbone | ( | self, | |
| balls_centres = None, | |||
| balls_radii = None, | |||
| M = None, | |||
| m = None ) |
| reeb_graph.Reeb_Graph.atoms_kinds = -1*np.ones_like(self.grid[:,0]).astype(int) |
| reeb_graph.Reeb_Graph.atoms_kinds_aux = None |
| reeb_graph.Reeb_Graph.axes = np.array([0,1]) |
| reeb_graph.Reeb_Graph.axis = axis |
| reeb_graph.Reeb_Graph.backbone = backbone |
| reeb_graph.Reeb_Graph.balls_centres = self.grid[self.idxs] |
| reeb_graph.Reeb_Graph.balls_radii = np.ones_like(self.idxs)*r |
| reeb_graph.Reeb_Graph.covering = covering |
| reeb_graph.Reeb_Graph.D_flow = self.max_flow.flow |
| reeb_graph.Reeb_Graph.D_reeb_w = np.zeros((len(emb),len(emb))) |
| reeb_graph.Reeb_Graph.d_x = self.x[1]-self.x[0] |
| reeb_graph.Reeb_Graph.d_y = self.y[1]-self.y[0] |
| reeb_graph.Reeb_Graph.d_z = self.z[1]-self.z[0] |
| float reeb_graph.Reeb_Graph.delta = 1.001*delta |
| int reeb_graph.Reeb_Graph.dim = 3 |
| reeb_graph.Reeb_Graph.distances_to_balls = np.inf*np.ones_like(self.grid[:,0]) |
| reeb_graph.Reeb_Graph.distances_to_balls_aux = None |
| reeb_graph.Reeb_Graph.DIV = np.zeros((self.n+1,)) |
| reeb_graph.Reeb_Graph.E = E |
| reeb_graph.Reeb_Graph.fat_radius = fat_radius |
| reeb_graph.Reeb_Graph.flow = flow |
| reeb_graph.Reeb_Graph.G = self.build_graph(E, weights, fun, emb) |
| reeb_graph.Reeb_Graph.grid = np.zeros((self.nx*self.ny*self.nz,self.dim)) |
| reeb_graph.Reeb_Graph.grid_size = grid_size |
| tuple reeb_graph.Reeb_Graph.idxs = (idxs + aux_top + aux_bottom)>0 |
| reeb_graph.Reeb_Graph.inputfile |
| reeb_graph.Reeb_Graph.M = M |
| reeb_graph.Reeb_Graph.m = m |
| reeb_graph.Reeb_Graph.m_x |
| reeb_graph.Reeb_Graph.m_y |
| reeb_graph.Reeb_Graph.m_z |
| reeb_graph.Reeb_Graph.measure_path_comp = fun |
| list reeb_graph.Reeb_Graph.MIN = [] |
| reeb_graph.Reeb_Graph.MP = MP |
| reeb_graph.Reeb_Graph.N = len(self.grid) |
| reeb_graph.Reeb_Graph.n = len(emb)-1 |
| reeb_graph.Reeb_Graph.norm = ((self.delta*np.max(self.covering))//(self.d_z*self.reeb_stride)) + 1 |
| reeb_graph.Reeb_Graph.nx |
| reeb_graph.Reeb_Graph.ny |
| tuple reeb_graph.Reeb_Graph.nz = (self.grid_size, self.grid_size, self.grid_size) |
| reeb_graph.Reeb_Graph.PATHS = [] |
| reeb_graph.Reeb_Graph.periodic = periodic |
| float reeb_graph.Reeb_Graph.r_graph = np.sqrt(self.d_x**2 + self.d_y**2 + self.d_z**2)*1.001*self.fat_radius |
| reeb_graph.Reeb_Graph.radii = radii |
| reeb_graph.Reeb_Graph.reeb_connected = np.multiply(D_0,D_1) |
| int reeb_graph.Reeb_Graph.REEB_GRAPH = -1*np.ones((grid.shape[0],reeb_size)).astype(int) |
| reeb_graph.Reeb_Graph.reeb_stride = reeb_stride |
| reeb_graph.Reeb_Graph.relax_z_axis = np.array([self.covering[-1]+1,-1]) |
| reeb_graph.Reeb_Graph.res_grid = self.grid[self.idxs] |
| reeb_graph.Reeb_Graph.save_RAM = save_RAM |
| bool reeb_graph.Reeb_Graph.simply_connected_top_bottom = False |
| reeb_graph.Reeb_Graph.stride = stride |
| reeb_graph.Reeb_Graph.swap_res_grid_and_balls = swap_res_grid_and_balls |
| reeb_graph.Reeb_Graph.t_step = t_step |
| reeb_graph.Reeb_Graph.transform_points = transform_points |
| reeb_graph.Reeb_Graph.unit_2d = np.prod(self.M[:-1]-self.m[:-1])/(self.nx*self.ny) |
| reeb_graph.Reeb_Graph.unit_3d = np.prod(self.M-self.m)/self.N |
| reeb_graph.Reeb_Graph.verbose = verbose |
| list reeb_graph.Reeb_Graph.VOL = [] |
| reeb_graph.Reeb_Graph.x = np.linspace(self.m[0], self.M[0], self.nx+tmp)[:-1] |
| reeb_graph.Reeb_Graph.y = np.linspace(self.m[1], self.M[1], self.ny+tmp)[:-1] |
| reeb_graph.Reeb_Graph.z = np.linspace(self.m[2], self.M[2], self.nz+tmp)[:-1] |
| reeb_graph.Reeb_Graph.z_0 = z[0]+self.d_z*k |
| reeb_graph.Reeb_Graph.z_1 = z[-1]-self.d_z*k |
| reeb_graph.Reeb_Graph.z_axis_boundaries |