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

numerical tolerance #1641

Merged
merged 2 commits into from
Apr 22, 2015
Merged

numerical tolerance #1641

merged 2 commits into from
Apr 22, 2015

Conversation

marqh
Copy link
Member

@marqh marqh commented Apr 22, 2015

There is a bug in the cube intersection code where

np.where(pre_wrap_delta != post_wrap_delta)

can return a result due to numerical tolerances in the floating point coordinate value

I have trapped this and added a test. This is a reported bug against 1.8.0, so please may it be targeted at the 1.8.1 milestone?

thank you

@marqh marqh force-pushed the intersectionBug branch from 8df6e29 to a27f3d4 Compare April 22, 2015 11:13
@bjlittle bjlittle added this to the v1.8.1 milestone Apr 22, 2015
@marqh marqh force-pushed the intersectionBug branch from a27f3d4 to 58fddad Compare April 22, 2015 12:08
split_cell_indices = np.array(())
else:
split_cell_indices, _ = np.where(pre_wrap_delta !=
post_wrap_delta)
Copy link
Member

Choose a reason for hiding this comment

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

@marqh You could simply refactor this to be the following ...

close_enough = np.allclose(pre_wrap_delta, post_wrap_delta)
if not close_enough:
    split_cell_indices, _ = np.where(pre_wrap_delta != post_wrap_delta)
    # Re-calaulate the extended minimum.
    indices = inside_indices[split_cell_indices]
    cells = bounds[indices]
    ....

Copy link
Member Author

Choose a reason for hiding this comment

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

that looks neater

@bjlittle bjlittle self-assigned this Apr 22, 2015
@bjlittle
Copy link
Member

@marqh Great, thanks 👍

bjlittle added a commit that referenced this pull request Apr 22, 2015
@bjlittle bjlittle merged commit f77170e into SciTools:v1.8.x Apr 22, 2015
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