<div dir="ltr"><div>Actually I needed some thing like this (<img alt="\eta(\mathcal{M}) \times \frac{1}{2}\rho(\mathcal{M} c_{s})^3 " title="\eta(\mathcal{M}) \times \frac{1}{2}\rho(\mathcal{M} c_{s})^3 " src="http://latex.codecogs.com/gif.latex?%5Cinline%20{%5Ceta(%5Cmathcal{M})%20%5Ctimes%20%5Cfrac{1}{2}%5Crho(%5Cmathcal{M}%20c%5F{s})%5E3%20}" style="vertical-align: -5.8px;"> )  <b><i>where <img alt="\eta(\mathcal{M}) " title="\eta(\mathcal{M}) " src="http://latex.codecogs.com/gif.latex?%5Cinline%20{%5Ceta(%5Cmathcal{M})%20}" style="vertical-align: -5px;"> is a function of <span style="font-size:13px;font-family:arial,sans-serif">"Mach</span></i></b><span style="font-size:13px;font-family:arial,sans-serif"><b><i>Number"</i></b>, <img alt="\rho " title="\rho " src="http://latex.codecogs.com/gif.latex?%5Cinline%20{%5Crho%20}" style="vertical-align: -3.8px;"></span><font face="arial, sans-serif"> is </font><span style="font-family:arial,sans-serif;font-size:13px"> "Density" and <img alt=" c_s " title=" c_s " src="http://latex.codecogs.com/gif.latex?%5Cinline%20{%20c%5Fs%20}" style="vertical-align: -2.9px;">  is "</span><font face="arial, sans-serif">SoundSpeed". </font></div>
<div><span style="font-family:arial,sans-serif"> </span></div><div>can I write some thing like this? </div><div><br></div><span style="font-family:arial,sans-serif;font-size:13px"> newfield(field,data)</span><br style="font-family:arial,sans-serif;font-size:13px">

<div><span style="font-size:13px;font-family:arial,sans-serif"> return new-function(data["MachNumber"</span><span style="font-size:13px;font-family:arial,sans-serif">])*data["any-other-field"]</span> </div>
<div><br></div><div>Please tell me this is possible or not. If not let me know what is the correct syntax? </div><div>
<br></div><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Oct 16, 2013 at 4:25 PM, Matthew Turk <span dir="ltr"><<a href="mailto:matthewturk@gmail.com" target="_blank">matthewturk@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hi Reju,<br>
<br>
Your best bet would be to do this with a derived field; there are some<br>
examples in the docs.  But, as a simple example, this would accomplish<br>
it:<br>
<br>
--<br>
from yt.mods import *<br>
<br>
@derived_field(name = "MyField")<br>
def my_new_field(field, data):<br>
    return data["Density"] * data["Temperature"]<br>
--<br>
<br>
In the docs it mostly uses the function "add_field" rather than<br>
@derived_field, but the result is the same.  This returns Temperature<br>
* Density.  You can then plot "MyField" or ask for it or whatever, and<br>
it will be the result.<br>
<br>
Hope that helps!<br>
<br>
-Matt<br>
<div><div><br>
<br>
On Wed, Oct 16, 2013 at 7:53 PM, Reju Sam John <<a href="mailto:rejusamjohn@gmail.com" target="_blank">rejusamjohn@gmail.com</a>> wrote:<br>
> Dear All,<br>
><br>
> I want to multiply a function of a field in YT (function of  MachNumber )<br>
> with another field in YT. How can I proceed?<br>
><br>
><br>
><br>
> --<br>
> Reju Sam John<br>
><br>
</div></div>> _______________________________________________<br>
> yt-users mailing list<br>
> <a href="mailto:yt-users@lists.spacepope.org" target="_blank">yt-users@lists.spacepope.org</a><br>
> <a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
><br>
_______________________________________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org" target="_blank">yt-users@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">Reju Sam John</div>
</div></div>