[yt-users] getting the average density inside a data container
k.grisdale at surrey.ac.uk
k.grisdale at surrey.ac.uk
Fri Nov 29 23:12:26 PST 2013
Hi yt Users
I am trying to create a data container that is a cube from which I can extract the average density of the gas inside the cube. I am using Ramses data.
When I create a data container using:
p6 = load("output_00006/info_00006.txt", fields = ["Density","x-velocity", "y-velocity", "z-velocity", "Pressure"])
cen = [0, 0, 0]
box = p6.h.region(cen, 0.2/p6['cm'], 0.3/p6['cm’])
print box["Density”]
I get this error:
TypeError: 'float' object has no attribute ‘__getitem__'
I have tried creating a sphere as a data container and this works for the Density, but then when I try to take the AverageDensity in the sphere:
sphere = p6.h.sphere(cen, 0.7/p6['cm’])
print sphere['AveragedDensity’]
I get this error:
enerationInProgress Traceback (most recent call last)
<ipython-input-28-574d78c4fb5c> in <module>()
----> 1 print sphere['AveragedDensity']
/Applications/Code/yt/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.pyc in __getitem__(self, key)
187 return self.field_data[f]
188 else:
--> 189 self.get_data(f)
190 # Note that this is less succinct so that we can account for the case
191 # when there are, for example, no elements in the object.
/Applications/Code/yt/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.pyc in get_data(self, fields)
514 return
515 elif self._locked == True:
--> 516 raise GenerationInProgress(fields)
517 # At this point, we want to figure out *all* our dependencies.
518 fields_to_get = self._identify_dependencies(fields_to_get)
Any idea what I am doing wrong or if there is another way to go about this?
Thanks
Kearn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20131130/0651cbd4/attachment.htm>
More information about the yt-users
mailing list