[yt-users] defining derived field only for Gas particles
tazkera haque
h.tazkera at gmail.com
Tue Oct 3 20:29:31 PDT 2017
Dear yt community,
I am analyzing some Tipsy data output from Gadget 3. I have three different
particles, Gas, Star and Dark Matter. I want to derive a new field
'PhysicalMass', that will make a unit conversion of code_mass to some
physical mass units. My code so far looks like this:
*import ytfrom yt import derived_field at derived_field(name="PhysicalMass",
units="g")def _PhysicalMass(field, data): M =
data['Gas','Mass']*((5995.*(1e10)*(1.98855e33))/(0.7)) return Mds =
yt.load('snap_p6n36fof_031.bin', n_ref=64)dd= ds.all_data*
My default ('Gas', 'Mass') array looks like this:
*dd['Gas','Mass']*
YTArray([ 9.64448986e-07, 9.64448986e-07, 9.64448986e-07, ...,
9.64448986e-07, 9.64448986e-07, 9.64448986e-07]) code_mass
But when I call the new derived field, it takes some values which does
not correspond to the conversion constants I have multiplied with:
dd['PhysicalMass']
YTArray([ 3.26598467e+74, 3.26598467e+74, 3.26598467e+74, ...,
3.26598467e+74, 3.26598467e+74, 3.26598467e+74]) g
I can directly multiply the ('Gas', 'Mass') array with some conversion
factors to get accurate values, but I need to define a new field for
later calls:
dd['Gas','Mass']*((5995.*(1e10)*(1.98855e33))/(0.7))
So my question is how do I get a new field which will only contain
PhysicalMass from Gas particles. it seems dd['Gas', 'PhysicalMass'] does
not exist.
Thanks very much for your time.
Best
Tazkera
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20171003/d9ee4086/attachment-0001.html>
More information about the yt-users
mailing list