feat: add direct ellipse cloud construction helpers - #103
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8d29849a88
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| Returns: | ||
| A square matrix of tangency distances with shape `(n, n)`. | ||
| """ | ||
| return squareform( |
There was a problem hiding this comment.
Handle empty clouds in distance_matrix
Calling distance_matrix() on an empty cloud can return the wrong shape because pdist_tangency() yields an empty condensed vector and squareform interprets length-0 input as a 1x1 matrix. This violates the method’s (n, n) contract when n == 0 and can break downstream code expecting a true empty precomputed-distance matrix; add an explicit empty-cloud guard before squareform.
Useful? React with 👍 / 👎.
| covariances. | ||
| """ | ||
| centers = numpy.asarray(X, dtype=float) | ||
| covariances = numpy.asarray(cov, dtype=float) |
There was a problem hiding this comment.
Avoid mutating caller covariance arrays in from_cov
from_cov keeps references to input arrays via numpy.asarray, and when rescaling is enabled it later rescales self.cov in place, which also mutates the caller’s original covariance array if it was already a float ndarray. This hidden side effect can corrupt reused input data in subsequent computations, so the constructor should copy cov (and ideally X) before storing/rescaling.
Useful? React with 👍 / 👎.
Summary
EllipseCloud.from_cov(...)for precomputed centers/covariancesEllipseCloud.distance_matrix()as a squareform convenience wrapperellipse_patch(...)preserve explicit face colors and add tests/docs for the new APIsTesting