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

Added edge_lengths property #196

Merged
merged 5 commits into from
Sep 30, 2023
Merged

Added edge_lengths property #196

merged 5 commits into from
Sep 30, 2023

Conversation

janbridley
Copy link
Collaborator

@janbridley janbridley commented Sep 18, 2023

Description

Added edge_lengths property to the Polyhedron class.

Motivation and Context

Although this is a single line of code, I use it extremely frequently (as it has additional value in helping to determine the degree of uniformity of a solid). This should be a quick PR, and if it seems unnecessary I am happy to continue manually implementing this function.

Types of Changes

  • Documentation update
  • Bug fix
  • New feature
  • Breaking change1

1The change breaks (or has the potential to break) existing functionality.

Checklist:

@janbridley janbridley requested review from a team and DomFijan and removed request for a team September 18, 2023 15:47
@janbridley janbridley self-assigned this Sep 18, 2023
@codecov
Copy link

codecov bot commented Sep 18, 2023

Codecov Report

Merging #196 (9c128d9) into master (926e41c) will decrease coverage by 0.01%.
Report is 3 commits behind head on master.
The diff coverage is 33.33%.

❗ Current head 9c128d9 differs from pull request most recent head 080e942. Consider uploading reports for the commit 080e942 to get more accurate results

@@            Coverage Diff             @@
##           master     #196      +/-   ##
==========================================
- Coverage   54.88%   54.87%   -0.01%     
==========================================
  Files          24       25       +1     
  Lines        2551     2582      +31     
==========================================
+ Hits         1400     1417      +17     
- Misses       1151     1165      +14     
Files Coverage Δ
coxeter/shapes/polyhedron.py 67.32% <33.33%> (-0.01%) ⬇️

... and 5 files with indirect coverage changes

Copy link
Contributor

@DomFijan DomFijan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good. Lets make sure that order of edge lengths is well defined in the docs and this is good to go.

@@ -390,6 +390,11 @@ def edge_vectors(self):
""":class:`numpy.ndarray`: Get the polyhedron's edges as vectors."""
return self.vertices[self.edges[:, 1]] - self.vertices[self.edges[:, 0]]

@property
def edge_lengths(self):
""":class:`numpy.ndarray`: Get the length of each edge of the polyhedron."""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
""":class:`numpy.ndarray`: Get the length of each edge of the polyhedron."""
""":class:`numpy.ndarray`: Get the length of each edge of the polyhedron in the same order as order of edges in :meth:`edge_vectors` ."""

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add this ordering specification to edge_vectors as well? Both use the same ordering as :meth:edges which is the primary sorted array

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe. Is it super obvious what this is? If it is maybe this needs not be in the docstring, but if it is not then it should be for sure.

@janbridley janbridley merged commit bcf7f07 into master Sep 30, 2023
8 checks passed
@janbridley janbridley deleted the edge-lengths branch September 30, 2023 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants