[yt-users] gradient field in yt3

Nathan Goldbaum nathan12343 at gmail.com
Thu Aug 13 12:28:17 PDT 2015


On Thu, Aug 13, 2015 at 2:22 PM, Yuan Li <yuan at astro.columbia.edu> wrote:

> Hi all:
>
> I am having trouble creating a gradient field in yt3. What I want is the
> gradient of logP, where logP is defined as:
>
> @derived_field(name="logP",units="")
> def _logP(field,data):
>     return numpy.log(numpy.array(data["gas","pressure"]))
>
> Then I add the gradient field:
>
> pf.add_gradient_fields(("gas","logP"))
>

> which seems to work and I can find it in pf.derived_field_list.
>
> But if I try to use it, I get this error message:
> yt.units.unit_object.UnitParseError: Cannot parse for unit data from '()'.
> Please supply an expression of only Unit, Symbol, Pow, and Mulobjects.
>

Can you pastebin the full traceback?


>
> Is this because logP does not have a unit?
>
> Also, I had another unrelated question about the gradient fields:
> Can I add the gradient fields globally instead of to a specific dataset?
>
>
Not right now, no.


>
> Thanks!
> Yuan
>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20150813/9993779b/attachment.htm>


More information about the yt-users mailing list