argiope/mesh.py
def edges(self, zfill = 3):
    """
    Returns the aspect ratio of all elements.
    """
    edges = self.split("edges", at = "coords").unstack()
    edges["lx"] = edges.x[1]-edges.x[0]
    edges["ly"] = edges.y[1]-edges.y[0]
    edges["lz"] = edges.z[1]-edges.z[0]
    edges["l"] = np.linalg.norm(edges[["lx", "ly", "lz"]], axis = 1)
    edges = (edges.l).unstack()
    edges.columns = pd.MultiIndex.from_product([["length"], 
                    ["e" + "{0}".format(s).zfill(zfill) 
                    for s in np.arange(edges.shape[1])]])
    edges[("stats", "lmax")] = edges.length.max(axis = 1)
    edges[("stats", "lmin")] = edges.length.min(axis = 1)
    edges[("stats", "aspect_ratio")] = edges.stats.lmax / edges.stats.lmin
    return edges.sort_index(axis = 1)
def edges(self, zfill = 3):
    edges = self.split("edges", at = "coords").unstack()
    edges["lx"] = edges.x[1]-edges.x[0]
    edges["ly"] = edges.y[1]-edges.y[0]
    edges["lz"] = edges.z[1]-edges.z[0]
    edges["l"] = np.linalg.norm(edges[["lx", "ly", "lz"]], axis = 1)
    edges = (edges.l).unstack()
    edges.columns = pd.MultiIndex.from_product([["length"], 
                    ["e" + "{0}".format(s).zfill(zfill) 
                    for s in np.arange(edges.shape[1])]])
    edges[("stats", "lmax")] = edges.length.max(axis = 1)
    edges[("stats", "lmin")] = edges.length.min(axis = 1)
    edges[("stats", "aspect_ratio")] = edges.stats.lmax / edges.stats.lmin
    return edges.sort_index(axis = 1)
def edges ( self , zfill = 3 ) : edges = self . split ( "edges" , at = "coords" ) . unstack ( ) edges [ "lx" ] = edges . x [ 1 ] - edges . x [ 0 ] edges [ "ly" ] = edges . y [ 1 ] - edges . y [ 0 ] edges [ "lz" ] = edges . z [ 1 ] - edges . z [ 0 ] edges [ "l" ] = np . linalg . norm ( edges [ [ "lx" , "ly" , "lz" ] ] , axis = 1 ) edges = ( edges . l ) . unstack ( ) edges . columns = pd . MultiIndex . from_product ( [ [ "length" ] , [ "e" + "{0}" . format ( s ) . zfill ( zfill ) for s in np . arange ( edges . shape [ 1 ] ) ] ] ) edges [ ( "stats" , "lmax" ) ] = edges . length . max ( axis = 1 ) edges [ ( "stats" , "lmin" ) ] = edges . length . min ( axis = 1 ) edges [ ( "stats" , "aspect_ratio" ) ] = edges . stats . lmax / edges . stats . lmin return edges . sort_index ( axis = 1 )
Returns the aspect ratio of all elements.
Returns the aspect ratio of all elements .