[yt-users] izip not defined

Matthew Turk matthewturk at gmail.com
Fri Jan 7 03:21:17 PST 2011


Hi G.S.,

On Thu, Jan 6, 2011 at 7:53 PM,  <gso at physics.ucsd.edu> wrote:
> 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?

Nope, it was a now-fixed import error.

> 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.

I too was seeing these, and I managed to track them down a few weeks
ago.  They come from the detection of available derived fields; I got
rid of one or two, but the remaining issue is with the detection of
the "Radius" field.  They're harmless and won't cause any problems.

-Matt

>
> 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")
>
>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>



More information about the yt-users mailing list