Advertisement
Guest User

Untitled

a guest
Jun 19th, 2012
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. from yt.mods import *
  2.  
  3. #### define some helper quantities
  4. def _ColdGasMass(data, Tcold=1e4):
  5. """
  6. This function returns the total mass of all cold gas, with T < Tcold.
  7. """
  8.  
  9. gas_mass = data['CellMassMsun']
  10. gas_temperature = data['Temperature']
  11. ind = (gas_temperature < Tcold)
  12. coldgas_mass = gas_mass[ind].sum()
  13. return coldgas_mass
  14.  
  15. def _combColdGasMass(data, coldgas_mass):
  16. return coldgas_mass.sum()
  17.  
  18. add_quantity("ColdGasMass", function=_ColdGasMass, combine_function=_combColdGasMass, n_ret=1)
  19.  
  20.  
  21. pf = load('DD0030/galaxy0030')
  22. region = pf.h.region((0.5,0.5,0.5),(0.0,0.0,0.0),(1.0,1.0,1.0))
  23. ColdGasMass = region.quantities['ColdGasMass']()
  24. print ColdGasMass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement