Hi Nick.<br><br>I believe the problem is related to the fact that you define the PlotCollection outside of the (for item in field) loop.  Each time you do pc.add_phase_sphere, you are adding another item to the PlotCollection, which contains everything that has been added since it was created.  Thus, when you call pc.save, it is saving each item in the collection.  To remedy this, all you need to do is move the pc = PlotCollection line inside the loop.  Also, adding a "del pc" line at the end of the loop, while probably not totally necessary, couldn't hurt either.<br>
<br>Britton<br><br><div class="gmail_quote">On Thu, Dec 30, 2010 at 4:05 PM, Nicholas Earl <span dir="ltr"><<a href="mailto:earlnich@msu.edu">earlnich@msu.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div style="word-wrap: break-word;">Hey all,<div><br></div><div>I am trying to to have yt load up a data set, and then create phase plots with varying weighted fields like the script below.</div><div><br></div><div>The problem is that when reaches the 'for item in field' loop, after each image output, the loop starts over instead of continuing to the next field... for instance, the output for a series of numbers representing the images would look like this:</div>
<div><br></div><div>1</div><div>1</div><div>2</div><div>1</div><div>2</div><div>3</div><div>1</div><div>2</div><div>3</div><div>4</div><div>etc</div><div><br></div><div>I am not quite sure how to remedy this, so I'm hoping someone could point me in the right direction.</div>
<div><br></div><div>Thanks for your efforts!</div><div>Nicholas Earl</div><div><br></div><blockquote style="margin: 0pt 0pt 0pt 40px; border: medium none; padding: 0px;"><div><div><font face="Menlo" size="2"><span style="font-size: 10px;">from yt.mods import * # set up our namespace</span></font></div>
<div><font face="Menlo" size="2"><span style="font-size: 10px;"><br></span></font></div><div><font face="Menlo" size="2"><span style="font-size: 10px;">#field = ['Temperature','Cooling_Time']</span></font></div>
<div><font face="Menlo" size="2"><span style="font-size: 10px;"><br></span></font></div><div><font face="Menlo" size="2"><span style="font-size: 10px;">field = ['Cooling_Time','Density','Electron_Fraction','Gas_Energy','H2II_Fraction','H2I_Fraction','HII_Fraction','HI_Fraction','HM_Fraction','HeIII_Fraction','HeII_Fraction','HeI_Fraction','Metal_Fraction','Temperature','Total_Energy','x-velocity','y-velocity']</span></font></div>
<div><font face="Menlo" size="2"><span style="font-size: 10px;"><br></span></font></div><div><font face="Menlo" size="2"><span style="font-size: 10px;">for n in range(1,402):</span></font></div><div><font face="Menlo" size="2"><span style="font-size: 10px;">        #for item in field:</span></font></div>
<div><font face="Menlo" size="2"><span style="font-size: 10px;">        pf = load("DD%04i/DD%04i" % (n,n))</span></font></div><div><font face="Menlo" size="2"><span style="font-size: 10px;">        # load dataset</span></font></div>
<div><font face="Menlo" size="2"><span style="font-size: 10px;">        #for item in field:</span></font></div><div><font face="Menlo" size="2"><span style="font-size: 10px;">        pc = PlotCollection(pf, center=[1.0, 0.5, 0.5]) # defaults to center at most dense point</span></font></div>
<div><font face="Menlo" size="2"><span style="font-size: 10px;">        for item in field:</span></font></div><div><font face="Menlo" size="2"><span style="font-size: 10px;">                #value, position = pf.h.find_max("Density")</span></font></div>
<div><font face="Menlo" size="2"><span style="font-size: 10px;">                #print value, position</span></font></div><div><font face="Menlo" size="2"><span style="font-size: 10px;">                pc.add_phase_sphere(10.0, "pc", # how many of which unit at pc.center</span></font></div>
<div><font face="Menlo" size="2"><span style="font-size: 10px;">                        ["Density", "Temperature", "CellMassMsun"], # our fields: x, y, color</span></font></div><div><font face="Menlo" size="2"><span style="font-size: 10px;">                        weight="%s" % (item))# don't take the average value in a cell, just sum them up</span></font></div>
<div><font face="Menlo" size="2"><span style="font-size: 10px;">                #print item</span></font></div><div><font face="Menlo" size="2"><span style="font-size: 10px;">                pc.save('./denstemp_weighted/%s' % (pf))  # save all plots</span></font></div>
</div><div><br></div></blockquote></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>