<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 Britton,
<div><br>
</div>
<div>Just wanted to say thank you for the help. That link was exactly what I needed and have now got my code running.</div>
<div><br>
</div>
<div>Thanks</div>
<div><br>
</div>
<div>Kearn</div>
<div>
<div>
<div>On 1 Dec 2013, at 12:51, Britton Smith <<a href="mailto:brittonsmith@gmail.com">brittonsmith@gmail.com</a>> wrote:</div>
<br class="Apple-interchange-newline">
<blockquote type="cite">
<div dir="ltr">Hi Kearn,
<div><br>
</div>
<div>Have a look at this section in the documentation:</div>
<div><a href="http://yt-project.org/docs/2.6/analyzing/objects.html#processing-objects-derived-quantities">http://yt-project.org/docs/2.6/analyzing/objects.html#processing-objects-derived-quantities</a><br>
</div>
<div><br>
</div>
<div>That should tell you what you need to know.</div>
<div><br>
</div>
<div>Britton</div>
</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">On Sat, Nov 30, 2013 at 11:49 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 Britton,
<div><br>
</div>
<div>Thanks for the reply. Your advice with the region command helped and I now have that working. </div>
<div><br>
</div>
<div>I have tried to implement the commands you suggest to find the average density in side my object, but I don’t really understand how to apply them. Could you elaborate on them?</div>
<div><br>
</div>
<div>Thanks</div>
<div><br>
</div>
<div>Kearn
<div>
<div class="h5"><br>
<div>
<div>On 30 Nov 2013, at 09:23, Britton Smith <<a href="mailto:brittonsmith@gmail.com" target="_blank">brittonsmith@gmail.com</a>> wrote:</div>
<br>
<blockquote type="cite">
<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" target="_blank">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>
_______________________________________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org" target="_blank">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>
</blockquote>
</div>
<br>
</div>
</div>
</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>
_______________________________________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>
http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org<br>
</blockquote>
</div>
<br>
</div>
</body>
</html>