[yt-users] multiply a function of a field with another field

Matthew Turk matthewturk at gmail.com
Wed Oct 16 03:55:08 PDT 2013


Hi Reju,

Your best bet would be to do this with a derived field; there are some
examples in the docs.  But, as a simple example, this would accomplish
it:

--
from yt.mods import *

@derived_field(name = "MyField")
def my_new_field(field, data):
    return data["Density"] * data["Temperature"]
--

In the docs it mostly uses the function "add_field" rather than
@derived_field, but the result is the same.  This returns Temperature
* Density.  You can then plot "MyField" or ask for it or whatever, and
it will be the result.

Hope that helps!

-Matt


On Wed, Oct 16, 2013 at 7:53 PM, Reju Sam John <rejusamjohn at gmail.com> wrote:
> Dear All,
>
> I want to multiply a function of a field in YT (function of  MachNumber )
> with another field in YT. How can I proceed?
>
>
>
> --
> Reju Sam John
>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>



More information about the yt-users mailing list