[yt-users] Flush_data_to_grids glitch

David Collins dcollins4096 at gmail.com
Sun Jul 6 17:59:18 PDT 2014


I'm not sure if I PR'd that into the right spot, let me know if it should
go somewhere else.

d.


> 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
> >
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>



-- 
-- Sent from a computer.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20140706/885988fc/attachment.html>


More information about the yt-users mailing list