<div dir="ltr">Hi Nathan<div>Thank you very much.  You correctly figure out the mistake. 😊😊😊 </div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Sep 6, 2016 at 8:38 PM, Nathan Goldbaum <span dir="ltr"><<a href="mailto:nathan12343@gmail.com" target="_blank">nathan12343@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Mon, Sep 5, 2016 at 10:17 AM, Reju Sam John <span dir="ltr"><<a href="mailto:rejusamjohn@gmail.com" target="_blank">rejusamjohn@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Dear All, <div><br></div><div>I have a user defined field of  'Particle Type' as shown below.</div><div><br></div><div><font face="monospace, monospace">def _KineticEnergyVMBVcorrParticle<wbr>(field, data):</font></div><div><font face="monospace, monospace">    return 0.5*data['particle_mass']*data<wbr>['ParticleVelocityMagnitude']*<wbr>*2</font></div><div><font face="monospace, monospace">add_field("KineticEnergyVMBVco<wbr>rrParticle", function=_KineticEnergyVMBVcor<wbr>rParticle, take_log=False, units=r"\rm{erg}" )  </font></div></div></blockquote><div><br></div></span><div>Hi Reju,</div><div><br></div><div>I think you just need to specify particle_type=True in the add_field call above.</div><div><br></div><div>-Nathan </div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><div dir="ltr"><div></div><div>When I tried to calculate the total quantity of this quantity in a sphere <br><br><font face="monospace, monospace">ke_pari = sphere_ratio.quantities["Total<wbr>Quantity"]("KineticEnergyVMBVc<wbr>orrParticle")</font></div><div><br></div><div>I am getting the following error.</div><div> <br clear="all"><div><div> <font face="monospace, monospace">   ke_pari = sphere_ratio.quantities["Total<wbr>Quantity"]("KineticEnergyVMBVc<wbr>orrParticle")</font></div><div><font face="monospace, monospace">  File "/home/john/yt_new/yt-x86_64/s<wbr>rc/yt-hg/yt/data_objects/deriv<wbr>ed_quantities.py", line 82, in __call__</font></div><div><font face="monospace, monospace">    return self._call_func_lazy(args, kwargs)</font></div><div><font face="monospace, monospace">  File "/home/john/yt_new/yt-x86_64/s<wbr>rc/yt-hg/yt/data_objects/deriv<wbr>ed_quantities.py", line 89, in _call_func_lazy</font></div><div><font face="monospace, monospace">    rv = self.func(GridChildMaskWrapper<wbr>(g, self._data_source), *args, **kwargs)</font></div><div><font face="monospace, monospace">  File "/home/john/yt_new/yt-x86_64/s<wbr>rc/yt-hg/yt/data_objects/deriv<wbr>ed_quantities.py", line 705, in _TotalQuantity</font></div><div><font face="monospace, monospace">    if data[field].size < 1:</font></div><div><font face="monospace, monospace">  File "/home/john/yt_new/yt-x86_64/s<wbr>rc/yt-hg/yt/data_objects/deriv<wbr>ed_quantities.py", line 50, in __getitem__</font></div><div><font face="monospace, monospace">    data = self.data_source._get_data_fro<wbr>m_grid(self.grid, item)</font></div><div><font face="monospace, monospace">  File "/home/john/yt_new/yt-x86_64/s<wbr>rc/yt-hg/yt/data_objects/data_<wbr>containers.py", line 81, in save_state</font></div><div><font face="monospace, monospace">    tr = func(self, grid, field, *args, **kwargs)</font></div><div><font face="monospace, monospace">  File "/home/john/yt_new/yt-x86_64/s<wbr>rc/yt-hg/yt/data_objects/data_<wbr>containers.py", line 2661, in _get_data_from_grid</font></div><div><font face="monospace, monospace">    return tr[pointI].ravel()</font></div><div><font face="monospace, monospace">IndexError: too many indices for array</font></div></div><div><br></div><div>What could be the reason ?</div><div><br></div><div>Thankyou </div><span><font color="#888888">-- <br><div><div dir="ltr">Reju Sam John</div></div>
</font></span></div></div>
<br></span>______________________________<wbr>_________________<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" rel="noreferrer" target="_blank">http://lists.spacepope.org/lis<wbr>tinfo.cgi/yt-users-spacepope.<wbr>org</a><br>
<br></blockquote></div><br></div></div>
<br>______________________________<wbr>_________________<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" rel="noreferrer" target="_blank">http://lists.spacepope.org/<wbr>listinfo.cgi/yt-users-<wbr>spacepope.org</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Reju Sam John</div></div>
</div>