<div dir="ltr"><div>Hi folks,<br><br></div>I'm attempting to run yt's clump finding algorithm on a 2D FLASH dataset. Out of the box, following the basic example in the docs, I get the session at the bottom of this email, including an error mentioning an inability to get certain data from ghost zones.<br>
<div><div><br></div><div>I am able to get around this by commenting out the following lines in yt/analysis_modules/level_sets/contour_finder.py <br><br>105 for gi,grid in enumerate(grids):<br>106 pbar.update(gi)<br>
107 cg = grid.retrieve_ghost_zones(1, "tempContours", smoothed=False)<br>108 grid_set.update(set(cg._grids))<br>109 fd = cg["tempContours"].astype('int64')<br>110 boundary_tree = amr_utils.construct_boundary_relationships(fd)<br>
111 tree.update(((a, b) for a, b in boundary_tree))<br><br></div><div>which I assume simply allows the code to ignore the ghost zones (which - wild speculation - maybe yt expects to exist in the 3rd dimension but don't?). My questions are: <br>
</div><div>1) Is this likely to have ill effects? (with this change find_clumps() appears to work, but I haven't inspected the results closely enough to know if they're reasonable).<br></div><div>2) Is there a different recommended fix?<br>
<br></div><div>Thank you,<br>John<br></div><div> <br></div><div><br><br><br><br><br>In [1]: from yt.analysis_modules.level_sets.api import *<br><br>In [2]: field="Density"<br><br>In [3]: step=2.0<br><br>In [4]: data_source=pf.h.all_data()<br>
yt : [WARNING ] 2013-07-03 15:22:06,608 Dimensionality less than 3: reverting to overlap_proj<br><br>In [5]: cmin = 10**np.floor(np.log10(data_source[field]).min())<br>yt : [INFO ] 2013-07-03 15:22:24,519 Getting field dens from 7872<br>
<br>In [6]: cmax = 10**np.floor(np.log10(data_source[field]).max()+1)<br><br>In [7]: function='self.data["Density"].size>20'<br><br>In [8]: master_clump = Clump(data_source,None,field,function=function)<br>
<br>In [9]: find_clumps(master_clump,cmin,cmax,step)<br>Finding clumps: min: 1.000000e-28, max: 1.000000e-24, step: 2.000000<br>yt : [ERROR ] 2013-07-03 15:23:23,911 Covering problem: 190 cells are uncovered<br>---------------------------------------------------------------------------<br>
KeyError Traceback (most recent call last)<br>/home/jforbes/yt-x86_64/src/yt-hg/yt/mods.pyc in <module>()<br>----> 1 find_clumps(master_clump,cmin,cmax,step)<br><br>/home/jforbes/yt-x86_64/src/yt-hg/yt/analysis_modules/level_sets/clump_handling.pyc in find_clumps(clump, min_val, max_val, d_clump)<br>
177 print "Finding clumps: min: %e, max: %e, step: %f" % (min_val, max_val, d_clump)<br> 178 if min_val >= max_val: return<br>--> 179 clump.find_children(min_val)<br> 180 <br> 181 if (len(clump.children) == 1):<br>
<br>/home/jforbes/yt-x86_64/src/yt-hg/yt/analysis_modules/level_sets/clump_handling.pyc in find_children(self, min_val, max_val)<br> 118 if max_val is None: max_val = self.max_val<br> 119 contour_info = identify_contours(self.data, self.field, min_val, max_val,<br>
--> 120 self.cached_fields)<br> 121 for cid in contour_info:<br> 122 new_clump = self.data.extract_region(contour_info[cid])<br><br>/home/jforbes/yt-x86_64/src/yt-hg/yt/analysis_modules/level_sets/contour_finder.py in identify_contours(data_source, field, min_val, max_val, cached_fields)<br>
105 for gi,grid in enumerate(grids):<br> 106 pbar.update(gi)<br>--> 107 cg = grid.retrieve_ghost_zones(1, "tempContours", smoothed=False)<br> 108 grid_set.update(set(cg._grids))<br>
109 fd = cg["tempContours"].astype('int64')<br><br>/home/jforbes/yt-x86_64/src/yt-hg/yt/data_objects/grid_patch.pyc in retrieve_ghost_zones(self, n_zones, fields, all_levels, smoothed)<br> 477 level, new_left_edge, **kwargs)<br>
478 else:<br>--> 479 cube = self.hierarchy.covering_grid(level, new_left_edge, **kwargs)<br> 480 <br> 481 return cube<br><br>/home/jforbes/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.pyc in __init__(self, level, left_edge, dims, fields, pf, num_ghost_zones, use_pbar, **kwargs)<br>
3712 self.domain_width = np.rint((self.pf.domain_right_edge -<br> 3713 self.pf.domain_left_edge)/self.dds).astype('int64')<br>-> 3714 self._refresh_data()<br> 3715 <br>
3716 def _get_list_of_grids(self, buffer = 0.0):<br><br>/home/jforbes/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.pyc in _refresh_data(self)<br> 3729 <br> 3730 def _refresh_data(self):<br>-> 3731 AMR3DData._refresh_data(self)<br>
3732 self['dx'] = self.dds[0] * np.ones(self.ActiveDimensions, dtype='float64')<br> 3733 self['dy'] = self.dds[1] * np.ones(self.ActiveDimensions, dtype='float64')<br><br>
/home/jforbes/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.pyc in _refresh_data(self)<br> 318 """<br> 319 self.clear_data()<br>--> 320 self.get_data()<br> 321 <br>
322 def keys(self):<br><br>/home/jforbes/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.pyc in get_data(self, fields)<br> 3773 n_bad = np.where(self[obtain_fields[0]]==-999)[0].size<br> 3774 mylog.error("Covering problem: %s cells are uncovered", n_bad)<br>
-> 3775 raise KeyError(n_bad)<br> 3776 <br> 3777 def _generate_field(self, field):<br><br>KeyError: 190<br><br></div></div></div>