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

Reju Sam John rejusamjohn at gmail.com
Tue Aug 18 11:32:33 PDT 2015


Thank you very much Nathan...

On Tue, Aug 18, 2015 at 8:27 PM, Nathan Goldbaum <nathan12343 at gmail.com>
wrote:

>
>
> 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
>>
>>
>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
>


-- 
Reju Sam John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20150819/8f54615f/attachment.html>


More information about the yt-users mailing list