Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from yt.mods import *
- #### define some helper quantities
- def _ColdGasMass(data, Tcold=1e4):
- """
- This function returns the total mass of all cold gas, with T < Tcold.
- """
- gas_mass = data['CellMassMsun']
- gas_temperature = data['Temperature']
- ind = (gas_temperature < Tcold)
- coldgas_mass = gas_mass[ind].sum()
- return coldgas_mass
- def _combColdGasMass(data, coldgas_mass):
- return coldgas_mass.sum()
- add_quantity("ColdGasMass", function=_ColdGasMass, combine_function=_combColdGasMass, n_ret=1)
- pf = load('DD0030/galaxy0030')
- region = pf.h.region((0.5,0.5,0.5),(0.0,0.0,0.0),(1.0,1.0,1.0))
- ColdGasMass = region.quantities['ColdGasMass']()
- print ColdGasMass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement