[yt-users] pickle

Matthew Turk matthewturk at gmail.com
Thu Aug 11 08:23:08 PDT 2011


It might also be worthwhile to see what, exactly, core is ...

print core

Depending on how it is loaded/unloaded, it might be a tuple of the
parameter file, or might be something slightly other than you are
expecting.  This comes about because it tries really hard to make sure
that the parameter file doesn't disappear.

-Matt

On Thu, Aug 11, 2011 at 9:20 AM, Stephen Skory <s at skory.us> wrote:
> Elizabeth,
>
> have you tried using the yt-approved object storage?
>
> http://yt.enzotools.org/doc/analyzing/objects.html?#storing-and-loading-objects
>
> On Thu, Aug 11, 2011 at 9:09 AM, Elizabeth Tasker <taskere at mcmaster.ca> wrote:
>> Hi,
>>
>> (Another day a different problem!): I'd like to pickle the results from
>> extract_connected_sets, but I can't seem to retrieve what I pickle properly.
>> I have:
>>
>> contours = dd.extract_connected_sets("NegEscapeVelocity", 1, 30.0, maxv,
>> log_space=False)
>> cloudcores = contours[1][0] #cores defined by contour 0
>>
>> file = open('testa.pickle','wb')
>> cPickle.dump(cloudcores,file,protocol=-1)
>> file.close()
>>
>> file = open('testa.pickle','rb')
>> core = cPickle.load(file)
>> file.close()
>>
>> But while:
>>
>> In [76]: cloudcores[40]["Density"]
>> Out[76]:
>> array([  3.80336226e-23,   4.31254788e-23,   3.87927154e-23, ...,
>>        1.26533774e-22,   2.13753864e-22,   2.74680682e-22])
>>
>>
>>
>> In [77]: core[40]["Density"]
>> ---------------------------------------------------------------------------
>> KeyError                                  Traceback (most recent call last)
>>
>> /1/home/taskere/yt/scripts/iyt in <module>()
>> ----> 1
>>     2
>>     3
>>     4
>>     5
>>
>> KeyError: 40
>>
>>
>> Is it not possible to pickle a contour object or is there something else I
>> have to do when un-pickling?
>>
>> Thank you,
>>
>> Elizabeth
>> _______________________________________________
>> yt-users mailing list
>> yt-users at lists.spacepope.org
>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>
>
>
>
> --
> Stephen Skory
> s at skory.us
> http://stephenskory.com/
> 510.621.3687 (google voice)
> _______________________________________________
> 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