[yt-users] Question about visualization of the derived Fields

Jun-Hwan Choi jhchoi at pa.uky.edu
Tue Apr 5 07:54:30 PDT 2011


Thank you David and Matthew,

I have looked the yt webpage about derived Field.
But, I can not find where in the script the definition goes.
For example I wrote the script to make slice as follow
------------------------------------------------
from yt.mods import *
from yt.analysis_modules.api import EnzoSimulation
import matplotlib.pylab as pylab

def _Temperature(field, data):
    DEFAULT_MU = 0.6
    return data["Gas_Energy"]*(data.pf[Gamma]-1)*DEFAULT_MU
add_field("Temperature", function=_Temperature)

es = EnzoSimulation("RotatingSphere.enzo", initial_time=0.0, final_time=50.)

time = []
i = 0
for output in es.allOutputs:
    # load up a dataset
    pf = load(output['filename'])


    # calculate the time of output
    time.append(0.1*i)
    i = i + 1

    # create density slices
    pc = PlotCollection(pf, center=[0.5,0.5,0.5])
    pc.add_slice("Temperature", 0)
    pc.add_slice("Temperature", 2)
    pc.save("t%05.2f" % time[i-1])
--------------------------------------------------------------------
But this python script crashed.
How and where can I define new field in the script?

Thank you
Junhwan


Matthew Turk wrote:
> Hi Junhwan,
>
> David wrote back earlier to your first email:
>
> http://lists.spacepope.org/pipermail/yt-users-spacepope.org/2011-April/001328.html
>
> Best,
>
> Matt
>
> On Mon, Apr 4, 2011 at 10:19 PM,  <jhchoi at pa.uky.edu> wrote:
>   
>> Hi YT uses,
>>
>> I would like to know how make slice, projection, or volume rendering plots
>> for derived Fields.
>> For example, my enzo simulation output only has gas_energy (no temperature
>> field in grid data) and I would like to make temperature map with add_slice,
>> simply write add_slice("Temperature", 0) causes an error.
>> Is there any way this visualization can be done with derived Field?
>>
>> Thank you,
>> Junhwan
>>
>> --
>> --------------------------------------------------------------
>> Jun-Hwan Choi, Ph.D.
>> Department of Physics and Astronomy, University of Kentucky
>> Tel: (859) 897-6737        Fax: (859) 323-2846
>> Email: jhchoi at pa.uky.edu   URL: http://www.pa.uky.edu/~jhchoi
>> --------------------------------------------------------------
>>
>> ----------------------------------------------------------------
>> This message was sent using IMP, the Internet Messaging Program.
>>
>> _______________________________________________
>> 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
>   


-- 
--------------------------------------------------------------
Jun-Hwan Choi, Ph.D.
Department of Physics and Astronomy, University of Kentucky
Tel: (859) 897-6737        Fax: (859) 323-2846
Email: jhchoi at pa.uky.edu   URL: http://www.pa.uky.edu/~jhchoi
--------------------------------------------------------------




More information about the yt-users mailing list