[yt-dev] Issue #1131: auto=True does not work for Camera (yt_analysis/yt)
Andrew Myers
issues-reply at bitbucket.org
Mon Oct 19 16:41:03 PDT 2015
New issue 1131: auto=True does not work for Camera
https://bitbucket.org/yt_analysis/yt/issues/1131/auto-true-does-not-work-for-camera
Andrew Myers:
According to the docstrings, this should work:
```
#!python
from yt.visualization.volume_rendering.api import Camera
ds = yt.load('IsolatedGalaxy/galaxy0030/galaxy0030')
cam = Camera(ds, auto=True)
```
but when I run the above code I get the following error:
```
#!python
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-4-a555f68d57d9> in <module>()
2 from yt.visualization.volume_rendering.api import Camera
3 ds = yt.load('IsolatedGalaxy/galaxy0030/galaxy0030')
----> 4 cam = Camera(ds, auto=True)
/Users/atmyers/yt-x86_64/src/yt-hg/yt/visualization/volume_rendering/camera.py in __init__(self, data_source, lens_type, auto)
95 self._position = np.array([1.0]*3)
96 self.set_lens(lens_type)
---> 97 if data_source is not None:
98 data_source = data_source_or_all(data_source)
99 self._focus = data_source.ds.domain_center
/Users/atmyers/yt-x86_64/src/yt-hg/yt/visualization/volume_rendering/camera.py in set_defaults_from_data_source(self, data_source)
216 if lens_type not in lenses:
217 mylog.error("Lens type not available")
--> 218 raise RuntimeError()
219 self.lens = lenses[lens_type]()
220 self.lens.camera = self
/Users/atmyers/yt-x86_64/src/yt-hg/yt/visualization/volume_rendering/camera.py in fset(self, value)
118
119 def fget(self):
--> 120 return self._position
121
122 def fset(self, value):
/Users/atmyers/yt-x86_64/src/yt-hg/yt/visualization/volume_rendering/camera.py in switch_orientation(self, normal_vector, north_vector)
304 north_vector : array_like, optional
305 The 'up' direction for the plane of rays. If not specific,
--> 306 calculated automatically.
307 """
308 if north_vector is None:
/Users/atmyers/yt-x86_64/src/yt-hg/yt/utilities/orientation.pyc in _setup_normalized_vectors(self, normal_vector, north_vector)
72
73 # Now we set up our various vectors
---> 74 normal_vector /= np.sqrt(np.dot(normal_vector, normal_vector))
75 if north_vector is None:
76 vecs = np.identity(3)
TypeError: unsupported operand type(s) for *: 'NoneType' and 'NoneType'
```
Responsible: atmyers
More information about the yt-dev
mailing list