[yt-users] Is pc.add_projection("Density", ax) a valid statement ?

Matthew Turk matthewturk at gmail.com
Sat Nov 28 09:29:48 PST 2009


Hi Shankar,

I'm afraid this error is new to me.  The projection unable to find a
field generated by the projection itself, which I've never seen
before.  The code you pasted works for me.

There are two things I can think of to try:

1. delete any *.yt files you can find in the directory
2. change "pc.save(fn)" to "pc.save()"

Other than that, I'm afraid I'm at a loss.  Changing "0" to "ax"
should not have this impact...  Sorry!

-Matt

On Thu, Nov 26, 2009 at 12:06 PM, Agarwal, Shankar <sagarwal at ku.edu> wrote:
> Hi Matt,
>
> Here is the error message...
>
> yt.lagos   INFO       2009-11-26 14:57:00,795 No HDF4 support
> /home/ba01/u118/agarwa23/enzo1/src/yt/doc/yt-x86_64/lib/python2.6/site-packages/IPython/Magic.py:38: DeprecationWarning: the sets module is deprecated
>  from sets import Set
> yt         INFO       2009-11-26 14:58:34,533 Skipping serialization!
> yt         INFO       2009-11-26 14:58:34,534 Caching hierarchy information
> yt         INFO       2009-11-26 14:58:34,615 Getting field ParticleMassMsun from 8
> yt         INFO       2009-11-26 14:58:45,462 Getting field particle_position_x from 8
> yt         INFO       2009-11-26 14:58:49,431 Getting field particle_position_y from 8
> yt         INFO       2009-11-26 14:58:52,990 Getting field particle_position_z from 8
> yt         INFO       2009-11-26 14:58:56,095 Getting field ParticleMassMsun from 8
> yt         INFO       2009-11-26 14:58:58,251 Initializing HOP
> yt         WARNING    2009-11-26 14:58:58,251 No particle_type, no creation_time, so not distinguishing.
> Calling hop... 2097152 1.600e+02
> nSmooth = 65 kd->nActive = 2097152
> Calling regroup...
> No minimum group size specified.  Assuming 10 particles.
> ngroups = 6345
> yt         INFO       2009-11-26 15:00:01,907 Parsing outputs
> yt         INFO       2009-11-26 15:00:02,334 Getting field particle_velocity_x from 8
> yt         INFO       2009-11-26 15:00:09,888 Getting field particle_velocity_y from 8
> yt         INFO       2009-11-26 15:00:15,740 Getting field particle_velocity_z from 8
> yt         INFO       2009-11-26 15:00:22,477 Created plot collection with default plot-center = [0.5, 0.5, 0.5]
> Traceback (most recent call last):
>  File "hop_yt.py", line 20, in <module>
>    p = pc.add_projection("Density", ax)
>  File "/autohome/u118/agarwa23/enzo1/src/yt/yt/raven/PlotCollection.py", line 262, in add_projection
>    return self._add_projection(PlotTypes.ProjectionPlot, *args, **kwargs)
>  File "/autohome/u118/agarwa23/enzo1/src/yt/yt/raven/PlotCollection.py", line 285, in _add_projection
>    center=center, **kwargs)
>  File "/autohome/u118/agarwa23/enzo1/src/yt/yt/lagos/BaseDataTypes.py", line 952, in __init__
>    if self._okay_to_serialize and self.serialize: self._serialize(node_name=self._node_name)
>  File "/autohome/u118/agarwa23/enzo1/src/yt/yt/lagos/BaseDataTypes.py", line 630, in _serialize
>    self._store_fields(self._key_fields, node_name, force)
>  File "/autohome/u118/agarwa23/enzo1/src/yt/yt/lagos/BaseDataTypes.py", line 605, in _store_fields
>    self.hierarchy.save_data(self[field], node_name,
>  File "/autohome/u118/agarwa23/enzo1/src/yt/yt/lagos/BaseDataTypes.py", line 199, in __getitem__
>    self.get_data(key)
>  File "/autohome/u118/agarwa23/enzo1/src/yt/yt/lagos/BaseDataTypes.py", line 1135, in get_data
>    self._get_dependencies(fields), self.hierarchy.queue)
>  File "/autohome/u118/agarwa23/enzo1/src/yt/yt/lagos/ParallelTools.py", line 418, in _get_dependencies
>    deps += ensure_list(fi[field].get_dependencies(pf=self.pf).requested)
>  File "/autohome/u118/agarwa23/enzo1/src/yt/yt/lagos/FieldInfoContainer.py", line 97, in __getitem__
>    raise KeyError(key)
> KeyError: 'py'
>
>
> And here is the code...
>
> from yt.mods import *
> fn = "RedshiftOutput0002"
> pf = load(fn)
> halos = HaloFinder(pf)
> halos.write_out("HopAnalysis.out")
> pc = PlotCollection(pf,center=[0.5,0.5,0.5])
> for ax in range(3):
>    p = pc.add_projection("Density", ax)
>    p.modify["hop_circles"](halos, max_number=None, annotate=True, min_size=400, max_size=100000, font_size=8, print_halo_size=True, print_halo_mass=True, width=None)
> pc.save(fn)
>
>
>
> shankar
>
>
> -----Original Message-----
> From: yt-users-bounces at lists.spacepope.org on behalf of Matthew Turk
> Sent: Thu 11/26/2009 1:54 PM
> To: Discussion of the yt analysis package
> Subject: Re: [yt-users] Is pc.add_projection("Density",ax) a valid statement ?
>
> Hi Shankar,
>
> The code looks okay to me. Can you please send the whole error message
> or run with --paste so that we can see what is going wrong? The
> traceback seems truncated.
>
> Does it work without the hop circles?
>
> -Matt
>
>
>
> On Nov 26, 2009, at 10:57 AM, "Agarwal, Shankar" <sagarwal at ku.edu>
> wrote:
>
>> Hi, In the following code, I am getting an error when I use
>> pc.add_projection("Density", ax). But If I specifically use
>> pc.add_projection("Density", 0) then it runs fine. Any idea ?
>>
>>
>> Code...
>>
>> from yt.mods import *
>> pf = load("RedshiftOutput0002")
>> pc = PlotCollection(pf)
>> for ax in range(3):
>>    p = pc.add_projection("Density", ax)
>>    p.modify["hop_circles"](halos, max_number=None, annotate=True,
>> min_size=0, max_size=100000000, font_size=8, print_halo_size=True,
>> print_halo_mass=True, width=None)
>> pc.save()
>>
>>
>>
>> Error....
>>
>> Traceback (most recent call last):
>>  File "hop_yt.py", line 20, in <module>
>>    p = pc.add_projection("Density", ax)
>>  File "/autohome/u118/agarwa23/enzo1/src/yt/yt/raven/
>> PlotCollection.py", line 262, in add_projection
>>    return self._add_projection(PlotTypes.ProjectionPlot, *args,
>> **kwargs)
>>  File "/autohome/u118/agarwa23/enzo1/src/yt/yt/raven/
>> PlotCollection.py", line 285, in _add_projection
>>    center=center, **kwargs)
>>
>>
>> Shankar
>> KU cosmology
>> _______________________________________________
>> 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
>
>
> _______________________________________________
> 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