[yt-users] Basic units quesions
Andrew Davis
andrew.davis at yale.edu
Wed Aug 25 06:47:54 PDT 2010
Hi yt users,
I have some basic questions about the units. I'm trying to follow through the
cookbook and help site, but some of it isn't working. Namely, the part about
having it tell me what units some of the fields are in.
When I follow the commands on the page:
http://yt.enzotools.org/doc/howto/objects.html This is what happens:
In: pf=load("EZ2_0000")
In: print(pf.h.field_list)
Out: ['z-velocity', 'Temperature', 'Density', 'particle_velocity_z',
'TotalEnergy', 'Dark_Matter_Density', 'particle_position_z', 'x-velocity',
'particle_position_y', 'y-velocity', 'particle_index', 'particle_position_x',
'particle_mass', 'particle_velocity_x', 'particle_velocity_y']
So, I see DM particle fields, which is what I'm interested in. However, when I
try to find their units, I get:
In: print(pf.field_info["particle_velocity_x"].units)
Out: ---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
/home/adavis/Research/YT/src/yt-1.7-svn/scripts/iyt in <module>()
----> 1
2
3
4
5
AttributeError: 'DerivedField' object has no attribute 'units'
I get the same error for the following fields:
[xyz]-velocity, particle_velocity_[xyz], particle_position_[xyz], Density,
TotalEnergy, Dark_Matter_Density, and particle_index (ok, this shouldn't have
units)
When I try the other method of getting at the units:
pf.field_info["particle_velocity_x"].get_source() , there is nothing there that
says anything about units.
Out: def _Particles(field, data):
io = data.hierarchy.io
if not data.NumberOfParticles > 0:
return na.array([], dtype=dtype)
try:
return io._read_data_set(data, p_field).astype(dtype)
except io._read_exception:
pass
# This is bad. But it's the best idea I have right now.
return data._read_data(p_field.replace("_"," ")).astype(dtype)
And, while field_info["Density"].get_source() works, the same command for
Temperature tells me that the units are g/cm^3, which is obviously wrong.
So, my major question: particle positions seem to be in the [0-1] unit system,
so conversion is simple for them. Particle velocities, however, are unclear.
They look like they're in cm/s, but I'd like to be sure.
thanks!
Andrew
*************************************************************
** Andrew J. Davis andrew.davis at yale.edu **
** Dept. of Astronomy 203-432-5119 **
** Yale University www.astro.yale.edu/adavis **
*************************************************************
More information about the yt-users
mailing list