[yt-users] izip not defined

gso at physics.ucsd.edu gso at physics.ucsd.edu
Thu Jan 6 19:53:32 PST 2011


My script that called on extract_connected_set is running into a problem
in the 2.0dev version of yt which was fine on my laptop running the old
svn trunk.  It said that izip is not defined.  I looked around the source
code and found some instances of izip, and they all called import before
using it, so I tried to add

from itertools import izip

but that didn't work either.  Am I just doing something wrong
transitioning to 2.0?  In the script, when calling pf.h.all_data(), it
gives me the following:
Warning: invalid value encountered in sqrt
It's an annoyance but does not crash the script.

From
G.S.

Traceback pasted to http://paste.enzotools.org/show/1lxPqc1vtFgggGN3jwPr

script:


from yt.mods import * # set up our namespace
#from itertools import izip
#from yt.lagos.DerivedQuantities import *

def IonizedFraction(field, data):
   return 1-data["HI_Density"]/data["Density"]

add_field("IonizedFraction", function=IonizedFraction,
units=r"\frac{\rho_{HII}}{\rho}")

def NeutralFraction(field, data):
   return data["HI_Density"]/data["Density"]

add_field("NeutralFraction", function=NeutralFraction,
units=r"\frac{\rho_{HI}}{\rho}")

min_output_number = 273
max_output_number = 273
skip = 1

for i in range(min_output_number, max_output_number+1, skip):


    file = "DD%04i" % i

    fn = file+"/"+file

    pf = load(fn)

    field = "IonizedFraction"

    step = 100.0

    dd = pf.h.all_data()

    ion_min = 0.01
    ion_max = 1.0
    num_levels = 1

    new_region = dd.extract_connected_sets(field, num_levels, ion_min,
ion_max)[1][0]

    pf.h.save_object(new_region, file+"_new_region")
    pf.h.save_object(ion_min, file+"_ion_min")





More information about the yt-users mailing list