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

Clearer error message when PlatonicSpheresCollection is initialized with bad positions. #5

Open
briandleahy opened this issue Apr 27, 2017 · 0 comments

Comments

@briandleahy
Copy link
Contributor

briandleahy commented Apr 27, 2017

Currently, it's possible to create a state with particles well outside the padded region, without any error being thrown. However as soon as an update on the particles is attempted, an UpdateError gets raised because the particles are outside the box. This is confusing to the user.

I think a MWE would be (not by a computer with PERI)

from peri.comp import objs
from peri import states, util, models

pos = np.array([10,10,1000]).reshape(-1,3)
obj = objs.PlatonicSpheresCollection(pos, 5.0)
st = states.ImageState(util.NullImage(shape=(30,30,30)), [obj], models.ParticlesOnlyModel())

# no problem

st.update('sph-0-x', st.get_values('sph-0-x') - 1e-3)  # problem

I think the best solution is to check for bad particles the first time that PlatonicSpheresCollection has set_shape called, and raise an error then if there are bad positions / positions outside the padded image shape. Thoughts?

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

No branches or pull requests

1 participant