<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(field, data):</font></div><div><font face="monospace, monospace">    return 0.5*data['particle_mass']*data['ParticleVelocityMagnitude']**2</font></div><div><font face="monospace, monospace">add_field("KineticEnergyVMBVcorrParticle", function=_KineticEnergyVMBVcorrParticle, take_log=False, units=r"\rm{erg}" )  </font></div><div><br></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["TotalQuantity"]("KineticEnergyVMBVcorrParticle")</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["TotalQuantity"]("KineticEnergyVMBVcorrParticle")</font></div><div><font face="monospace, monospace">  File "/home/john/yt_new/yt-x86_64/src/yt-hg/yt/data_objects/derived_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/src/yt-hg/yt/data_objects/derived_quantities.py", line 89, in _call_func_lazy</font></div><div><font face="monospace, monospace">    rv = self.func(GridChildMaskWrapper(g, self._data_source), *args, **kwargs)</font></div><div><font face="monospace, monospace">  File "/home/john/yt_new/yt-x86_64/src/yt-hg/yt/data_objects/derived_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/src/yt-hg/yt/data_objects/derived_quantities.py", line 50, in __getitem__</font></div><div><font face="monospace, monospace">    data = self.data_source._get_data_from_grid(self.grid, item)</font></div><div><font face="monospace, monospace">  File "/home/john/yt_new/yt-x86_64/src/yt-hg/yt/data_objects/data_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/src/yt-hg/yt/data_objects/data_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>-- <br><div class="gmail_signature"><div dir="ltr">Reju Sam John</div></div>
</div></div>