Hi Stephanie,

I think this is because you can't access the zwclump *variable* inside the scope that the cut region is within.  You can try passing it in as a "local" variable by supplying it in the "locals" dictionary, but my *guess* is that unless the j index is also defined it won't work.

On Mon, Jul 20, 2020 at 1:45 PM Stephanie Tonnesen <stonnes@gmail.com> wrote:
Hi yt-users!

I have a list of positions that I call xwclump, ywclump, and zwclump.  I have been selecting regions in a loop using ds.sphere and the center: data_source = ds.sphere([xwclump[j]/(300.*3.086e21),ywclump[j]/(300.*3.086e21),zwclump[j]/(300.*3.086e21)],(1000,'pc'))  (the divisor is to put the center into code units).  This works fine.

But, when I try to use cut_region: data_source = ad.cut_region(["(obj['temperature'] > 1.0e6) & (obj['z'] < (zwclump[j]/(300.*3.086e21)))"]) I get an error: 

NameError: name 'zwclump' is not defined

Is this something anyone else has dealt with?  If it doesn't ring any bells I will try and break IsolatedGalaxy and send the code snippet...

Thanks,
Stephanie

--
Dr. Stephanie Tonnesen
Associate Research Scientist
CCA, Flatiron Institute
New York, NY

stonnes@gmail.com
_______________________________________________
yt-users mailing list -- yt-users@python.org
To unsubscribe send an email to yt-users-leave@python.org
https://mail.python.org/mailman3/lists/yt-users.python.org/
Member address: matthewturk@gmail.com