type fixes and ignores
This commit is contained in:
parent
b791d3c854
commit
ac57454763
10 changed files with 27 additions and 26 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
from typing import List, Dict
|
from typing import List, Dict, Any
|
||||||
import numpy
|
import numpy # type: ignore
|
||||||
from numpy.linalg import norm
|
from numpy.linalg import norm # type: ignore
|
||||||
|
|
||||||
from . import poly_t, plane_t
|
from . import poly_t, plane_t
|
||||||
from .util import _get_maps, find_components, find_faces
|
from .util import _get_maps, find_components, find_faces
|
||||||
|
|
@ -255,7 +255,7 @@ def build_polyhedron(vertices: numpy.ndarray, faces: numpy.ndarray) -> poly_t:
|
||||||
return {'vertices': final_vertices, 'neighbors': neighbors}
|
return {'vertices': final_vertices, 'neighbors': neighbors}
|
||||||
|
|
||||||
|
|
||||||
def boundary_from_poly(poly: poly_t) -> Dict:
|
def boundary_from_poly(poly: poly_t) -> List[Dict[str, Any]]:
|
||||||
'''
|
'''
|
||||||
Generate a boundary represeentation corresponding to the provided
|
Generate a boundary represeentation corresponding to the provided
|
||||||
3-vertex-connected Schlegel diagram.
|
3-vertex-connected Schlegel diagram.
|
||||||
|
|
@ -275,7 +275,7 @@ def boundary_from_poly(poly: poly_t) -> Dict:
|
||||||
faces = find_faces(neighbors)
|
faces = find_faces(neighbors)
|
||||||
num_components = owning_component.max() + 1
|
num_components = owning_component.max() + 1
|
||||||
|
|
||||||
components = [[] for _ in range(num_components)]
|
components: List[List[numpy.ndarray]] = [[] for _ in range(num_components)]
|
||||||
for face in faces:
|
for face in faces:
|
||||||
component_ind = owning_component[face[0]]
|
component_ind = owning_component[face[0]]
|
||||||
components[component_ind].append(face)
|
components[component_ind].append(face)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
from typing import Dict, Tuple
|
from typing import Dict, Tuple
|
||||||
import numpy
|
import numpy # type: ignore
|
||||||
|
|
||||||
from . import poly_t, plane_t
|
from . import poly_t, plane_t
|
||||||
from .util import find_faces
|
from .util import find_faces
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
from typing import List
|
from typing import List
|
||||||
import numpy
|
import numpy # type: ignore
|
||||||
from numpy.linalg import norm
|
from numpy.linalg import norm # type: ignore
|
||||||
|
|
||||||
from . import poly_t, plane_t
|
from . import poly_t, plane_t
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,9 +8,9 @@ from time import perf_counter
|
||||||
import random
|
import random
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import numpy
|
import numpy # type: ignore
|
||||||
from numpy import sin, cos, pi
|
from numpy import sin, cos, pi
|
||||||
from numpy.linalg import norm
|
from numpy.linalg import norm # type: ignore
|
||||||
|
|
||||||
import adze
|
import adze
|
||||||
import adze.util
|
import adze.util
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
import logging
|
import logging
|
||||||
import pytest
|
import pytest
|
||||||
from pytest import approx
|
from pytest import approx
|
||||||
import numpy
|
import numpy # type: ignore
|
||||||
from numpy.linalg import norm
|
from numpy.linalg import norm # type: ignore
|
||||||
from numpy.testing import assert_allclose, assert_array_equal
|
from numpy.testing import assert_allclose, assert_array_equal # type: ignore
|
||||||
|
|
||||||
import adze
|
import adze
|
||||||
import adze.util
|
import adze.util
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
import logging
|
import logging
|
||||||
import pytest
|
import pytest
|
||||||
from pytest import approx
|
from pytest import approx
|
||||||
import numpy
|
import numpy # type: ignore
|
||||||
from numpy.linalg import norm
|
from numpy.linalg import norm # type: ignore
|
||||||
from numpy.testing import assert_allclose, assert_array_equal
|
from numpy.testing import assert_allclose, assert_array_equal # type: ignore
|
||||||
from time import perf_counter
|
from time import perf_counter
|
||||||
|
|
||||||
import adze
|
import adze
|
||||||
|
|
@ -55,8 +55,8 @@ def visualize_isosurface(grid,
|
||||||
show_edges: Whether to draw triangle edges. Default True
|
show_edges: Whether to draw triangle edges. Default True
|
||||||
finalize: Whether to call pyplot.show() after constructing the plot. Default True
|
finalize: Whether to call pyplot.show() after constructing the plot. Default True
|
||||||
"""
|
"""
|
||||||
from matplotlib import pyplot
|
from matplotlib import pyplot # type: ignore
|
||||||
import skimage.measure
|
import skimage.measure # type: ignore
|
||||||
# Claims to be unused, but needed for subplot(projection='3d')
|
# Claims to be unused, but needed for subplot(projection='3d')
|
||||||
from mpl_toolkits.mplot3d import Axes3D
|
from mpl_toolkits.mplot3d import Axes3D
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import numpy
|
import numpy # type: ignore
|
||||||
from numpy import pi, cos, sin
|
from numpy import pi, cos, sin
|
||||||
from numpy.linalg import norm
|
from numpy.linalg import norm # type: ignore
|
||||||
import random
|
import random
|
||||||
|
|
||||||
import adze
|
import adze
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import numpy
|
from typing import Union
|
||||||
|
import numpy # type: ignore
|
||||||
from numpy import sin, cos
|
from numpy import sin, cos
|
||||||
|
|
||||||
from . import poly_t, plane_t
|
from . import poly_t, plane_t
|
||||||
|
|
@ -41,7 +42,7 @@ def translate(poly: poly_t, shift: numpy.ndarray) -> poly_t:
|
||||||
return poly
|
return poly
|
||||||
|
|
||||||
|
|
||||||
def scale(poly: poly_t, factor: numpy.ndarray or float) -> poly_t:
|
def scale(poly: poly_t, factor: Union[numpy.ndarray, float]) -> poly_t:
|
||||||
'''
|
'''
|
||||||
Scale the polyhedron.
|
Scale the polyhedron.
|
||||||
Can scale by a single value, or scale each axis individually
|
Can scale by a single value, or scale each axis individually
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
from typing import Dict, Tuple, List
|
from typing import Dict, Tuple, List
|
||||||
import numpy
|
import numpy # type: ignore
|
||||||
|
|
||||||
|
|
||||||
plane_t = Tuple[numpy.ndarray, float]
|
plane_t = Tuple[numpy.ndarray, float]
|
||||||
|
|
@ -92,11 +92,11 @@ def find_faces(neighbors: numpy.ndarray) -> List[numpy.ndarray]:
|
||||||
# Alternative approach, less memory-intensive but slower
|
# Alternative approach, less memory-intensive but slower
|
||||||
faces = [[v] for v in v_current]
|
faces = [[v] for v in v_current]
|
||||||
|
|
||||||
def add_edges(edge_id, v_nxt, _k):
|
def add_edges(edge_id, v_nxt, k):
|
||||||
for i, vn in zip(edge_id, v_nxt):
|
for i, vn in zip(edge_id, v_nxt):
|
||||||
faces[i].append(vn)
|
faces[i].append(vn)
|
||||||
|
|
||||||
def cleaned_faces(remove, _k):
|
def cleaned_faces(remove, k):
|
||||||
faces_set = []
|
faces_set = []
|
||||||
for i in numpy.where(~remove)[0]:
|
for i in numpy.where(~remove)[0]:
|
||||||
faces_set.append(faces[i])
|
faces_set.append(faces[i])
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
from typing import Tuple, List
|
from typing import Tuple, List
|
||||||
import numpy
|
import numpy # type: ignore
|
||||||
|
|
||||||
from . import poly_t, plane_t
|
from . import poly_t, plane_t
|
||||||
from .split import split, clip
|
from .split import split, clip
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue