Skip to content

feat: add direct ellipse cloud construction helpers - #103

Merged
t-uda merged 2 commits into
ellphi-0.1.2from
codex/feat-ellipsecloud-api
Mar 25, 2026
Merged

feat: add direct ellipse cloud construction helpers#103
t-uda merged 2 commits into
ellphi-0.1.2from
codex/feat-ellipsecloud-api

Conversation

@t-uda

@t-uda t-uda commented Mar 25, 2026

Copy link
Copy Markdown
Owner

Summary

  • add EllipseCloud.from_cov(...) for precomputed centers/covariances
  • add EllipseCloud.distance_matrix() as a squareform convenience wrapper
  • let ellipse_patch(...) preserve explicit face colors and add tests/docs for the new APIs

Testing

  • MPLCONFIGDIR=/tmp/mpl poetry run pytest tests/test_ellcloud.py tests/test_visualization.py tests/test_ellcloud_rescale.py

@codecov

codecov Bot commented Mar 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment thread src/ellphi/ellcloud.py
Returns:
A square matrix of tangency distances with shape `(n, n)`.
"""
return squareform(

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

Comment thread src/ellphi/ellcloud.py Outdated
covariances.
"""
centers = numpy.asarray(X, dtype=float)
covariances = numpy.asarray(cov, dtype=float)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

@t-uda
t-uda merged commit 5d1162f into ellphi-0.1.2 Mar 25, 2026
11 checks passed
@t-uda
t-uda deleted the codex/feat-ellipsecloud-api branch March 25, 2026 06:06
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.

1 participant