use double quotes for docstrings
This commit is contained in:
parent
3abf1e137f
commit
2fdafc1f69
1 changed files with 18 additions and 18 deletions
36
adze/util.py
36
adze/util.py
|
|
@ -7,12 +7,12 @@ poly_t = dict[str, NDArray]
|
||||||
|
|
||||||
|
|
||||||
def build_empty() -> poly_t:
|
def build_empty() -> poly_t:
|
||||||
'''
|
"""
|
||||||
Build an empty Schlegel representation (containing no vertices).
|
Build an empty Schlegel representation (containing no vertices).
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
Empty Schelegel representation.
|
Empty Schelegel representation.
|
||||||
'''
|
"""
|
||||||
return {
|
return {
|
||||||
'vertices': numpy.empty((0, 3), dtype=float),
|
'vertices': numpy.empty((0, 3), dtype=float),
|
||||||
'neighbors': numpy.empty((0, 3), dtype=int),
|
'neighbors': numpy.empty((0, 3), dtype=int),
|
||||||
|
|
@ -103,13 +103,13 @@ def find_faces(neighbors: NDArray[numpy.integer]) -> list[NDArray[numpy.integer]
|
||||||
faces_set.append(faces[i])
|
faces_set.append(faces[i])
|
||||||
return faces_set
|
return faces_set
|
||||||
|
|
||||||
'''
|
"""
|
||||||
Starting at all vertices, take a step along all edges.
|
Starting at all vertices, take a step along all edges.
|
||||||
If the vertex index decreases, stop traversal and mark the path for removal.
|
If the vertex index decreases, stop traversal and mark the path for removal.
|
||||||
Otherwise, continue stepping along the _next_ edge each time, until
|
Otherwise, continue stepping along the _next_ edge each time, until
|
||||||
a) the vertex index decreases (stop and mark for removal)
|
a) the vertex index decreases (stop and mark for removal)
|
||||||
b) we reach the original vertex (stop, done with this path)
|
b) we reach the original vertex (stop, done with this path)
|
||||||
'''
|
"""
|
||||||
k = 1
|
k = 1
|
||||||
mask = v_next > v_current
|
mask = v_next > v_current
|
||||||
v = numpy.vstack((edge_id, v_start, v_current, v_next))[:, mask]
|
v = numpy.vstack((edge_id, v_start, v_current, v_next))[:, mask]
|
||||||
|
|
@ -133,10 +133,10 @@ def find_faces(neighbors: NDArray[numpy.integer]) -> list[NDArray[numpy.integer]
|
||||||
|
|
||||||
|
|
||||||
def _get_map(a, b):
|
def _get_map(a, b):
|
||||||
'''
|
"""
|
||||||
Returns m such that a[m] == b
|
Returns m such that a[m] == b
|
||||||
Assumes that all elements appear exactly once in each array
|
Assumes that all elements appear exactly once in each array
|
||||||
'''
|
"""
|
||||||
if a.size == 0:
|
if a.size == 0:
|
||||||
return numpy.array(()), numpy.array(())
|
return numpy.array(()), numpy.array(())
|
||||||
sa = a.argsort()
|
sa = a.argsort()
|
||||||
|
|
@ -147,9 +147,9 @@ def _get_map(a, b):
|
||||||
|
|
||||||
|
|
||||||
def _get_map_rows(a, b):
|
def _get_map_rows(a, b):
|
||||||
'''
|
"""
|
||||||
Row-wise _get_map
|
Row-wise _get_map
|
||||||
'''
|
"""
|
||||||
dims = numpy.maximum(a.max(0), b.max(0)) + 1
|
dims = numpy.maximum(a.max(0), b.max(0)) + 1
|
||||||
a1d = numpy.ravel_multi_index(a.T, dims)
|
a1d = numpy.ravel_multi_index(a.T, dims)
|
||||||
b1d = numpy.ravel_multi_index(b.T, dims)
|
b1d = numpy.ravel_multi_index(b.T, dims)
|
||||||
|
|
@ -157,10 +157,10 @@ def _get_map_rows(a, b):
|
||||||
|
|
||||||
|
|
||||||
def _get_maps(a, b):
|
def _get_maps(a, b):
|
||||||
'''
|
"""
|
||||||
Returns m, n such that a[m] == b, b[n] == a
|
Returns m, n such that a[m] == b, b[n] == a
|
||||||
Assumes that all elements appear exactly once in each array
|
Assumes that all elements appear exactly once in each array
|
||||||
'''
|
"""
|
||||||
if a.size == 0:
|
if a.size == 0:
|
||||||
return numpy.array(()), numpy.array(())
|
return numpy.array(()), numpy.array(())
|
||||||
sa = a.argsort()
|
sa = a.argsort()
|
||||||
|
|
@ -174,9 +174,9 @@ def _get_maps(a, b):
|
||||||
|
|
||||||
|
|
||||||
def _get_maps_rows(a, b):
|
def _get_maps_rows(a, b):
|
||||||
'''
|
"""
|
||||||
Row-wise _get_maps
|
Row-wise _get_maps
|
||||||
'''
|
"""
|
||||||
dims = numpy.maximum(a.max(0), b.max(0)) + 1
|
dims = numpy.maximum(a.max(0), b.max(0)) + 1
|
||||||
a1d = numpy.ravel_multi_index(a.T, dims)
|
a1d = numpy.ravel_multi_index(a.T, dims)
|
||||||
b1d = numpy.ravel_multi_index(b.T, dims)
|
b1d = numpy.ravel_multi_index(b.T, dims)
|
||||||
|
|
@ -184,18 +184,18 @@ def _get_maps_rows(a, b):
|
||||||
|
|
||||||
|
|
||||||
def _argsort_rows(a):
|
def _argsort_rows(a):
|
||||||
'''
|
"""
|
||||||
Row-wise argsort
|
Row-wise argsort
|
||||||
'''
|
"""
|
||||||
dims = a.max(0) + 1
|
dims = a.max(0) + 1
|
||||||
a1d = numpy.ravel_multi_index(a.T, dims)
|
a1d = numpy.ravel_multi_index(a.T, dims)
|
||||||
return numpy.argsort(a1d)
|
return numpy.argsort(a1d)
|
||||||
|
|
||||||
|
|
||||||
def _searchsorted_rows(a, b):
|
def _searchsorted_rows(a, b):
|
||||||
'''
|
"""
|
||||||
Row-wise searchsorted
|
Row-wise searchsorted
|
||||||
'''
|
"""
|
||||||
dims = numpy.maximum(a.max(0), b.max(0)) + 1
|
dims = numpy.maximum(a.max(0), b.max(0)) + 1
|
||||||
a1d = numpy.ravel_multi_index(a.T, dims)
|
a1d = numpy.ravel_multi_index(a.T, dims)
|
||||||
b1d = numpy.ravel_multi_index(b.T, dims)
|
b1d = numpy.ravel_multi_index(b.T, dims)
|
||||||
|
|
@ -203,7 +203,7 @@ def _searchsorted_rows(a, b):
|
||||||
|
|
||||||
|
|
||||||
def check_poly(poly: poly_t, check_connectivity: bool = True) -> None:
|
def check_poly(poly: poly_t, check_connectivity: bool = True) -> None:
|
||||||
'''
|
"""
|
||||||
Verify that the polyhedron
|
Verify that the polyhedron
|
||||||
- has no out-of-bounds neighbors
|
- has no out-of-bounds neighbors
|
||||||
- has no duplicate neighbors
|
- has no duplicate neighbors
|
||||||
|
|
@ -217,7 +217,7 @@ def check_poly(poly: poly_t, check_connectivity: bool = True) -> None:
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
Exception if the polyhedron fails a check
|
Exception if the polyhedron fails a check
|
||||||
'''
|
"""
|
||||||
neighbors = poly['neighbors']
|
neighbors = poly['neighbors']
|
||||||
vertices = poly['vertices']
|
vertices = poly['vertices']
|
||||||
num_vertices = vertices.shape[0]
|
num_vertices = vertices.shape[0]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue