[yt-users] pickle
Elizabeth Tasker
taskere at mcmaster.ca
Thu Aug 11 08:09:42 PDT 2011
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
More information about the yt-users
mailing list