<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
Hi yt Users
<div><br>
</div>
<div>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.</div>
<div><br>
</div>
<div>When I create a data container using:</div>
<div><br>
</div>
<div>
<div><font color="#0056d6">p6 = load("output_00006/info_00006.txt", fields = ["Density","x-velocity", "y-velocity", "z-velocity", "Pressure"])</font></div>
<div><font color="#0056d6">cen = [0, 0, 0]</font></div>
<div><font color="#0056d6">box = p6.h.region(cen, 0.2/p6['cm'], 0.3/p6['cm’])</font></div>
</div>
<div><font color="#0056d6">print box["Density”]</font></div>
<div><br>
</div>
<div>I get this error:</div>
<div><font color="#e32400"><br>
</font></div>
<div><font color="#e32400">TypeError: 'float' object has no attribute ‘__getitem__'</font></div>
<div><br>
</div>
<div>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:</div>
<div><span style="color: rgb(0, 86, 214);"><br>
</span></div>
<div><font color="#0056d6">sphere = p6.h.sphere(cen, 0.7/p6['cm’])</font></div>
<div><font color="#0061ff">print sphere['AveragedDensity’]</font></div>
<div><br>
</div>
<div> I get this error:</div>
<div><br>
</div>
<div>
<div><font color="#e32400">enerationInProgress                      Traceback (most recent call last)</font></div>
<div><font color="#e32400"><ipython-input-28-574d78c4fb5c> in <module>()</font></div>
<div><font color="#e32400">----> 1 print sphere['AveragedDensity']</font></div>
<div><font color="#e32400"><br>
</font></div>
<div><font color="#e32400">/Applications/Code/yt/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.pyc in __getitem__(self, key)</font></div>
<div><font color="#e32400">    187                 return self.field_data[f]</font></div>
<div><font color="#e32400">    188             else:</font></div>
<div><font color="#e32400">--> 189                 self.get_data(f)</font></div>
<div><font color="#e32400">    190         # Note that this is less succinct so that we can account for the case</font></div>
<div><font color="#e32400">    191         # when there are, for example, no elements in the object.</font></div>
<div><font color="#e32400"><br>
</font></div>
<div><font color="#e32400">/Applications/Code/yt/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.pyc in get_data(self, fields)</font></div>
<div><font color="#e32400">    514             return</font></div>
<div><font color="#e32400">    515         elif self._locked == True:</font></div>
<div><font color="#e32400">--> 516             raise GenerationInProgress(fields)</font></div>
<div><font color="#e32400">    517         # At this point, we want to figure out *all* our dependencies.</font></div>
<div><font color="#e32400">    518         fields_to_get = self._identify_dependencies(fields_to_get)</font></div>
</div>
<div><br>
</div>
<div>Any idea what I am doing wrong or if there is another way to go about this?</div>
<div><br>
</div>
<div>Thanks</div>
<div><br>
</div>
<div>Kearn</div>
</body>
</html>