possible error with spherical coordinate transforms
![](https://secure.gravatar.com/avatar/4842211d38e8a90db20051b139c5cd35.jpg?s=120&d=mm&r=g)
Hello, I am trying to produce an all-sky map projection of a field. Maybe I did something wrong here, but even after the fix described in https://bitbucket.org/yt_analysis/yt/issue/451/radialvelocity-now-seems-to-r... (which sets 'normal' to [0,0,1]), there seems to be an array dimension mismatch between Jy and theta, phi, as you can see below. Can anyone help me with this problem? I attach a logfile (output with --detail) with this error. Thank you, -Ryan The part of the script where the error occurs: ----------------------------- [snipped] for _fields in grouper(3, field_names): f = h5py.File("hi_maps.h5", "a") fields = [fn for fn in _fields if fn not in f["/"]] allsky = camera.allsky_projection(pf, c, 300.0/pf['kpc'], NP, fields, inner_radius = rr, rotation = rotation) <-- line 60 [snipped] ----------------------------- ----------------------------- Traceback (most recent call last): File "sky_maps.py", line 60, in <module> inner_radius = rr, rotation = rotation) File "/Users/mkjoung/work/yt/yt-i386/src/yt-hg/yt/visualization/volume_rendering/camera.py", line 1536, in allsky_projection for field in fields] File "/Users/mkjoung/work/yt/yt-i386/src/yt-hg/yt/data_objects/grid_patch.py", line 157, in __getitem__ self.get_data(key) File "/Users/mkjoung/work/yt/yt-i386/src/yt-hg/yt/data_objects/grid_patch.py", line 200, in get_data self._generate_field(field) File "/Users/mkjoung/work/yt/yt-i386/src/yt-hg/yt/data_objects/grid_patch.py", line 145, in _generate_field self[field] = self.pf.field_info[field](self) File "/Users/mkjoung/work/yt/yt-i386/src/yt-hg/yt/data_objects/field_info_container.py", line 316, in __call__ dd = self._function(self, data) File "sky_maps.py", line 50, in VelocityTransmittedHI (((vel * 1e5) < data["RadialVelocity"]) File "/Users/mkjoung/work/yt/yt-i386/src/yt-hg/yt/data_objects/grid_patch.py", line 157, in __getitem__ self.get_data(key) File "/Users/mkjoung/work/yt/yt-i386/src/yt-hg/yt/data_objects/grid_patch.py", line 200, in get_data self._generate_field(field) File "/Users/mkjoung/work/yt/yt-i386/src/yt-hg/yt/data_objects/grid_patch.py", line 145, in _generate_field self[field] = self.pf.field_info[field](self) File "/Users/mkjoung/work/yt/yt-i386/src/yt-hg/yt/data_objects/field_info_container.py", line 316, in __call__ dd = self._function(self, data) File "/Users/mkjoung/work/yt/yt-i386/src/yt-hg/yt/data_objects/universal_fields.py", line 885, in _RadialVelocity return get_sph_r_component(velocities, theta, phi, normal) File "/Users/mkjoung/work/yt/yt-i386/src/yt-hg/yt/utilities/math_utils.py", line 797, in get_sph_r_component Jy*np.sin(theta)*np.sin(phi) + \ ValueError: operands could not be broadcast together with shapes (128,128,128,3) (128,384,128) -----------------------------
![](https://secure.gravatar.com/avatar/7857f26c1ef2e9bdbfa843f9087710f7.jpg?s=120&d=mm&r=g)
Hi Ryan, Thanks for the bug report. I've fixed the issue and we've merged the changes into the tip of the development branch. Matt has also added tests to help ensure that this sort of bug won't crop up again in the future. Please let us know if you have further trouble. Cheers, Nathan On Oct 18, 2012, at 8:44 AM, M Ryan Joung wrote:
Hello,
I am trying to produce an all-sky map projection of a field. Maybe I did something wrong here, but even after the fix described in https://bitbucket.org/yt_analysis/yt/issue/451/radialvelocity-now-seems-to-r... (which sets 'normal' to [0,0,1]), there seems to be an array dimension mismatch between Jy and theta, phi, as you can see below. Can anyone help me with this problem? I attach a logfile (output with --detail) with this error.
Thank you, -Ryan
The part of the script where the error occurs: ----------------------------- [snipped] for _fields in grouper(3, field_names): f = h5py.File("hi_maps.h5", "a") fields = [fn for fn in _fields if fn not in f["/"]] allsky = camera.allsky_projection(pf, c, 300.0/pf['kpc'], NP, fields, inner_radius = rr, rotation = rotation) <-- line 60 [snipped] ----------------------------- ----------------------------- Traceback (most recent call last): File "sky_maps.py", line 60, in <module> inner_radius = rr, rotation = rotation) File "/Users/mkjoung/work/yt/yt-i386/src/yt-hg/yt/visualization/volume_rendering/camera.py", line 1536, in allsky_projection for field in fields] File "/Users/mkjoung/work/yt/yt-i386/src/yt-hg/yt/data_objects/grid_patch.py", line 157, in __getitem__ self.get_data(key) File "/Users/mkjoung/work/yt/yt-i386/src/yt-hg/yt/data_objects/grid_patch.py", line 200, in get_data self._generate_field(field) File "/Users/mkjoung/work/yt/yt-i386/src/yt-hg/yt/data_objects/grid_patch.py", line 145, in _generate_field self[field] = self.pf.field_info[field](self) File "/Users/mkjoung/work/yt/yt-i386/src/yt-hg/yt/data_objects/field_info_container.py", line 316, in __call__ dd = self._function(self, data) File "sky_maps.py", line 50, in VelocityTransmittedHI (((vel * 1e5) < data["RadialVelocity"]) File "/Users/mkjoung/work/yt/yt-i386/src/yt-hg/yt/data_objects/grid_patch.py", line 157, in __getitem__ self.get_data(key) File "/Users/mkjoung/work/yt/yt-i386/src/yt-hg/yt/data_objects/grid_patch.py", line 200, in get_data self._generate_field(field) File "/Users/mkjoung/work/yt/yt-i386/src/yt-hg/yt/data_objects/grid_patch.py", line 145, in _generate_field self[field] = self.pf.field_info[field](self) File "/Users/mkjoung/work/yt/yt-i386/src/yt-hg/yt/data_objects/field_info_container.py", line 316, in __call__ dd = self._function(self, data) File "/Users/mkjoung/work/yt/yt-i386/src/yt-hg/yt/data_objects/universal_fields.py", line 885, in _RadialVelocity return get_sph_r_component(velocities, theta, phi, normal) File "/Users/mkjoung/work/yt/yt-i386/src/yt-hg/yt/utilities/math_utils.py", line 797, in get_sph_r_component Jy*np.sin(theta)*np.sin(phi) + \ ValueError: operands could not be broadcast together with shapes (128,128,128,3) (128,384,128) -----------------------------
<log3> _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
![](https://secure.gravatar.com/avatar/4842211d38e8a90db20051b139c5cd35.jpg?s=120&d=mm&r=g)
Thanks, it works now! :) -Ryan On Oct 18, 2012, at 3:22 PM, Nathan Goldbaum wrote:
Hi Ryan,
Thanks for the bug report. I've fixed the issue and we've merged the changes into the tip of the development branch.
Matt has also added tests to help ensure that this sort of bug won't crop up again in the future.
Please let us know if you have further trouble.
Cheers,
Nathan
On Oct 18, 2012, at 8:44 AM, M Ryan Joung wrote:
Hello,
I am trying to produce an all-sky map projection of a field. Maybe I did something wrong here, but even after the fix described in https://bitbucket.org/yt_analysis/yt/issue/451/radialvelocity-now-seems-to-r... (which sets 'normal' to [0,0,1]), there seems to be an array dimension mismatch between Jy and theta, phi, as you can see below. Can anyone help me with this problem? I attach a logfile (output with --detail) with this error.
Thank you, -Ryan
The part of the script where the error occurs: ----------------------------- [snipped] for _fields in grouper(3, field_names): f = h5py.File("hi_maps.h5", "a") fields = [fn for fn in _fields if fn not in f["/"]] allsky = camera.allsky_projection(pf, c, 300.0/pf['kpc'], NP, fields, inner_radius = rr, rotation = rotation) <-- line 60 [snipped] ----------------------------- ----------------------------- Traceback (most recent call last): File "sky_maps.py", line 60, in <module> inner_radius = rr, rotation = rotation) File "/Users/mkjoung/work/yt/yt-i386/src/yt-hg/yt/visualization/volume_rendering/camera.py", line 1536, in allsky_projection for field in fields] File "/Users/mkjoung/work/yt/yt-i386/src/yt-hg/yt/data_objects/grid_patch.py", line 157, in __getitem__ self.get_data(key) File "/Users/mkjoung/work/yt/yt-i386/src/yt-hg/yt/data_objects/grid_patch.py", line 200, in get_data self._generate_field(field) File "/Users/mkjoung/work/yt/yt-i386/src/yt-hg/yt/data_objects/grid_patch.py", line 145, in _generate_field self[field] = self.pf.field_info[field](self) File "/Users/mkjoung/work/yt/yt-i386/src/yt-hg/yt/data_objects/field_info_container.py", line 316, in __call__ dd = self._function(self, data) File "sky_maps.py", line 50, in VelocityTransmittedHI (((vel * 1e5) < data["RadialVelocity"]) File "/Users/mkjoung/work/yt/yt-i386/src/yt-hg/yt/data_objects/grid_patch.py", line 157, in __getitem__ self.get_data(key) File "/Users/mkjoung/work/yt/yt-i386/src/yt-hg/yt/data_objects/grid_patch.py", line 200, in get_data self._generate_field(field) File "/Users/mkjoung/work/yt/yt-i386/src/yt-hg/yt/data_objects/grid_patch.py", line 145, in _generate_field self[field] = self.pf.field_info[field](self) File "/Users/mkjoung/work/yt/yt-i386/src/yt-hg/yt/data_objects/field_info_container.py", line 316, in __call__ dd = self._function(self, data) File "/Users/mkjoung/work/yt/yt-i386/src/yt-hg/yt/data_objects/universal_fields.py", line 885, in _RadialVelocity return get_sph_r_component(velocities, theta, phi, normal) File "/Users/mkjoung/work/yt/yt-i386/src/yt-hg/yt/utilities/math_utils.py", line 797, in get_sph_r_component Jy*np.sin(theta)*np.sin(phi) + \ ValueError: operands could not be broadcast together with shapes (128,128,128,3) (128,384,128) -----------------------------
<log3> _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
participants (2)
-
M Ryan Joung
-
Nathan Goldbaum