Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix from_spharapy naming in SimplicialComplex #403

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions test/classes/test_simplicial_complex.py
Original file line number Diff line number Diff line change
Expand Up @@ -1096,12 +1096,12 @@ def test_normalized_laplacian_matrix(self):
@pytest.mark.skipif(
tm is None, reason="Optional dependency 'spharapy' not installed."
)
def test_from_spharpy(self):
"""Test the from_spharpy method of SimplicialComplex (support for spharpy trimesh)."""
def test_from_spharapy(self):
"""Test the from_spharapy method of SimplicialComplex (support for spharapy trimesh)."""
mesh = tm.TriMesh(
[[0, 1, 2]], [[1.0, 0.0, 0.0], [0.0, 2.0, 0.0], [0.0, 0.0, 3.0]]
)
SC = SimplicialComplex.from_spharpy(mesh)
SC = SimplicialComplex.from_spharapy(mesh)
simplices = SC.simplices
assert len(simplices) == 7
assert [0, 1, 2] in simplices
Expand Down
8 changes: 4 additions & 4 deletions toponetx/classes/simplicial_complex.py
Original file line number Diff line number Diff line change
Expand Up @@ -1401,7 +1401,7 @@ def get_all_maximal_simplices(self):
return [tuple(s) for s in self.simplices if self.is_maximal(s)]

@classmethod
def from_spharpy(cls, mesh) -> Self:
def from_spharapy(cls, mesh) -> Self:
"""Import from sharpy.

Parameters
Expand All @@ -1423,7 +1423,7 @@ def from_spharpy(cls, mesh) -> Self:
... [[0, 1, 2]], [[1.0, 0.0, 0.0], [0.0, 2.0, 0.0], [0.0, 0.0, 3.0]]
... )

>>> SC = tnx.SimplicialComplex.from_spharpy(mesh)
>>> SC = tnx.SimplicialComplex.from_spharapy(mesh)
"""
vertices = np.array(mesh.vertlist)
SC = cls(mesh.trilist)
Expand Down Expand Up @@ -1612,7 +1612,7 @@ def to_trimesh(self, vertex_position_name: str = "position"):
)

def to_spharapy(self, vertex_position_name: str = "position"):
"""Convert to sharapy.
"""Convert to spharapy.

Parameters
----------
Expand All @@ -1635,7 +1635,7 @@ def to_spharapy(self, vertex_position_name: str = "position"):
>>> import spharapy.spharabasis as sb
>>> import spharapy.datasets as sd
>>> mesh = tm.TriMesh([[0, 1, 2]], [[0, 0, 0], [0, 0, 1], [0, 1, 0]])
>>> SC = tnx.SimplicialComplex.from_spharpy(mesh)
>>> SC = tnx.SimplicialComplex.from_spharapy(mesh)
>>> mesh2 = SC.to_spharapy()
>>> mesh2.vertlist == mesh.vertlist
>>> mesh2.trilist == mesh.trilist
Expand Down
Loading