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

Matthew Turk matthewturk at gmail.com
Tue Apr 5 10:11:07 PDT 2011


Hi Junhwan,

This is confusing to me.  Could you run:

yt_lodgeit.py plots.py

and then send me the location that it returns?  I'd like to
investigate your script in detail, and I believe the best way to do
that woul be to replicate it here.

-Matt

On Tue, Apr 5, 2011 at 11:23 AM, Jun-Hwan Choi <jhchoi at pa.uky.edu> wrote:
> Thank you Matthew for quick reply,
>
> I made change from data.pf[Gamma] to data.pf["Gamma"], but it still crash
> with following report:
> yt         INFO       2011-04-05 11:22:35,217 Loaded 501 total data outputs.
> yt         INFO       2011-04-05 11:22:35,224 Parameters: current_time
>        = 0.0
> yt         INFO       2011-04-05 11:22:35,224 Parameters: domain_dimensions
>         = [32, 32, 32]
> yt         INFO       2011-04-05 11:22:35,224 Parameters: domain_left_edge
>        = [ 0.  0.  0.]
> yt         INFO       2011-04-05 11:22:35,225 Parameters: domain_right_edge
>         = [ 1.  1.  1.]
> yt         INFO       2011-04-05 11:22:35,225 Parameters:
> cosmological_simulation   = 0.0
> yt         INFO       2011-04-05 11:22:35,225 Created plot collection with
> default plot-center = [0.5, 0.5, 0.5]
> yt         INFO       2011-04-05 11:22:35,231 Getting the binary hierarchy
> yt         INFO       2011-04-05 11:22:35,236 Finished with binary hierarchy
> reading
> Warning: invalid value encountered in sqrt
> Warning: invalid value encountered in sqrt
> Traceback (most recent call last):
>  File "plots.py", line 25, in <module>
>   pc.add_slice("Temperature", 0)
>  File "/home/jhchoi/common/src/yt-hg/yt/visualization/plot_collection.py",
> line 389, in add_slice
>   center=center, **field_parameters)
>  File "/home/jhchoi/common/src/yt-hg/yt/data_objects/data_containers.py",
> line 732, in __init__
>   self._refresh_data()
>  File "/home/jhchoi/common/src/yt-hg/yt/data_objects/data_containers.py",
> line 267, in _refresh_data
>   self.get_data()
>  File "/home/jhchoi/common/src/yt-hg/yt/data_objects/data_containers.py",
> line 615, in get_data
>   if self._generate_field(field):
>  File "/home/jhchoi/common/src/yt-hg/yt/data_objects/data_containers.py",
> line 638, in _generate_field
>   self.pf.field_info[field].check_available(self)
>  File
> "/home/jhchoi/common/src/yt-hg/yt/data_objects/field_info_container.py",
> line 276, in check_available
>   validator(data)
>  File
> "/home/jhchoi/common/src/yt-hg/yt/data_objects/field_info_container.py",
> line 374, in __call__
>   raise NeedsDataField(doesnt_have)
> yt.data_objects.field_info_container.NeedsDataField: (['Temperature'])
>
> Thank you,
> Junhwan
>
> Matthew Turk wrote:
>>
>> Hi Junhwan,
>>
>> Your definition of the derived field looks okay to me, except that I
>> think you need to do:
>>
>> data.pf["Gamma"]
>>
>> with the quotes around Gamma.  Additionally, it's usually quite
>> helpful to have the crash report when diagnosing issues like these.
>> :)
>>
>> -Matt
>>
>> On Tue, Apr 5, 2011 at 10:54 AM, Jun-Hwan Choi <jhchoi at pa.uky.edu> wrote:
>>
>>>
>>> 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
>>> --------------------------------------------------------------
>>>
>>> _______________________________________________
>>> 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
> --------------------------------------------------------------
>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>



More information about the yt-users mailing list