[yt-users] How to take log of a user defined field ?

Nathan Goldbaum nathan12343 at gmail.com
Tue Aug 18 07:57:12 PDT 2015


On Tue, Aug 18, 2015 at 3:18 AM, Reju Sam John <rejusamjohn at gmail.com>
wrote:

> Hi,
>
> I have a user defined field with the following definition.
>
> def _epsilon(field, data):
>     return (4.0/3.0)*(data['vShock']/data["VelocityMagnitude"])
> add_field("epsilon", function=_epsilon, take_log=False, units=r" " )
>
> Now I would like take ln(1 + data["epsilon"]). I am trying with the
> following definition. Is this the correct way of doing this ?
>
> def _lnepsilon(field, data):
>     return 1 + data["epsilon"]
> add_field("lnepsilon", function=_lnepsilon, *take_log=True*, units=r" " )
>

The take_log keyword argument only affects how the plot is displayed by
default in e.g. . If you want the field to return the logarithm of
1+data['epsilon'], then you should do something like:

def _lnepsilon(field, data):
    return np.log(1 + data['epsilon'])
add_field("lnepsilon", function=_lnepsilon, units="")


>
> Thank you
> --
> Reju Sam John
>
> _______________________________________________
> 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/20150818/155f06b0/attachment.htm>


More information about the yt-users mailing list