[yt-users] Particle Angular momentum Profiles
Jun-Hwan Choi
jhchoi at pa.uky.edu
Tue Oct 23 08:19:26 PDT 2012
Hi
I try to calculate the dark matter angular momentum profile using
following routine:
#####################################
import matplotlib.pyplot as plt
import pylab as pl
def _RadiuspcXY(field, data):
center = data.get_field_parameter("center")
DW = data.pf.domain_right_edge - data.pf.domain_left_edge
radius = na.zeros(data["x"].shape, dtype='float64')
for i, ax in enumerate('xy'):
r = na.abs(data[ax] - center[i])
radius += na.minimum(r, na.abs(DW[i]-r))**2.0
na.sqrt(radius, radius)
return radius
def _ConvertRadius(data):
return data.convert("pc")
add_field("RadiuspcXY", function=_RadiuspcXY,
validators=[ValidateParameter("center")],
convert_function = _ConvertRadius, units=r"\rm{pc}",
display_name="RadiusXY")
Nbin = 75
rdisk = 2000
hdisk = 10
pf = load("DD0046/DD0046")
rmin = 2.0*pf.h.get_smallest_dx()*pf.units['pc']]
center = pf.h.find_max("Density")[1]
disk = pf.h.disk(center, [0,0,1], rdisk/pf.units['pc'],
hdisk/pf.units['pc'] )
profile = BinnedProfile1D(disk, Nbin, "Radiuspc", max(rmin), rdisk,
log_space=True, lazy_reader=True, end_collect=False)
profile.add_fields('ParticleSpecificAngularMomentumZ')
plt.plot(profile['RadiuspcXY'], profile['ParticleSpecificAngularMomentumZ'])
And I got the following error message:
yt : [INFO ] 2012-10-23 11:16:00,124 Parameters:
current_time = 4.600008999
yt : [INFO ] 2012-10-23 11:16:00,124 Parameters:
domain_dimensions = [64 64 64]
yt : [INFO ] 2012-10-23 11:16:00,125 Parameters:
domain_left_edge = [ 0. 0. 0.]
yt : [INFO ] 2012-10-23 11:16:00,125 Parameters:
domain_right_edge = [ 1. 1. 1.]
yt : [INFO ] 2012-10-23 11:16:00,126 Parameters:
cosmological_simulation = 0.0
yt : [INFO ] 2012-10-23 11:16:00,138 Getting the binary hierarchy
yt : [INFO ] 2012-10-23 11:16:00,168 Finished with binary hierarchy
reading
yt : [INFO ] 2012-10-23 11:16:00,623 Max Value is 1.55814e-16 at
0.5001935958862305 0.4999227523803749 0.4994192123413048 in grid
EnzoGrid_1396 at level 13 (5, 3, 3)
Traceback (most recent call last):
File "JprofDM.py", line 51, in <module>
profile.add_fields('ParticleSpecificAngularMomentumZ')
File
"/home/jhchoi/common/lib/python2.7/site-packages/yt-2.4-py2.7-linux-x86_64.egg/yt/data_objects/profiles.py",
line 168, in add_fields
self._lazy_add_fields(fields, weight, accumulation)
File
"/home/jhchoi/common/lib/python2.7/site-packages/yt-2.4-py2.7-linux-x86_64.egg/yt/data_objects/profiles.py",
line 108, in _lazy_add_fields
args=args, check_cut=True)
File
"/home/jhchoi/common/lib/python2.7/site-packages/yt-2.4-py2.7-linux-x86_64.egg/yt/data_objects/profiles.py",
line 55, in save_state
tr = func(*args, **kwargs)
File
"/home/jhchoi/common/lib/python2.7/site-packages/yt-2.4-py2.7-linux-x86_64.egg/yt/data_objects/profiles.py",
line 275, in _bin_field
source_data = source_data[mi]
ValueError: too many boolean indices
What can be the problem?
I compute the gas Angular momentum by simply change
ParticleSpecificAngularMomentumZ to SpecificAngularMomentumZ, it works.
As a result, I suspect the way to handle the particles.
Thanks in advance,
Junhwan
--
--------------------------------------------------------------
Jun-Hwan Choi, Ph.D.
Department of Physics and Astronomy, University of Kentucky
Tel: (859) 897-6737 Fax: (859) 323-2846
Email: jhchoi at pa.uky.edu URL: http://www.pa.uky.edu/~jhchoi
--------------------------------------------------------------
More information about the yt-users
mailing list