[yt-users] Mismatched array dimensions when trying to construct surface.triangles
Matthew Turk
matthewturk at gmail.com
Tue Nov 11 06:44:02 PST 2014
Hi David,
Hmm, this smells similar to this bug:
https://bitbucket.org/yt_analysis/yt/issue/854/different-dimensions-for-coordinates-and
I think that there is a rounding error in the logic for constructing a
"smoothed" covering grid, but I have so far been unable to find it. What
the smoothing does is attempt to construct level-by-level cascading
interpolation in the ghost regions. To do that, it tries to expand by a
dimension each level, to make sure there's enough room for a trilinear
(cell-centered) interpolation. I believe the issue is likely that at some
point, it's rounding incorrectly. Would you mind bumping that bug report,
and then when I have a bit of time (unfortunately the bus factor on the
smoothed covering grid is rather low...) I will take a look, hopefully
today?
-Matt
On Tue Nov 11 2014 at 7:38:01 AM David Ketcheson <dketch at gmail.com> wrote:
> I'm trying to plot isosurfaces from AMRClaw data. I've been able to
> successfully plot slices and projections. Here is the script I'm using for
> isosurfaces:
>
> https://gist.github.com/ketch/30d8bdf41422dc20bb95
>
> (based on
> http://yt-project.org/doc/cookbook/complex_plots.html#plotting-isocontours
> )
>
> I get the following error:
>
> ---------------------------------------------------------------------------
>
> ValueError Traceback (most recent call last)
>
> /Users/ketch/Downloads/plot_yt_amrclaw.py in <module>()
>
> 35 ad = ds.all_data()
>
> 36 surface = ds.h.surface(ad,"q",0.2)
>
> ---> 37 p3dc = Poly3DCollection(surface.triangles, linewidth=0)#,
> linewidth=0.1,alpha=0.9)
>
> 38 colors = yt.apply_colormap((surface["q"]), cmap_name="hot")
>
> 39 p3dc.set_facecolors(colors[0,:,:]/255.)
>
>
> /Users/ketch/anaconda/lib/python2.7/site-packages/yt/data_objects/construction_data_containers.pyc
> in triangles(self)
>
> 1021 def triangles(self):
>
> 1022 if self.vertices is None:
>
> -> 1023 self.get_data()
>
> 1024 vv = np.empty((self.vertices.shape[1]/3, 3, 3),
> dtype="float64")
>
> 1025 for i in range(3):
>
>
> /Users/ketch/anaconda/lib/python2.7/site-packages/yt/data_objects/construction_data_containers.pyc
> in get_data(self, fields, sample_type)
>
> 913 my_verts = self._extract_isocontours_from_grid(
>
> 914 block, self.surface_field,
> self.field_value,
>
> --> 915 mask, fields, sample_type)
>
> 916 if fields is not None:
>
> 917 my_verts, svals = my_verts
>
>
> /Users/ketch/anaconda/lib/python2.7/site-packages/yt/data_objects/construction_data_containers.pyc
> in _extract_isocontours_from_grid(self, grid, field, value, mask,
> sample_values, sample_type)
>
> 933 mask, sample_values = None,
>
> 934 sample_type = "face"):
>
> --> 935 vals = grid.get_vertex_centered_data(field, no_ghost =
> False)
>
> 936 if sample_values is not None:
>
> 937 svals = grid.get_vertex_centered_data(sample_values)
>
>
> /Users/ketch/anaconda/lib/python2.7/site-packages/yt/data_objects/grid_patch.py
> in get_vertex_centered_data(self, field, smoothed, no_ghost)
>
> 289 else:
>
> 290 cg = self.retrieve_ghost_zones(1, field,
> smoothed=smoothed)
>
> --> 291 np.add(new_field, cg[field][1: ,1: ,1: ], new_field)
>
> 292 np.add(new_field, cg[field][:-1,1: ,1: ], new_field)
>
> 293 np.add(new_field, cg[field][1: ,:-1,1: ], new_field)
>
>
> ValueError: operands could not be broadcast together with shapes
> (47,47,47) (48,48,48) (47,47,47)
>
>
> I get the same error if I just ask for surface.triangles.
>
> After a bit of hunting, I found that the whole thing works fine if I set
> smoothed=False in line 290. Any ideas as to why the array size comes out
> wrong?
>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20141111/c578b855/attachment.html>
More information about the yt-users
mailing list