[yt-dev] Issue #1299: order of parameters set in VR matters (yt_analysis/yt)
Michael Zingale
issues-reply at bitbucket.org
Tue Nov 22 16:51:34 PST 2016
New issue 1299: order of parameters set in VR matters
https://bitbucket.org/yt_analysis/yt/issues/1299/order-of-parameters-set-in-vr-matters
Michael Zingale:
consider the following script:
```
import yt
import numpy as np
from yt.visualization.volume_rendering.api import \
Scene, \
VolumeSource
# fake test dataset
ds = yt.testing.fake_vr_orientation_test_ds(128)
# no log please
ds._get_field_info("density").take_log = False
sc = Scene()
vol = VolumeSource(ds, field=('gas', 'density'))
sc.add_source(vol)
cam = sc.add_camera(ds, lens_type="perspective")
cam.resolution = (1280, 720)
cam.north_vector = np.array([0., 0., 1.])
cam.focus = ds.arr(np.array([1., 0., 0.]), 'code_length')
cam.position = ds.arr(np.array([0., 0., 0.]), 'code_length')
#sc.annotate_domain(ds)
sc.render()
sc.save("test_{:03}.png".format(0), sigma_clip=6.0)
```
this runs as-is.
If you change the order of the properties to:
```
cam.north_vector = np.array([0., 0., 1.])
cam.position = ds.arr(np.array([0., 0., 0.]), 'code_length')
cam.focus = ds.arr(np.array([1., 0., 0.]), 'code_length')
```
it aborts with
```
RuntimeError: Cannot set the camera focus and position to the same value
```
it you change them to
```
cam.focus = ds.arr(np.array([1., 0., 0.]), 'code_length')
cam.position = ds.arr(np.array([0., 0., 0.]), 'code_length')
cam.north_vector = np.array([0., 0., 1.])
```
it aborts with:
```
yt.utilities.exceptions.YTException: normal_vector and north_vector cannot be aligned.
```
these checks should wait until the user is done setting all the properties and the order of setting them should not matter.
More information about the yt-dev
mailing list