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
Hi,
Also trying to install yt on the same system, but having problems with
both methods I tried! I tried using the install script I got from the yt
website and it gets a fair way along and then chokes on:
changing mode of /home/wadsley/enzo/yt//bin/2to3 to
775
changing mode of /home/wadsley/enzo/yt//bin/smtpd.py to
775
running
install_egg_info
Writing
/home/wadsley/enzo/yt//lib/python2.6/lib-dynload/Python-2.6.3-py2.6.egg-info
if test -f /home/wadsley/enzo/yt//bin/python -o -h
/home/wadsley/enzo/yt//bin/python; \
then rm -f /home/wadsley/enzo/yt//bin/python;
\
else true;
\
fi
(cd /home/wadsley/enzo/yt//bin; ln python2.6
python)
rm -f
/home/wadsley/enzo/yt//bin/python-config
(cd /home/wadsley/enzo/yt//bin; ln -s python2.6-config
python-config)
Creating directory
/home/wadsley/enzo/yt//share/man/man1
/usr/bin/install -c -m 644 ./Misc/python.man
\
/home/wadsley/enzo/yt//share/man/man1/python.1
abort: clone -r not supported yet for remote
repositories.
abort: repository /home/wadsley/enzo/yt/src/yt-hg/ not
found!
abort: repository /home/wadsley/enzo/yt/src/yt-hg/ not
found!
abort: repository /home/wadsley/enzo/yt/src/yt-hg/ not
found!
/home/wadsley/enzo/yt/bin/python2.6: can't open file
'/home/wadsley/enzo/yt/src/yt-hg//distribute_setup.py': [Errno 2] No
such file or
directory
Then I tried grabbing it via:
hg clone http://hg.enzotools.org/yt/ yt-2
and
python setup.py install
but got:
bash-3.1$ python setup.py install
Downloading http://pypi.python.org/packages/source/d/distribute/distribute-0.6.10.tar.gz
Extracting in /home/wadsley/tmp/tmpQck3di
Now working in /home/wadsley/tmp/tmpQck3di/distribute-0.6.10
Building a Distribute egg in /1/home/wadsley/enzo/yt-2
/1/home/wadsley/enzo/yt-2/distribute-0.6.10-py2.4.egg
Traceback (most recent call last):
File "setup.py", line 73, in ?
setup_package()
File "setup.py", line 33, in setup_package
from numpy.distutils.core import setup
ImportError: No module named numpy.distutils.core
Failure is sad :(
Elizabeth
Hi,
I've got two questions:
(1) Is it possible to change the colors of grid boundaries (produced
with the grids callback), preferably, using different colors
corresponding to refinement levels?
(2) Surely, there must be something to specify the x- and y-range
of slices. Where in the documentation is it explained how to do that?
Best regards,
Wolfram
Hi Molly,
> I'm getting an error when trying to run MergerTree:
> amods.halo_merger_tree.MergerTree(restart_files=files,
> database='/home/molly-ucla/halos.db')
Sorry! That was a careless error on my part. I've just pushed a change (3e99bb6dbb72) that should fix this. Let me know if it doesn't.
Stephen Skory
stephenskory(a)yahoo.com
http://stephenskory.com/
510.621.3687 (google voice)
Hi,
I'm getting an error when trying to run MergerTree:
amods.halo_merger_tree.MergerTree(restart_files=files,
database='/home/molly-ucla/halos.db')
It looks like it runs fine for the first two outputs and then stops:
yt INFO 2010-12-16 09:59:59,440 Parameters:
current_redshift = 85.4105867817
yt INFO 2010-12-16 09:59:59,440 Parameters: omega_lambda
= 0.721
yt INFO 2010-12-16 09:59:59,440 Parameters: omega_matter
= 0.279
yt INFO 2010-12-16 09:59:59,440 Parameters:
hubble_constant = 0.701
Traceback (most recent call last):
File "merger.py", line 10, in <module>
amods.halo_merger_tree.MergerTree(restart_files=files,
database='/home/molly-ucla/halos.db')
File "/home/molly-ucla/yt-x86_64/lib/python2.6/site-packages/yt-2.0dev-py2.6-linux-x86_64.egg/yt/analysis_modules/halo_merger_tree/merger_tree.py",
line 186, in __init__
self._run_halo_finder_add_to_db()
File "/home/molly-ucla/yt-x86_64/lib/python2.6/site-packages/yt-2.0dev-py2.6-linux-x86_64.egg/yt/analysis_modules/halo_merger_tree/merger_tree.py",
line 220, in _run_halo_finder_add_to_db
if self.period == -1:
ValueError: The truth value of an array with more than one element is
ambiguous. Use a.any() or a.all()
Nodes: tcc-2-0
Ideas?
--Molly
Hi all,
As of just now, I've pushed a change to add FreeType2 wrappers to yt,
to enable easier image annotation, particularly from volume rendering.
The function is included in yt.mods, and it's called annotate_image.
(It is documented -- "help(annotate_image)".) This should be the
start of much faster image writing.
There may be issues with compilation on your next update, when you execute:
yt instinfo -u
although I have attempted to guess the paths correctly, and all new
installations using the install script will include FreeType2. If you
run into any issues with this change, please email me directly,
off-list.
-Matt
Hi,
It's not very well documented - or at least I wasn't having luck finding
mention in the docs - how to properly turn on debugging for yt. After some
time digging through the source, I have found that this is handled through
the *logging* module - a standard module, which I am not (but should be)
familiar with.
Anyhow, I have gathered that I can turn on debugging by adding the following
two lines to my ~/.yt/config file:
[yt]
LogFile = True
LogLevel = 0
Is this the recommended usage? Is there an easier way to turn debugging on
for, say, a single iyt or yt invocation via a command line argument?
Chris
Matt,
> I have now opened up derived_quantities and inspected. By searching
> for n_ret=1, which seems to be what you are looking for, I was able to
> identify the AngularMomentumVector quantity also has only one return
> value. In that source code it returns an iterable of length 1. Based
> on this, I am going to suggest:
>
> return [ct.sum(),]
Bingo, that worked. Thanks, also, for the reminder to inspect the source for hints :).
Stephen Skory
stephenskory(a)yahoo.com
http://stephenskory.com/
510.621.3687 (google voice)
Matt,
> But, I think you should be returning ct.sum() from _NumberOfStars.
With only that change to what I previously sent, I get this...
Traceback (most recent call last):
File "analyze.py", line 19, in <module>
print 'total', dd.quantities["NumberOfStars"]()
File "/share/home/00649/tg457850/yt/lib/python2.6/site-packages/yt-2.0dev-py2.6-linux-x86_64.egg/yt/data_objects/derived_quantities.py", line 90, in __call__
return self._call_func_lazy(args, kwargs)
File "/share/home/00649/tg457850/yt/lib/python2.6/site-packages/yt-2.0dev-py2.6-linux-x86_64.egg/yt/data_objects/derived_quantities.py", line 98, in _call_func_lazy
for i in range(self.n_ret): self.retvals[i].append(rv[i])
IndexError: invalid index to scalar variable.
Stephen Skory
stephenskory(a)yahoo.com
http://stephenskory.com/
510.621.3687 (google voice)
Matt,
> You might try printing out what is fed into the combine function; I
> think what you really want to do is return (data["creation_time"] >
> 0).sum() in _NumberOfStars. Inside _combNumberOfStars try printing
> both data and ct, as well, to see if it's an axis problem with the
> combine function.
It appears that for some reason only the first entry of each of the arrays from the grids is being fed into the combine function. The script <http://paste.enzotools.org/show/1411/> outputs <http://paste.enzotools.org/show/1412/>. This sim has 297 grids, which is the size of the ct array in the combine function.
I'm confused...
Stephen Skory
stephenskory(a)yahoo.com
http://stephenskory.com/
510.621.3687 (google voice)