Hey all,

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.

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:

1
1
2
1
2
3
1
2
3
4
etc

I am not quite sure how to remedy this, so I'm hoping someone could point me in the right direction.

Thanks for your efforts!
Nicholas Earl

from yt.mods import * # set up our namespace

#field = ['Temperature','Cooling_Time']

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']

for n in range(1,402):
        #for item in field:
        pf = load("DD%04i/DD%04i" % (n,n))
        # load dataset
        #for item in field:
        pc = PlotCollection(pf, center=[1.0, 0.5, 0.5]) # defaults to center at most dense point
        for item in field:
                #value, position = pf.h.find_max("Density")
                #print value, position
                pc.add_phase_sphere(10.0, "pc", # how many of which unit at pc.center
                        ["Density", "Temperature", "CellMassMsun"], # our fields: x, y, color
                        weight="%s" % (item))# don't take the average value in a cell, just sum them up
                #print item
                pc.save('./denstemp_weighted/%s' % (pf))  # save all plots