[yt-users] How to get total quantity of 'Particle Type' in a sphere?
Reju Sam John
rejusamjohn at gmail.com
Mon Sep 5 08:17:15 PDT 2016
Dear All,
I have a user defined field of 'Particle Type' as shown below.
def _KineticEnergyVMBVcorrParticle(field, data):
return 0.5*data['particle_mass']*data['ParticleVelocityMagnitude']**2
add_field("KineticEnergyVMBVcorrParticle",
function=_KineticEnergyVMBVcorrParticle, take_log=False, units=r"\rm{erg}"
)
When I tried to calculate the total quantity of this quantity in a sphere
ke_pari =
sphere_ratio.quantities["TotalQuantity"]("KineticEnergyVMBVcorrParticle")
I am getting the following error.
ke_pari =
sphere_ratio.quantities["TotalQuantity"]("KineticEnergyVMBVcorrParticle")
File
"/home/john/yt_new/yt-x86_64/src/yt-hg/yt/data_objects/derived_quantities.py",
line 82, in __call__
return self._call_func_lazy(args, kwargs)
File
"/home/john/yt_new/yt-x86_64/src/yt-hg/yt/data_objects/derived_quantities.py",
line 89, in _call_func_lazy
rv = self.func(GridChildMaskWrapper(g, self._data_source), *args,
**kwargs)
File
"/home/john/yt_new/yt-x86_64/src/yt-hg/yt/data_objects/derived_quantities.py",
line 705, in _TotalQuantity
if data[field].size < 1:
File
"/home/john/yt_new/yt-x86_64/src/yt-hg/yt/data_objects/derived_quantities.py",
line 50, in __getitem__
data = self.data_source._get_data_from_grid(self.grid, item)
File
"/home/john/yt_new/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py",
line 81, in save_state
tr = func(self, grid, field, *args, **kwargs)
File
"/home/john/yt_new/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py",
line 2661, in _get_data_from_grid
return tr[pointI].ravel()
IndexError: too many indices for array
What could be the reason ?
Thankyou
--
Reju Sam John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20160905/e0d05a2c/attachment.htm>
More information about the yt-users
mailing list