[yt-users] Flush_data_to_grids glitch
Matthew Turk
matthewturk at gmail.com
Sun Jul 6 16:51:48 PDT 2014
On Sun, Jul 6, 2014 at 6:43 PM, David Collins <dcollins4096 at gmail.com> wrote:
> Hi, everybody--
>
> In data_containers.py, around line 2664, there's a routine
> flush_data_to_grids. It seems like the line that says
> "np = pointI[0].ravel().size"
>
> is an error, as np refers to the numpy package. Does that seem right? I
> expect that should be number_of_points, or something?
Yup! Good catch. Want to submit a quick pull request with this fix?
(Also, thanks for kindly not bringing up all the times my shorthand
variable name for "point index" has conflicted with a rather important
constant.)
-Matt
>
> def _flush_data_to_grids(self, field, default_val, dtype='float32'):
> """
> A dangerous, thusly underscored, thing to do to a data object,
> we can flush back any changes in a given field that have been made
> with a default value for the rest of the grid.
> """
> i = 0
> for grid in self._grids:
> pointI = self._get_point_indices(grid)
> np = pointI[0].ravel().size
> if grid.has_key(field):
> new_field = grid[field]
> else:
> new_field = np.ones(grid.ActiveDimensions, dtype=dtype) *
> default_val
> new_field[pointI] = self[field][i:i+np]
> grid[field] = new_field
> i += np
>
>
> --
> -- Sent from a computer.
>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
More information about the yt-users
mailing list