[yt-users] No 'astype' attribute error - clump finding, volume rendering

Noel Scudder noel.scudder at stonybrook.edu
Tue Jul 2 10:55:18 PDT 2013


Oh - this is for Castro.

On Tue, Jul 2, 2013 at 1:53 PM, Noel Scudder <noel.scudder at stonybrook.edu>wrote:

> Hi Nathan,
>
> Well, I just updated to the latest version of yt, 2.5.4, and I've been
> using that - is that what you mean?
>
> -Noel
>
>
> On Tue, Jul 2, 2013 at 1:16 PM, Nathan Goldbaum <nathan12343 at gmail.com>wrote:
>
>> Hi Noel,
>>
>> I believe pf.domain_dimensions should be a numpy array while in your case
>> it's actually a list. It looks like this is due to a bug in the frontend
>> you're using.  Which code is this for?  This should be an easy fix.
>>
>> -Nathan
>>
>>
>> On Tue, Jul 2, 2013 at 10:12 AM, Noel Scudder <
>> noel.scudder at stonybrook.edu> wrote:
>>
>>> Hi yt users,
>>>
>>> I have a (hopefully) simple question I'm hoping to get cleared up.
>>> I've run into the same error both in clump finding and volume rendering:
>>> AttributeError: 'list' object has no attribute 'astype'.
>>>
>>> My volume rendering script:
>>> ----------------------
>>> from yt.mods import *
>>> pf = load("plt_derr_perr_grav_00020")
>>> field = "pressure"
>>> pf.h
>>>
>>> #color transfer function/layer creation I'll leave out for clarity
>>>
>>> c = [5.0e9, 5.0e9, 5.0e9]
>>> L = [0.15, 1.0, 0.20]
>>> W = (pf.domain_right_edge - pf.domain_left_edge)*0.5
>>> Nvec = 768
>>>
>>> cam = pf.h.camera(c, L, W, (Nvec,Nvec), transfer_function = tf,
>>> fields=[field], pf=pf, no_ghost=False)
>>>
>>> im = cam.snapshot(clip_ratio=6.0)
>>>
>>> ...
>>> ----------------------
>>>
>>> Without "no_ghost=False", the script runs as it's supposed to. If it's
>>> included, I get the following message:
>>>
>>>   File "<stdin>", line 1, in <module>
>>>   File "volume.py", line 17, in <module>
>>>     cam.snapshot("v1.png")
>>>   File
>>> "/home/noel/shocks/yt-x86_64/src/yt-hg/yt/visualization/volume_rendering/camera.py",
>>> line 684, in snapshot
>>>     self.initialize_source()
>>>   File
>>> "/home/noel/shocks/yt-x86_64/src/yt-hg/yt/visualization/volume_rendering/camera.py",
>>> line 636, in initialize_source
>>>     return self.volume.initialize_source()
>>>   File
>>> "/home/noel/shocks/yt-x86_64/src/yt-hg/yt/utilities/amr_kdtree/amr_kdtree.py",
>>> line 200, in initialize_source
>>>     for b in self.traverse():
>>>   File
>>> "/home/noel/shocks/yt-x86_64/src/yt-hg/yt/utilities/amr_kdtree/amr_kdtree.py",
>>> line 210, in traverse
>>>     yield self.get_brick_data(node)
>>>   File
>>> "/home/noel/shocks/yt-x86_64/src/yt-hg/yt/utilities/amr_kdtree/amr_kdtree.py",
>>> line 284, in get_brick_data
>>>     vcd =
>>> grid.get_vertex_centered_data(field,smoothed=True,no_ghost=self.no_ghost).astype('float64')
>>>   File
>>> "/home/noel/shocks/yt-x86_64/src/yt-hg/yt/data_objects/grid_patch.py", line
>>> 510, in get_vertex_centered_data
>>>     cg = self.retrieve_ghost_zones(1, field, smoothed=smoothed)
>>>   File
>>> "/home/noel/shocks/yt-x86_64/src/yt-hg/yt/data_objects/grid_patch.py", line
>>> 477, in retrieve_ghost_zones
>>>     level, new_left_edge, **kwargs)
>>>   File
>>> "/home/noel/shocks/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py",
>>> line 3867, in __init__
>>>     self.pf.domain_dimensions.astype("float64"))
>>> AttributeError: 'list' object has no attribute 'astype'
>>>
>>>
>>> My clump-finding script closely follows the "Identifying Clumps" recipe
>>> in the cookbook:
>>> ----------------------
>>> from yt.mods import *
>>> from yt.analysis_modules.level_sets.api import *
>>>
>>> field = "density"
>>> step = 2.0
>>>
>>> pf = load("plt_derr_perr_grav_00020")
>>> pf.h
>>>
>>> data_source = pf.h.all_data()
>>> c_min = 10**na.floor(na.log10(data_source[field]).min()  )
>>> c_max = 10**na.floor(na.log10(data_source[field]).max()+1)
>>>
>>> function = 'self.data[\'%s\'].size > 8' %field
>>>
>>> master_clump = Clump(data_source, None, field, function=function)
>>> find_clumps(master_clump, c_min, c_max, step)
>>>
>>> ...
>>> ----------------------
>>> An error will occur occur at find_clumps:
>>>
>>> Finding clumps: min: 1.500000e-04, max: 1.500000e+07, step: 2.000000
>>> First pass100%
>>> ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
>>> Time: 00:00:00
>>> Traceback (most recent call last):
>>>    | ETA:  --:--:--
>>>   File "<stdin>", line 1, in <module>
>>>   File "clumps.py", line 30, in <module>
>>>     find_clumps(master_clump, c_min, c_max, step)
>>>   File
>>> "/home/noel/shocks/yt-x86_64/src/yt-hg/yt/analysis_modules/level_sets/clump_handling.py",
>>> line 179, in find_clumps
>>>     clump.find_children(min_val)
>>>   File
>>> "/home/noel/shocks/yt-x86_64/src/yt-hg/yt/analysis_modules/level_sets/clump_handling.py",
>>> line 120, in find_children
>>>     self.cached_fields)
>>>   File
>>> "/home/noel/shocks/yt-x86_64/src/yt-hg/yt/analysis_modules/level_sets/contour_finder.py",
>>> line 107, in identify_contours
>>>     cg = grid.retrieve_ghost_zones(1, "tempContours", smoothed=False)
>>>   File
>>> "/home/noel/shocks/yt-x86_64/src/yt-hg/yt/data_objects/grid_patch.py", line
>>> 479, in retrieve_ghost_zones
>>>     cube = self.hierarchy.covering_grid(level, new_left_edge, **kwargs)
>>>   File
>>> "/home/noel/shocks/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py",
>>> line 3706, in __init__
>>>     self.dds = self.pf.domain_width/rdx.astype("float64")
>>> AttributeError: 'list' object has no attribute 'astype'
>>>
>>>
>>> Can anyone tell me why I am getting this error in both cases? I've been
>>> doing my utmost, but I'm not familiar enough with python nor yt yet.Thanks
>>> for your help!
>>>
>>> Cheers,
>>>
>>> Noel Scudder
>>>
>>> _______________________________________________
>>> 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
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20130702/47e39b9c/attachment.htm>


More information about the yt-users mailing list