
I agree with Matt,
I think #4 is the cleanest.
Be Well Anthony
On Tue, Jul 23, 2013 at 11:36 AM, Matthew Turk matthewturk@gmail.comwrote:
Hi Doug,
My vote is for number four.
Matt On Jul 23, 2013 9:17 AM, "Douglas Harvey Rudd" drudd@uchicago.edu wrote:
Hi all,
In writing test cases for the slice selector I discovered that the reslice function of YTSliceBase appears to be broken due to caching at several levels.
- the selector object stores the slice coordinate and was never updated
- the grid selection is cached
- the cell mask (created by fill_mask) is only updated when the selector
id changes
I fixed 1) and 2) by overloading the clear_data function in YTSelectionDataContainer:
def clear_data(self): """ Clears out all data from the YTSelectionDataContainer instance,
freeing memory. """ self._selector = None self._current_chunk = None self.field_data.clear()
and replaced the call to self.field_data.clear() in YTSliceBase.reslice with self.clear_data()
This forces the selector to be recreated when it is next requested. Unfortunately the problem persisted, inconsistently, and I tracked it down to 3). The id of the newly created selector was sometimes identical to the one prior to the reslice command. In the grid_patch hierarchy, the cell mask is only recreated if the id of the selector object has changed, and so in this case an old mask persisted.
I see several options for solving the problem:
- replace using the python id function with a random identifier or hash
of the actual selector data, to ensure it detects when the parameters have changed 2) reach into the hierarchy from the clear_data function and erase the cached cell mask 3) add a check in the hierarchy to detect if the chunking has changed along with the selector (not sure how this could be done, but probably a good idea anyway, for consistency) 4) remove the reslice function and prevent selection data containers from changing after creation
Thoughts?
Douglas Rudd Scientific Computing Consultant Research Computing Center drudd@uchicago.edu
yt-dev mailing list yt-dev@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org
yt-dev mailing list yt-dev@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org