Hi Matt,<br>Many thanks!<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">1) You have to do the derived field before your pf is loaded; this<br>

will hopefully change at some point.  You're also using add_field here<br>
as would normally be done for a profile, but you're using it to define<br>
a new derived field.</blockquote><div> <div>Sorry, i did not explain it very well. Yes, you are very right one has to  add a new derived  field before loading a pf. I used add_field here as i wanted to make use of it for computing profiles at the moment.  <br>

</div>
</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
2) We have "CellMassMsun" and "CellMass" fields already -- which do<br>
what you're looking to do.  You should be able to do exactly what you<br>
are doing,<br></blockquote><div>As you know "CellMass" is not computing the enclosed mass( it does not sum up the mass with in a certian radius) . Prof.add_fields with accumulation flag true computes the enclosed mass radial profile. What i want is to store the computed enclosed mass in a new profile field or variable  so that i can make use of it to compute other profiles like keplerian velocity etc. At the moment i do not know how to store enlcosed mass. That is why  i thought to add a new prof field for this purpose. Does it make sense? Please let me know it is not clear.<br>
Cheers<br>Latif<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
prof.add_fields(["CellMass"], accumulation=True, weight=None)<br></blockquote><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
which will sum from the low bins to the high bins.  I don't think you<br>
need any additional derived fields.<br>
<br>
Does that help?  We'll add a recipe to do this to the cookbook.<br>
<br>
-Matt<br>
<div><div class="h5"><br>
On Thu, Jul 19, 2012 at 7:41 AM, Latif <<a href="mailto:latifne@gmail.com">latifne@gmail.com</a>> wrote:<br>
> Hi Guys,<br>
> I want to compute the enclosed mass for a given radius to make use of it for<br>
> computing other quantities. I would like  to define a new field like<br>
> EnclosedMass. How can i use accumulation flag in combination with new<br>
> defined field to compute the enclosed mass(like in prof.add_fields case).<br>
> Unfortunately, add_field does not accept it. May be there be there is<br>
> another way to do this.  Any help in this regard will appreciated.<br>
><br>
> prof.add_fields("CellMass",weight=None,accumulation=True)<br>
><br>
> def EnclosedMass(field,data):<br>
>     return data["Density"]*data["CellVolume"]<br>
><br>
> add_field("EnclosedMass",<br>
> function=EnclosedMass,weight=None,accumulation=True)<br>
><br>
> Thanks in advance!<br>
> Cheers<br>
> Latif<br>
><br>
</div></div>> _______________________________________________<br>
> yt-users mailing list<br>
> <a href="mailto:yt-users@lists.spacepope.org">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">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>