[yt-dev] Issue #961: total mass quantity called on a clump breaks subsequent data selection (yt_analysis/yt)

Nathan Goldbaum issues-reply at bitbucket.org
Wed Dec 17 12:39:14 PST 2014


New issue 961: total mass quantity called on a clump breaks subsequent data selection
https://bitbucket.org/yt_analysis/yt/issue/961/total-mass-quantity-called-on-a-clump

Nathan Goldbaum:

The following script:


```
#!python

import numpy as np

import yt
from yt.analysis_modules.level_sets.api import *

ds = yt.load("IsolatedGalaxy/galaxy0030/galaxy0030")

data_source = ds.disk([0.5, 0.5, 0.5], [0., 0., 1.], 
                      (8, 'kpc'), (1, 'kpc'))

field = ("gas", "density")

step = 2.0

c_min = 10**np.floor(np.log10(data_source[field]).min()  )
c_max = 10**np.floor(np.log10(data_source[field]).max()+1)

master_clump = Clump(data_source, field)

master_clump.add_validator("min_cells", 20)

find_clumps(master_clump, c_min, c_max, step)

leaf_clumps = get_lowest_clumps(master_clump)

clump = leaf_clumps[3]

print clump['density']

try:
    clump.quantities.total_mass()
except Exception as e:
    print e

print clump['density']

```

will print out


```
#!python

[  7.07273796e-24   6.71093874e-24   6.95491269e-24   6.82937561e-24
   6.80951625e-24   6.57924229e-24   7.29300493e-24   7.07554671e-24
   7.30696998e-24   7.55819187e-24   7.65949253e-24   6.95166906e-24
   7.52178995e-24   7.07804069e-24   6.73055650e-24   7.13322789e-24
   7.65117396e-24   7.31980022e-24   7.29300148e-24   7.06273581e-24
   7.00048981e-24   7.11120382e-24   6.79811352e-24   6.67183093e-24
   7.16742091e-24   7.36740952e-24   7.14456988e-24   7.34582239e-24
   6.71862846e-24   7.32380039e-24   7.49710554e-24   6.95885833e-24
   6.82522495e-24   6.91253709e-24   7.12972196e-24   6.76674443e-24
   6.97601938e-24   7.56780126e-24   7.45219661e-24   7.33906110e-24
   7.06027220e-24   6.85427194e-24   6.74850585e-24   7.30664210e-24
   6.73289034e-24   7.46033156e-24   7.15491925e-24   7.32940616e-24
   7.13456220e-24   6.72901856e-24] g/cm**3
Can't mix particle/discrete and fluid/mesh conditions or
               quantities.  Field: ('all', 'particle_mass') and Conditions specified:
            obj['contours_3ed9f4d5c4c8464d85b336044c891112'] == 18
[] g/cm**3
```

h/t to @dcollins4096 for reporting this on the mailing list.


_______________________________________________
yt-dev mailing list
yt-dev at lists.spacepope.org
http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org




More information about the yt-dev mailing list