Hi, 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): ..... return dradius add_field("DiskRadius", function=_DiskRadius) 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) ..... add_field("SubtractBackgroundPotential", function=_SubtractBackgroundPotential) 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? Thank you, Elizabeth
Could you send more of the error trace? In broad strokes, I've
defined fields that I use in the creation of other fields in a similar
manner to what you described and it works fine, so I suspect that it
has something to do with the profile or something subtle in the actual
function definitions.
What's the source you're using for the BinnedProfile1D?
d.
On Wed, Jul 13, 2011 at 6:24 AM, Elizabeth Tasker
Hi,
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): ..... return dradius
add_field("DiskRadius", function=_DiskRadius)
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) .....
add_field("SubtractBackgroundPotential", function=_SubtractBackgroundPotential)
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?
Thank you,
Elizabeth _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
-- Sent from my computer.
Ahh -- based on closer examination under the assumption this should be working fine, it turned out it hated trying to create a profile that started exactly at zero. So, BinnedProfile1D(source, 128, "DiskRadius", 0.1, 16.0) Is all good. Thanks! Elizabeth On Jul 13, 2011, at 11:56 PM, David Collins wrote:
Could you send more of the error trace? In broad strokes, I've defined fields that I use in the creation of other fields in a similar manner to what you described and it works fine, so I suspect that it has something to do with the profile or something subtle in the actual function definitions.
What's the source you're using for the BinnedProfile1D?
d.
On Wed, Jul 13, 2011 at 6:24 AM, Elizabeth Tasker
wrote: Hi,
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): ..... return dradius
add_field("DiskRadius", function=_DiskRadius)
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) .....
add_field("SubtractBackgroundPotential", function=_SubtractBackgroundPotential)
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?
Thank you,
Elizabeth _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
-- Sent from my computer. _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
participants (2)
-
David Collins
-
Elizabeth Tasker