Repository navigation
fix: PointCloud.normals(radius=..., max_nn=...) still works, with a deprecation warning - #283
Merged
Merged
Conversation
…eprecation warning Up to MVTB release 0.9, normals(...) was the method that estimated the normals, and the printed book uses it (chapter 14). In MVTB v1.0.1 it became a property that returns the normals and the method became estimate_normals, which are the names Open3D uses, so the book code raised TypeError. The array that the property returns can now be called, which estimates the normals as before and warns that estimate_normals is the name to use. What the property returns is unchanged. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 13 |
| Duplication | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
Both sides added code at the same place in PointCloud.py (the _Normals class here, _show_in_notebook on main) and in test_pointcloud.py (TestNormals here, the notebook display tests on main). Both are kept, and the normals docstring uses the new .. seealso:: style. The full suite passes against this branch's source.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Up to MVTB release 0.9,
PointCloud.normals(radius=..., max_nn=...)was the method that estimated the normals, and the printed book uses it (chapter 14, §14.7:pcd.normals(radius=0.1, max_nn=30)). In MVTB v1.0.1 (commit 38c4aeb) it became a property that returns the normals, and the method becameestimate_normals. These are the names Open3D uses, and the change was part of making the wrapper follow Open3D. The book code has raisedTypeError: 'numpy.ndarray' object is not callablesince then. The API change stays, and the difference from the printed book is recorded in the RVC3-python errata.This PR catches the old call.
pcd.normalsstill returns the 3 × N array, as now. Calling it,pcd.normals(radius=0.1, max_nn=30), estimates the normals as before and gives aDeprecationWarningthat says to useestimate_normals. The warning is reported at the caller's line, so it shows in a notebook cell.The array that the property returns is an ndarray subclass. Slices and arithmetic on it are also of that subclass, so they are callable too.
np.asarray(normals)gives a plain array.Tests: the property array, the old call with its warning and the same result as
estimate_normals, and normal array behavior. The old-call test fails on the old code. I ran the full suite and mypy, and both are clean.AI-assisted: written with Claude Code.
🤖 Generated with Claude Code