I was wondering if it is possible to specify two different sources of
input to create a derived field. Currently with a single source, I have a
derived field defined as:
def _HII_HFraction(field, data):
And I can access the total quantity in parallel
dd = pf.h.all_data()
But I'm dealing with
pf1 has the HI_Density field data and pf2 has the HII_Density field data.
Is there a way to create a derived field and use TotalQuantity to operate
on the data in parallel?
PS. I guess my alternative is to glue the two HDF5 files into one, but
want to avoid it if possible.
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.