[yt-dev] [yt_analysis/yt] "RadiusCode" field is ill-defined for periodic domains (issue #531)

Kacper Kowalik issues-reply at bitbucket.org
Tue Mar 19 08:27:09 PDT 2013


--- you can reply above this line ---

New issue 531: "RadiusCode" field is ill-defined for periodic domains
https://bitbucket.org/yt_analysis/yt/issue/531/radiuscode-field-is-ill-defined-for

Kacper Kowalik:

As per ml [thread](http://lists.spacepope.org/pipermail/yt-dev-spacepope.org/2013-March/002979.html) following script:

```
#!python

from yt.mods import *
from yt.testing import *
from yt.data_objects.universal_fields import get_radius
from yt.data_objects.field_info_container import ValidateParameter

@derived_field(name="invrad", validators = [ValidateParameter("center")])
def _invrad(field, data):
    data.set_field_parameter("center", [1.0, 1.0, 1.0])
    return 1.0/data["RadiusCode"]

pf = fake_random_pf(64)
sp = pf.h.sphere([1.0, 1.0, 1.0], 0.25)
r = get_radius(sp, "")

if hasattr(sp, "size"):
    v = 3
    p1 = pf.h.proj("invrad", 0, data_source = sp, style="mip")
    p2 = pf.h.proj("Density", 0, data_source = sp)
else:
    v = 2
    p1 = pf.h.proj(0, "invrad", source = sp, proj_style="mip")
    p2 = pf.h.proj(0, "Density", source = sp)

pw1 = p1.to_pw()
pw1.save("yt_v%s" % v)

pw2 = p2.to_pw()
pw2.set_zlim("Density", 0, 0.32)
pw2.save("yt_v%s" % v)
```
produces ![Bad Density](http://i.imgur.com/mdmJqw6.png) ![Bad invrad](http://i.imgur.com/XmBmHZw.png) while it should yield ![Good Density](http://i.imgur.com/nUffCp2.png) ![Good invrad](http://i.imgur.com/FPISsvy.png)



--

This is an issue notification from bitbucket.org. You are receiving
this either because you are the owner of the issue, or you are
following the issue.



More information about the yt-dev mailing list