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

Tests: 🐇 bunny reading results #5

Closed
dancergraham opened this issue Jul 30, 2023 · 3 comments · Fixed by #9
Closed

Tests: 🐇 bunny reading results #5

dancergraham opened this issue Jul 30, 2023 · 3 comments · Fixed by #9
Labels
good first issue Good for newcomers help wanted Extra attention is needed test Improvements or additions to the tests

Comments

@dancergraham
Copy link
Owner

Test that the extents (max - min coordinates) of the bunny pointcloud are close to
Box dimensions
X: 0.155698
Y: 0.14731
Z: 0.120672

Global box center (median position)
X: -0.016840
Y: 0.113666
Z: -0.001537

@dancergraham dancergraham added good first issue Good for newcomers test Improvements or additions to the tests help wanted Extra attention is needed labels Jul 30, 2023
@devdanzin
Copy link
Contributor

The test for box dimensions is passing, but the one for box center fails:

def test_global_box_center():
    pointcloud: np.ndarray = e57.read_points(r"testdata/bunnyFloat.e57")
    X, Y, Z = np.median(pointcloud, 0)
    assert X == pytest.approx(-0.016840)
    assert Y == pytest.approx(0.113666)
    assert Z == pytest.approx(-0.001537)

We actually get
X: -0.032498
Y: 0.101142
Z: 0.00749

Please assess my numpy code in the test, I'm not good at it and might be getting the wrong median. What else can be the issue here?

@dancergraham
Copy link
Owner Author

Hello, ahh yes it is not really the median but rather the max plus the min divided by two ! Sorry wrong wording from me!

@dancergraham
Copy link
Owner Author

The code looks good - I didn't know about pytest.approx. I have always used numpy.isclose but approx is a little cleaner !

dancergraham added a commit that referenced this issue Jul 30, 2023
Add tests for box dimensions and global box center (fix #5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed test Improvements or additions to the tests
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants