[yt-users] Camera & HomogenizedVolume

Matthew Turk matthewturk at gmail.com
Tue Nov 23 14:30:28 PST 2010


Hi Stella,

It looks to me like the amr_kdtree did not, in fact, retain API
compatibility with the old mechanism for grid homogenization.  I took
have seen segfaults from the casting segment, but I believed them to
be a result of a poor choice in field tables, as I was actually
projecting some odd derived quantities.  Evidently this was not the
case, and there is an underlying problem.

To work around this, I suggest you use the old version.  To do this,
you can either supply a volume (using HomogenizedVolume, as in the
past) or supply the keyword argument use_kd=False when creating the
camera object.  The latter is probably easier.

Let me know if this *still* gives you problems.  I'm sorry that this
has been a hassle.

-Matt

On Tue, Nov 23, 2010 at 4:30 PM, Stella Offner <soffner at cfa.harvard.edu> wrote:
> Hi Matt,
>
> Thanks, again!  Now a new error: I called camera with a log_fields argument,
> but it seems that kd tree code does not recognize this. Sadly, if I bi-pass
> this by not using the log field, the code seg faults right after 'About to
> cast'. This last thing could just be my script. Anyway, I'm using the
> latest, rather than the stable version, which maybe I should use instead.
>
>
> AttributeError                            Traceback (most recent call last)
>
> /n/home05/soffner/yt-x86_64/src/yt-hg/scripts/iyt in <module>()
>    140                 cam.zoom(1.0)
>    141     #take a picture
> --> 142                 vals = cam.snapshot()
>    143                 max = vals.max()
>    144                 print "Max= ", max, "Min= ", vals.min()
>
> /n/home05/soffner/yt-x86_64/src/yt-hg/yt/visualization/volume_rendering/camera.pyc
> in snapshot(self, fn)
>    324         tfp = TransferFunctionProxy(self.transfer_function) # Reset
> it every time
>    325         tfp.ns = self.sub_samples
> --> 326         self.volume.initialize_source()
>    327         if self.use_kd:
>    328             self.volume.reset_cast()
>
> /n/home05/soffner/yt-x86_64/src/yt-hg/yt/utilities/amr_kdtree/amr_kdtree.pyc
> in initialize_source(self)
>    773     def initialize_source(self):
>    774         if self.tree_type is 'domain':
> --> 775             self.get_bricks()
>    776
>    777     def kd_ray_cast(self,image, tfp, vector_plane, back_center,
> front_center):
>
> /n/home05/soffner/yt-x86_64/src/yt-hg/yt/utilities/amr_kdtree/amr_kdtree.pyc
> in get_bricks(self)
>    345                 for i,field in enumerate(self.fields):
>    346                     vcd =
> current_node['grid'].get_vertex_centered_data(field,smoothed=True,no_ghost=self.no_ghost).astype('float64')
> --> 347                     if self.log_field[i]: vcd = na.log10(vcd)
>    348                     dds.append(vcd)
>    349                 current_saved_grids.append(current_node['grid'])
>
> AttributeError: 'AMRKDTree' object has no attribute 'log_field'
> WARNING: Failure executing file:
> </n/home05/soffner/ytorionlib/ytwindmovie.py>
>
>
> On Nov 23, 2010, at 3:51 PM, Matthew Turk wrote:
>
>> Hi Stella,
>>
>> You're right, that code was not using the correct parameters.  I have
>> corrected it and pushed a new changeset.
>>
>> -Matt
>>
>> PS For what it's worth, this doesn't seem to be related to Mike's
>> problem from the other thread, which I will defer to the author of the
>> amr_kdtree module, Sam Skillman.  :)
>>
>> On Tue, Nov 23, 2010 at 3:49 PM, Stella Offner <soffner at cfa.harvard.edu>
>> wrote:
>>>
>>> Hi Matt,
>>>
>>> Thanks! That got me past the camera-specific error. However, I am running
>>> into an error in amr_kdtree, which has a call in the old form to
>>> pf['DomainLeftEdge']:
>>>
>>> KeyError                                  Traceback (most recent call
>>> last)
>>>
>>> /n/home05/soffner/yt-x86_64/src/yt-hg/scripts/iyt in <module>()
>>>   135                 cam = pf.h.camera(c, L, W, (Nvec,Nvec),
>>>   136                         transfer_function = tf, pf = pf,
>>> fields=["log_den"],
>>> --> 137                         north_vector = north)
>>>   138                 cam.zoom(1.0)
>>>   139     #take a picture
>>>
>>>
>>> /n/home05/soffner/yt-x86_64/src/yt-hg/yt/visualization/volume_rendering/camera.pyc
>>> in __init__(self, center, normal_vector, width, resolution,
>>> transfer_function, north_vector, steady_north, volume, fields,
>>> log_fields,
>>> sub_samples, pf, use_kd, l_max, no_ghost, tree_type)
>>>   193             if self.use_kd:
>>>   194                 volume = AMRKDTree(self.pf, l_max=l_max,
>>> fields=self.fields, no_ghost=no_ghost, tree_type=tree_type,
>>> --> 195                                    log_fields = log_fields)
>>>   196             else:
>>>   197                 volume = HomogenizedVolume(fields, pf = self.pf,
>>>
>>>
>>> /n/home05/soffner/yt-x86_64/src/yt-hg/yt/utilities/amr_kdtree/amr_kdtree.pyc
>>> in __init__(self, pf, l_max, le, re, fields, no_ghost, tree_type,
>>> log_fields)
>>>   271
>>>   272         if le is None:
>>> --> 273             self.domain_left_edge = pf['DomainLeftEdge']
>>>   274         else:
>>>   275             self.domain_left_edge = le
>>>
>>> /n/home05/soffner/yt-x86_64/src/yt-hg/yt/data_objects/static_output.pyc
>>> in
>>> __getitem__(self, key)
>>>   113                   self.conversion_factors]:
>>>   114             if key in d: return d[key]
>>> --> 115         raise KeyError(key)
>>>   116
>>>   117     def keys(self):
>>>
>>> KeyError: 'DomainLeftEdge'
>>> WARNING: Failure executing file:
>>> </n/home05/soffner/ytorionlib/ytwindmovie.py>
>>>
>>>
>>> On Nov 23, 2010, at 3:32 PM, Matthew Turk wrote:
>>>
>>>> Hi Stella,
>>>>
>>>> I've just pushed a change to include Camera and HomogenizedVolume in
>>>> the yt.mods import.  I also wanted to note that you can get a camera
>>>> by doing:
>>>>
>>>> pf.h.camera
>>>>
>>>> and that I think unless you're doing something clever, you may no
>>>> longer need to generate a HomogenizedVolume by hand.  I think by
>>>> default Camera will use the kD-tree, now, so you should be set just
>>>> specifying the parameters for the rendering to pf.h.camera, and not
>>>> the volume itself.
>>>>
>>>> Let me know if you run into any more problems!
>>>>
>>>> -Matt
>>>>
>>>> On Tue, Nov 23, 2010 at 3:28 PM, Stella Offner <soffner at cfa.harvard.edu>
>>>> wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>>  I updated yt to the new release, and now I'm getting 'NameError: name
>>>>> 'Camera' is not defined' for Camera and HomogenizedVolume (these were
>>>>> both
>>>>> part of the volume_rendering extension previously). Did these get
>>>>> renamed
>>>>> or
>>>>> do I need to import something else?
>>>>>
>>>>> Thanks!
>>>>> Stella
>>>>> _______________________________________________
>>>>> 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
>>>
>> _______________________________________________
>> 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