[yt-users] ProjectionPlot of a new field

Sam Skillman samskillman at gmail.com
Mon Feb 24 16:52:54 PST 2014


Hi Geoffrey,

Yes, it would save time to multiply the projection object by a constant
factor if your projection has already been done. However, it is a bit
dangerous to do this since now you need to manually edit how all the
units/labels work out.

I'd suggest just creating a new derived field that uses the
convert_function option (
http://yt-project.org/docs/dev/analyzing/creating_derived_fields.html#field-options).
A good, non-trivial example is the SZY field:
https://bitbucket.org/yt_analysis/yt/src/61e6b84f875cc8fcf25b5b1e67ddd501a19daf68/yt/data_objects/universal_fields.py?at=yt#cl-577

If you do want to manually modify an projection object, you can do
something like the following:

from yt.mods import *
pf = load('IsolatedGalaxy/galaxy0030/galaxy0030')
proj_pw = ProjectionPlot(pf, 0, 'Density', weight_field='Density')
proj_pw.save('before')
proj_pw.data_source['Density'] *= 1.5
proj_pw.refresh()
proj_pw.save('after')

Sam



On Mon, Feb 24, 2014 at 12:26 PM, Geoffrey So <gsiisg at gmail.com> wrote:

> Hi all,
>
> Will I be saving computation time by multiplying some constant conversion
> factors on the projection object instead of creating a derived field with
> an existing field multiplied by the factors?
>
> And how would I go about multiplying the projection by some factors?
>
> If there's no significant saving I'll just do the derived field.
>
> From
>  G.S.
>
> _______________________________________________
> 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/20140224/9c1cde7d/attachment.html>


More information about the yt-users mailing list