I am trying to use the derived quantity, 'TotalQuantity', to count the
number of cells included in my cut_region as follows:
cut = dd.cut_region(["grid['x'] > 0.5"])
numberCells = cut.quantities['TotalQuantity']('Ones')
#Totals a 'one' for each cell, which gives the total number of cells being
This works fine when I have plenty of cells to split up between 84
processors (or when there are exactly zero cells in the cut), but when there
is a small number of cells in the cut (<~300), I get erroneous (way too
large) random values like 1.e18 or -4.2e17. I know there are cells in the
cut because I don't get a 'nan' when I calculate a 'WeightedAverageQuantity'
value. I have tried to use "cut['Density'].size" to get the number of cells,
but I get killed by the OOM Killer. My original data set has 1024^3 cells
and I am running on Kraken with 84 processors.
I'm not sure where this is actually a yt question or a python one...
I'm trying to create a slice of a new field that consists of the PotentialField (in the raw Enzo output) minus the background value, created by the profile tool.
I have two functions that I created to do this:
def _DiskRadius(field, data):
That returns the value of the radius in the disk plane and
def _SubtractBackgroundPotential(field, data):
profile = BinnedProfile1D(source, 128, "DiskRadius", 0.0, 16.0)
which uses the first function to create a profile as a function of disk radius.
then I have:
p = pc.add_slice("SubtractBackgroundPotential", 2)
Except that yt fails inside def _SubtractBackgroundPotential(field, data) because it can't find DiskRadius:
---> 23 profile = BinnedProfile1D(source, 128, "DiskRadius", 0.0, 16.0)
Could anyone tell me how to get function 2 recognizing function 1?
I've tried to get the hg version of yt working on my Mac Book Pro (OS X 10.6.8) using EPD Python 7.1., however unsuccessfully. I chose the development version
hg up -C yt
and performed the installation by using 'python setup.py install', and everything seemed to work fine (I captured the screen output in install_log.txt, attached). However, trying to import yt.mods gives the following error:
Enthought Python Distribution -- www.enthought.com
Version: 7.1-1 (32-bit)
Python 2.7.2 |EPD 7.1-1 (32-bit)| (default, Jul 3 2011, 15:40:35)
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
Type "packages", "demo" or "enthought" for more information.
>>> from yt.mods import *
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "yt/mods.py", line 45, in <module>
from yt.data_objects.api import \
File "yt/data_objects/api.py", line 34, in <module>
from hierarchy import \
File "yt/data_objects/hierarchy.py", line 39, in <module>
from yt.utilities.io_handler import io_registry
File "yt/utilities/io_handler.py", line 28, in <module>
import yt.utilities.amr_utils as au
ImportError: No module named amr_utils
Many thanks in advance for your help!
I'm trying to create a profile object of the density in my disk as a function of radius. I don't actually want to plot it; I just need to grab an average to use as a background value elsewhere.
I think I've almost got it:
source = pf.h. disk((16,16,16), (0,0,1), 12, 15.6e-3/pf['kpc'])
profile = BinnedProfile1D(source, 128, "RadiusCode", 0.5, 12.0)
I just have a couple of questions:
1. Is there a way to print out the radial bins being used? i.e. the value at the centre of each bin?
2. RadiusCode is going to be the 3d radius, is that true? I can create my own variable for the in-disk radius, but is there a quantity already in yt for that to use with the disk profile?
In a fit of impatience born of being in the wrong time zone, can I wave this at people again? :)
On 2011-07-09, at 6:23 PM, Elizabeth Tasker wrote:
> Hi all,
> I'm trying to create a profile object of the density in my disk as a function of radius. I don't actually want to plot it; I just need to grab an average to use as a background value elsewhere.
> I think I've almost got it:
> source = pf.h. disk((16,16,16), (0,0,1), 12, 15.6e-3/pf['kpc'])
> profile = BinnedProfile1D(source, 128, "RadiusCode", 0.5, 12.0)
> profile.add_fields("CellMass", weight="CellVolume")
> print profile["CellMass"]
> I just have a couple of questions:
> 1. Is there a way to print out the radial bins being used? i.e. the value at the centre of each bin?
> 2. RadiusCode is going to be the 3d radius, is that true? I can create my own variable for the in-disk radius, but is there a quantity already in yt for that to use with the disk profile?
> Thank you~
> yt-users mailing list
I'd like to create a bunch of slices of the same field, but with different options (width, modifiers etc). Is it possible to change the file name yt saves the plots under so:
Doesn't get over-written with each one?
I have a dumb question about the contents of the _data member of a
BinnedProfile2D. I feel like I may have asked this question before,
but I didn't see it in my archive, sorry if this is a dumb one.
Why is the size of the Z array the same as Xbins \cross Ybins? For
instance, I asked for 512 bins in both X and Y between X1,X2 and
Y1,Y2. This gives me 513 bins in the Xbins array, as I expect (same
for Y). But the Z array is also 513x513. My assumption has been that
in Zarrray[I,J] is the value of Zvalue with Xbins[I] < Xvalue <
Xbins[I+1], but that should give me 512 bins for the Z array. What's
the extra bin for?
Sent from my computer.
I have a loop that goes over a list of filenames I've generated, loads parameter files for them, passes each pf object to a procedure which grabs data from the file, and then loops back over. After the first iteration, I get this crash:
Traceback (most recent call last):
File "/local/data/duce2/zuhone/src/ctools/filter_particle_velocities.py", line 91, in <module>
File "/local/data/duce2/zuhone/src/ctools/filter_particle_velocities.py", line 68, in main
compute_turb_vels(pf, numVelCells, xp, yp, zp, vxp, vyp, vzp)
File "/local/data/duce2/zuhone/src/ctools/compute_turb_vels.py", line 15, in compute_turb_vels
leaf_grids = [g for g in pf.h.grids if len(g.Children) == 0]
File "/local/data/duce2/zuhone/opt/yt-x86_64/src/yt-hg/yt/data_objects/static_output.py", line 163, in hierarchy
File "/local/data/duce2/zuhone/opt/yt-x86_64/src/yt-hg/yt/frontends/flash/data_structures.py", line 73, in __init__
self._handle = h5py.File(self.hierarchy_filename)
File "/local/data/duce2/zuhone/opt/yt-x86_64/lib/python2.7/site-packages/h5py-1.3.1-py2.7-linux-x86_64.egg/h5py/highlevel.py", line 797, in __init__
self.fid = self._generate_fid(name, mode, plist)
File "/local/data/duce2/zuhone/opt/yt-x86_64/lib/python2.7/site-packages/h5py-1.3.1-py2.7-linux-x86_64.egg/h5py/highlevel.py", line 842, in _generate_fid
fid = h5f.create(name, h5f.ACC_EXCL, fapl=plist)
File "h5f.pyx", line 87, in h5py.h5f.create (h5py/h5f.c:1378)
h5py._stub.IOError: File exists (File accessability: Unable to open file)
It does not matter where in the list of files I start, so it's not due to a single bad file. It's like it doesn't detect the file it's trying to read somehow, so it tries to create it, but then it finds out it already exists, and then aborts. Very odd.