[yt-users] Another clump finder error

Matthew Turk matthewturk at gmail.com
Tue Jan 21 11:04:03 PST 2014


Hi Caroline and Britton,

Yup, it's a bug.  Looks like at some point, the way we were pulling
from h5py changed, and we got back a numpy array instead of the h5py
dataset.  I've issued a pull request:

https://bitbucket.org/yt_analysis/yt/pull-request/693/fix-unpickling-of-save_data-load_data

I think this will probably go in quickly, and it's a relatively
straightforward fix.  I was able to run the clump finding operation
from the cookbook without trouble.

Sorry for the delay in replying, Caroline!

-Matt

On Tue, Jan 21, 2014 at 12:09 PM, Britton Smith <brittonsmith at gmail.com> wrote:
> Hi Caroline,
>
> There are two separate things happening here.  The first is that serializing
> data objects, which is what the save_object call is doing, was disabled as
> the default behavior a while back.  Fortunately, you can enable this by
> adding the following at the very top of your script:
> from yt.config import ytcfg
> ytcfg['yt', 'serialize'] = 'True'
>
> Note, this needs to go above "from yt.mods import *" or any other yt imports
> you may do.
>
> The second part is that, when enabled, this functionality appears to be
> broken.  I did a quick test myself with the clump finder using the cookbook
> script (after I added the above lines) and got the following error while
> trying to reload the object:
>
> Traceback (most recent call last):
>   File "find_clumps.py", line 71, in <module>
>     master_clump = pf.h.load_object('My_clumps')
>   File
> "/Users/britton/Documents/work/yt/yt-2.x/src/yt-hg/yt/data_objects/hierarchy.py",
> line 322, in load_object
>     obj = cPickle.loads(obj.value)
> AttributeError: 'numpy.ndarray' object has no attribute 'value'
>
> I do not think this is terribly difficult to fix.  Matt, can you comment on
> this?
>
> Sorry for the troubles!
>
> Britton
>
>
> On Tue, Jan 21, 2014 at 3:54 PM, Caroline Van Borm <borm at astro.rug.nl>
> wrote:
>>
>> Hi all,
>>
>> I just wanted to add to this that I also tried to save my clump object
>> (called master_clump) using <master_clump.save_object("myclumps",
>> "myclumpsfile.cpkl")>. However, this gives the error: "AttributeError:
>> 'Clump' object has no attribute 'save_object'". It is very inconvenient that
>> I cannot save the clump object, as the clump finding takes quite long. Any
>> ideas?
>>
>> Thank you!
>>
>> Cheers,
>> Caroline
>>
>>
>>
>> On 17-Jan-14 14:16, Caroline Van Borm wrote:
>>>
>>> Hi all,
>>>
>>> Sorry to bother you again, but I have another problem with the clump
>>> finder. I have been able to run the script to find the clumps, wrote them to
>>> a text file, and saved the clump object using
>>> <pf.h.save_object(master_clump, 'myclumps')>. However, when I try to read
>>> the object back in and get the lowest clumps using
>>>
>>>     master_clump = pf.h.load_object('myclumps')
>>>     leaf_clumps = get_lowest_clumps(master_clump)
>>>
>>> I get an error saying:
>>>     Traceback (most recent call last):
>>>       File "./findclumps.py", line 66, in <module>
>>>         leaf_clumps = get_lowest_clumps(master_clump)
>>>       File
>>> "/home/uni05/cborm/YT/yt-x86_64/src/yt-hg/yt/analysis_modules/level_sets/clump_handling.py",
>>> line 209, in get_lowest_clumps
>>>         if clump.children is None or len(clump.children) == 0:
>>>     AttributeError: 'NoneType' object has no attribute 'children'
>>>
>>> Does this happen because the clump object didn't actually get saved? And
>>> how can I check whether it did or not?
>>>
>>> Thanks again!
>>>
>>> Cheers,
>>> Caroline
>>> _______________________________________________
>>> 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