[yt-dev] Issue #1287: New camera position cannot be aligned with north_vector that was used in previous invocation of set_position (yt_analysis/yt)

Alexander Lindsay issues-reply at bitbucket.org
Fri Sep 30 13:32:02 PDT 2016


New issue 1287: New camera position cannot be aligned with north_vector that was used in previous invocation of set_position
https://bitbucket.org/yt_analysis/yt/issues/1287/new-camera-position-cannot-be-aligned-with

Alexander Lindsay:

Load any data set. The following script will produce an error:

sc = yt.create_scene(ds)
cam = sc.camera
cam.focus = [0, 0, 0]
cam_pos = [1, 0, 0]
north_vector = [0, 1, 0]
cam.set_position(cam_pos, north_vector)
cam_pos = [0, 1, 0]
north_vector = [0, 0, 1]
cam.set_position(cam_pos, north_vector)

Clearly, the user is specifying cam_pos and north_vector that are **not** aligned. However, in the current code set-up, position's fget() passes north_vector=None to `switch_orientation`. Because `north_vector` is None in `switch_orientation`, the old value of north_vector is passed to `_setup_normalized_vectors` which then errors out because the new camera position-focus vector is aligned with the old north_vector.

This issue will only arise in rare cases; however, it took me a very perplexed hour (and learning about python properties :-)) to figure out what was going on.





More information about the yt-dev mailing list