[yt-users] Flush_data_to_grids glitch
Matthew Turk
matthewturk at gmail.com
Sun Jul 6 18:09:28 PDT 2014
That worked great! And it's in.
On Jul 6, 2014 7:59 PM, "David Collins" <dcollins4096 at gmail.com> wrote:
>
> 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.
>
> _______________________________________________
> 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/20140706/e3da4e35/attachment.html>
More information about the yt-users
mailing list