<div dir="ltr">Hi Kearn,<div><br></div><div>I believe the issue with the region is that the arguments are center, left corner, right corner. Each of those needs to be a triple.</div><div><br></div><div>On the other issue, is AveragedDensity a field you created? If not, I don't believe it exists. If you want to take the average inside some object, you should do something like:</div>
<div>object.quantities["WeightedAverageQuantity"](field, weight_field)</div><div><br></div><div>Britton</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Nov 30, 2013 at 7:12 AM, <span dir="ltr"><<a href="mailto:k.grisdale@surrey.ac.uk" target="_blank">k.grisdale@surrey.ac.uk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word">
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>
</div>
<br>_______________________________________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
<br></blockquote></div><br></div>