Issue #812: Derived quantities on cut_regions don't work (yt_analysis/yt)
New issue 812: Derived quantities on cut_regions don't work https://bitbucket.org/yt_analysis/yt/issue/812/derived-quantities-on-cut_reg... Nathan Goldbaum: This came up while updating the docs. Take a look at the following test script: ``` #!python from yt.mods import * ds = load("enzo_tiny_cosmology/DD0046/DD0046") ad = ds.all_data() total_mass = ad.quantities.total_mass() # now select only gas with 1e5 K < T < 1e7 K. new_region = ad.cut_region(['obj["temperature"] > 1e5', 'obj["temperature"] < 1e7']) cut_mass = new_region.quantities.total_mass() print "The fraction of mass in this temperature range is %f." % \ (cut_mass / total_mass) ``` Running this on the current `experimental` bookmark returns the following traceback: ``` #!python ERROR: ValueError: too many boolean indices [yt.units.yt_array] Traceback (most recent call last): File "test.py", line 7, in <module> cut_mass = new_region.quantities.total_mass() File "/Users/goldbaum/Documents/yt-hg/yt/data_objects/derived_quantities.py", line 194, in __call__ rv = super(TotalMass, self).__call__(fields) File "/Users/goldbaum/Documents/yt-hg/yt/data_objects/derived_quantities.py", line 163, in __call__ rv = super(TotalQuantity, self).__call__(fields) File "/Users/goldbaum/Documents/yt-hg/yt/data_objects/derived_quantities.py", line 59, in __call__ sto.result = self.process_chunk(ds, *args, **kwargs) File "/Users/goldbaum/Documents/yt-hg/yt/data_objects/derived_quantities.py", line 169, in process_chunk for field in fields] File "/Users/goldbaum/Documents/yt-hg/yt/data_objects/data_containers.py", line 212, in __getitem__ self.get_data(f) File "/Users/goldbaum/Documents/yt-hg/yt/data_objects/selection_data_containers.py", line 696, in get_data self.field_data[field] = self.base_object[field][ind] File "/Users/goldbaum/Documents/yt-hg/yt/units/yt_array.py", line 721, in __getitem__ ret = super(YTArray, self).__getitem__(item) ValueError: too many boolean indices ```
participants (1)
-
Nathan Goldbaum