<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Andrew Myers issued a pull request to fix this: <a href="https://bitbucket.org/yt_analysis/yt/pull-request/488/fix-for-issue-559/diff">https://bitbucket.org/yt_analysis/yt/pull-request/488/fix-for-issue-559/diff</a></div><div><br></div><div>Thanks Andrew!</div><br><div><div>On May 6, 2013, at 4:49 PM, Mark Krumholz <<a href="mailto:krumholz@ucolick.org">krumholz@ucolick.org</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><br>Hi All,<br><br>I just updated to the latest version of yt, hoping that this would be fixed, but it seems not to be: the "TotalMass" function is broken for Orion data, and, from what I can tell, for any data set that doesn't contain dark matter particles. Here's what I get when I try to use it:<br><br>In [1]: pf=load('data.0030.3d.hdf5')<br>yt : [WARNING ] 2013-05-06 16:43:36,339 Setting 1.0 in code units to be 1.0 cm<br>yt : [WARNING ] 2013-05-06 16:43:36,339 No time units. Setting 1.0 = 1 second.<br>yt : [INFO ] 2013-05-06 16:43:36,340 Parameters: current_time = 6.78585436617e+13<br>yt : [INFO ] 2013-05-06 16:43:36,340 Parameters: domain_dimensions = [256 256 256]<br>yt : [INFO ] 2013-05-06 16:43:36,341 Parameters: domain_left_edge = [ -1.68000000e+18 -1.68000000e+18 -1.68000000e+18]<br>yt : [INFO ] 2013-05-06 16:43:36,341 Parameters: domain_right_edge = [ 1.68000000e+18 1.68000000e+18 1.68000000e+18]<br><br>In [2]: dd=pf.h.all_data()<br>^[[Ayt : [INFO ] 2013-05-06 16:43:53,804 Adding unknown field gravitational-potential to list of fields<br><br>In [3]: dd.quantities["TotalMass"]() <br>---------------------------------------------------------------------------<br>KeyError Traceback (most recent call last)<br>/home3/mkrumhol/yt-x86_64/src/yt-hg/scripts/iyt in <module>()<br>----> 1 dd.quantities["TotalMass"]()<br><br>/home3/mkrumhol/yt-x86_64/src/yt-hg/yt/data_objects/derived_quantities.pyc in __call__(self, *args, **kwargs)<br> 90 self._data_source.pf.h.io)<br> 91 if lazy_reader and not self.force_unlazy:<br>---> 92 return self._call_func_lazy(args, kwargs)<br> 93 else:<br> 94 return self._call_func_unlazy(args, kwargs)<br><br>/home3/mkrumhol/yt-x86_64/src/yt-hg/yt/data_objects/derived_quantities.pyc in _call_func_lazy(self, args, kwargs)<br> 97 self.retvals = [ [] for i in range(self.n_ret)]<br> 98 for gi,g in enumerate(self._get_grids()):<br>---> 99 rv = self.func(GridChildMaskWrapper(g, self._data_source), *args, **kwargs)<br> 100 if not iterable(rv): rv = (rv,)<br> 101 for i in range(self.n_ret): self.retvals[i].append(rv[i])<br><br>/home3/mkrumhol/yt-x86_64/src/yt-hg/yt/data_objects/derived_quantities.pyc in _TotalMass(data)<br> 152 """<br> 153 baryon_mass = data["CellMassMsun"].sum()<br>--> 154 particle_mass = data["ParticleMassMsun"].sum()<br> 155 return [baryon_mass + particle_mass]<br> 156 def _combTotalMass(data, total_mass):<br><br>/home3/mkrumhol/yt-x86_64/src/yt-hg/yt/data_objects/derived_quantities.pyc in __getitem__(self, item)<br> 58 def __getitem__(self, item):<br> 59 if item not in self.local_cache:<br>---> 60 data = self.data_source._get_data_from_grid(self.grid, item)<br> 61 self.local_cache[item] = data<br> 62 return self.local_cache[item]<br><br>/home3/mkrumhol/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.pyc in save_state(self, grid, field, *args, **kwargs)<br> 93 old_keys = grid.field_data.keys()<br> 94 grid.field_parameters = self.field_parameters<br>---> 95 tr = func(self, grid, field, *args, **kwargs)<br> 96 grid.field_parameters = old_params<br> 97 grid.field_data = YTFieldData( [(k, grid.field_data[k]) for k in old_keys] )<br><br>/home3/mkrumhol/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.pyc in _get_data_from_grid(self, grid, field)<br> 2643 return np.array([f[i,:][pointI] for i in range(3)])<br> 2644 else:<br>-> 2645 tr = grid[field]<br> 2646 if tr.size == 1: # dx, dy, dz, cellvolume<br> 2647 tr = tr * np.ones(grid.ActiveDimensions, dtype='float64')<br><br>/home3/mkrumhol/yt-x86_64/src/yt-hg/yt/data_objects/grid_patch.pyc in __getitem__(self, key)<br> 155 """<br> 156 if key not in self.field_data:<br>--> 157 self.get_data(key)<br> 158 return self.field_data[key]<br> 159 <br><br>/home3/mkrumhol/yt-x86_64/src/yt-hg/yt/data_objects/grid_patch.pyc in get_data(self, field, convert)<br> 198 else: raise<br> 199 else:<br>--> 200 self._generate_field(field)<br> 201 return self.field_data[field]<br> 202 <br><br>/home3/mkrumhol/yt-x86_64/src/yt-hg/yt/data_objects/grid_patch.pyc in _generate_field(self, field)<br> 145 self[field] = self.pf.field_info[field](self)<br> 146 else: # Can't find the field, try as it might<br>--> 147 raise exceptions.KeyError(field)<br> 148 <br> 149 def has_key(self, key):<br><br>KeyError: 'ParticleMassMsun'<br><br>This isn't a huge deal, because I can use "TotalQuantity" on "Density" as a workaround, but I thought I would report it.<br><br>--<br>Mark Krumholz<br><a href="mailto:krumholz@ucolick.org">krumholz@ucolick.org</a><br><br><br><br><br>_______________________________________________<br>yt-users mailing list<br>yt-users@lists.spacepope.org<br>http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org<br></blockquote></div><br></body></html>