Hi there--
I have a phase plot that I pickled on one machine, and moved to my
laptop and want to re-plot. I pickled it like this:
fptr=open(filename,'rb')
cPickle.dump(pc.plots[-1].data,fptr,protocol=-1)
I want to unpickle it like this:
obj = cPickle.load( open(filename) )
but I get this parameter file error (full traceback below):
return self._convert_pf(self._records[hash])
KeyError: (('32aa7d1d4941760ffd8fdcab4ea97e1f',),
Hi David,
On Fri, Jul 1, 2011 at 8:55 AM, david collins
Hi there--
I have a phase plot that I pickled on one machine, and moved to my laptop and want to re-plot. I pickled it like this: fptr=open(filename,'rb') cPickle.dump(pc.plots[-1].data,fptr,protocol=-1)
I want to unpickle it like this: obj = cPickle.load( open(filename) )
but I get this parameter file error (full traceback below):
return self._convert_pf(self._records[hash]) KeyError: (('32aa7d1d4941760ffd8fdcab4ea97e1f',),
, ('32aa7d1d4941760ffd8fdcab4ea97e1f',)) I suspect that the key error is because I don't have the original dataset on this machine (due to disk space) so the pf store on this machine doesn't have that key. Does that sound right, and is there a work around for that?
Yup, sounds right. Pickling phase plots is tricky. Part of the plotting refactor is designed to allow it, and I have been using successfully lately. Use yt.visualization.profile_plotter.PhasePlotter, which is substantially more constraining in exposed methods, but also provides the attribute .plot, which can be pickled and which itself provides a to_mpl function that takes filenames, axes or figures. You should read the source to see how it works, but this is the "future" for pickling and passing plots. -Matt
This is a technique I've used in the past, so in principle it's sound.
Thanks, d.
Full trace: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "p8_theta_coarse.py", line 6, in <module> phase = fPickle.load(infile) File "/Users/dcollins/Sites/Research/CodeGames/yt2.0/fPickle.py", line 9, in load output = cPickle.load(inputfile,*args,**kwargs) File "/Users/dcollins/local/lib/python2.6/site-packages/yt-2.1dev-py2.6-macosx-10.4-i386.egg/yt/data_objects/static_output.py", line 192, in _reconstruct_pf pf = pfs.get_pf_hash(*args) File "/Users/dcollins/local/lib/python2.6/site-packages/yt-2.1dev-py2.6-macosx-10.4-i386.egg/yt/utilities/parameter_file_storage.py", line 104, in get_pf_hash return self._convert_pf(self._records[hash]) KeyError: (('32aa7d1d4941760ffd8fdcab4ea97e1f',),
, ('32aa7d1d4941760ffd8fdcab4ea97e1f',)) -- Sent from my computer. _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
designed to allow it, and I have been using successfully lately. Use yt.visualization.profile_plotter.PhasePlotter, which is substantially
Cool, I'll give that a shot. Is it possible to cram an existing pickle (if I'm on the originating machine, where the unpickle works) into the PhasePlotter format, or will I need to remake the phase plots? Thanks! d.
more constraining in exposed methods, but also provides the attribute .plot, which can be pickled and which itself provides a to_mpl function that takes filenames, axes or figures. You should read the source to see how it works, but this is the "future" for pickling and passing plots.
-Matt
This is a technique I've used in the past, so in principle it's sound.
Thanks, d.
Full trace: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "p8_theta_coarse.py", line 6, in <module> phase = fPickle.load(infile) File "/Users/dcollins/Sites/Research/CodeGames/yt2.0/fPickle.py", line 9, in load output = cPickle.load(inputfile,*args,**kwargs) File "/Users/dcollins/local/lib/python2.6/site-packages/yt-2.1dev-py2.6-macosx-10.4-i386.egg/yt/data_objects/static_output.py", line 192, in _reconstruct_pf pf = pfs.get_pf_hash(*args) File "/Users/dcollins/local/lib/python2.6/site-packages/yt-2.1dev-py2.6-macosx-10.4-i386.egg/yt/utilities/parameter_file_storage.py", line 104, in get_pf_hash return self._convert_pf(self._records[hash]) KeyError: (('32aa7d1d4941760ffd8fdcab4ea97e1f',),
, ('32aa7d1d4941760ffd8fdcab4ea97e1f',)) -- Sent from my computer. _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
-- Sent from my computer.
Yes, but you should also be able to pickle just the ._data attribute
(which is a dict of numpy arrays) of the BinnedProfile2D object, too.
On Fri, Jul 1, 2011 at 9:30 AM, David Collins
designed to allow it, and I have been using successfully lately. Use yt.visualization.profile_plotter.PhasePlotter, which is substantially
Cool, I'll give that a shot.
Is it possible to cram an existing pickle (if I'm on the originating machine, where the unpickle works) into the PhasePlotter format, or will I need to remake the phase plots?
Thanks! d.
more constraining in exposed methods, but also provides the attribute .plot, which can be pickled and which itself provides a to_mpl function that takes filenames, axes or figures. You should read the source to see how it works, but this is the "future" for pickling and passing plots.
-Matt
This is a technique I've used in the past, so in principle it's sound.
Thanks, d.
Full trace: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "p8_theta_coarse.py", line 6, in <module> phase = fPickle.load(infile) File "/Users/dcollins/Sites/Research/CodeGames/yt2.0/fPickle.py", line 9, in load output = cPickle.load(inputfile,*args,**kwargs) File "/Users/dcollins/local/lib/python2.6/site-packages/yt-2.1dev-py2.6-macosx-10.4-i386.egg/yt/data_objects/static_output.py", line 192, in _reconstruct_pf pf = pfs.get_pf_hash(*args) File "/Users/dcollins/local/lib/python2.6/site-packages/yt-2.1dev-py2.6-macosx-10.4-i386.egg/yt/utilities/parameter_file_storage.py", line 104, in get_pf_hash return self._convert_pf(self._records[hash]) KeyError: (('32aa7d1d4941760ffd8fdcab4ea97e1f',),
, ('32aa7d1d4941760ffd8fdcab4ea97e1f',)) -- Sent from my computer. _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
-- Sent from my computer. _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
Yes, but you should also be able to pickle just the ._data attribute (which is a dict of numpy arrays) of the BinnedProfile2D object, too.
I might revert to that. I had tried that initially, but using the BinnedProfile object lets me call PlotTypes.PhasePlot directly, and there are a number of subtleties about the plotting done in that routine that I like, so I could avoid some wheel reinvention. Thanks a ton, d.
On Fri, Jul 1, 2011 at 9:30 AM, David Collins
wrote: designed to allow it, and I have been using successfully lately. Use yt.visualization.profile_plotter.PhasePlotter, which is substantially
Cool, I'll give that a shot.
Is it possible to cram an existing pickle (if I'm on the originating machine, where the unpickle works) into the PhasePlotter format, or will I need to remake the phase plots?
Thanks! d.
more constraining in exposed methods, but also provides the attribute .plot, which can be pickled and which itself provides a to_mpl function that takes filenames, axes or figures. You should read the source to see how it works, but this is the "future" for pickling and passing plots.
-Matt
This is a technique I've used in the past, so in principle it's sound.
Thanks, d.
Full trace: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "p8_theta_coarse.py", line 6, in <module> phase = fPickle.load(infile) File "/Users/dcollins/Sites/Research/CodeGames/yt2.0/fPickle.py", line 9, in load output = cPickle.load(inputfile,*args,**kwargs) File "/Users/dcollins/local/lib/python2.6/site-packages/yt-2.1dev-py2.6-macosx-10.4-i386.egg/yt/data_objects/static_output.py", line 192, in _reconstruct_pf pf = pfs.get_pf_hash(*args) File "/Users/dcollins/local/lib/python2.6/site-packages/yt-2.1dev-py2.6-macosx-10.4-i386.egg/yt/utilities/parameter_file_storage.py", line 104, in get_pf_hash return self._convert_pf(self._records[hash]) KeyError: (('32aa7d1d4941760ffd8fdcab4ea97e1f',),
, ('32aa7d1d4941760ffd8fdcab4ea97e1f',)) -- Sent from my computer. _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
-- Sent from my computer. _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
-- Sent from my computer.
Hi Dave,
Yeah, these are the kind of subtleties we really want to avoid at this
point. The complexity makes it into a black box; this impedes the
ability to dump things into crazy layouts and whatnot.
At its heart, it's just a pcolormesh with masking for the zero values.
If you rely on standard matplotlib/pylab to get there, I think you
should be okay -- but yes, the complexity and subtleties that have
developed there need to be eliminated. For the most part they have
changed only slightly since Matplotlib 0.91, which was a long time
ago. The motion to a stripped down object is to require more thought
on the part of the user, but in doing so to allow greater flexibility
in what can be done.
Good luck ...
-Matt
On Fri, Jul 1, 2011 at 10:48 AM, David Collins
Yes, but you should also be able to pickle just the ._data attribute (which is a dict of numpy arrays) of the BinnedProfile2D object, too.
I might revert to that. I had tried that initially, but using the BinnedProfile object lets me call PlotTypes.PhasePlot directly, and there are a number of subtleties about the plotting done in that routine that I like, so I could avoid some wheel reinvention.
Thanks a ton, d.
On Fri, Jul 1, 2011 at 9:30 AM, David Collins
wrote: designed to allow it, and I have been using successfully lately. Use yt.visualization.profile_plotter.PhasePlotter, which is substantially
Cool, I'll give that a shot.
Is it possible to cram an existing pickle (if I'm on the originating machine, where the unpickle works) into the PhasePlotter format, or will I need to remake the phase plots?
Thanks! d.
more constraining in exposed methods, but also provides the attribute .plot, which can be pickled and which itself provides a to_mpl function that takes filenames, axes or figures. You should read the source to see how it works, but this is the "future" for pickling and passing plots.
-Matt
This is a technique I've used in the past, so in principle it's sound.
Thanks, d.
Full trace: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "p8_theta_coarse.py", line 6, in <module> phase = fPickle.load(infile) File "/Users/dcollins/Sites/Research/CodeGames/yt2.0/fPickle.py", line 9, in load output = cPickle.load(inputfile,*args,**kwargs) File "/Users/dcollins/local/lib/python2.6/site-packages/yt-2.1dev-py2.6-macosx-10.4-i386.egg/yt/data_objects/static_output.py", line 192, in _reconstruct_pf pf = pfs.get_pf_hash(*args) File "/Users/dcollins/local/lib/python2.6/site-packages/yt-2.1dev-py2.6-macosx-10.4-i386.egg/yt/utilities/parameter_file_storage.py", line 104, in get_pf_hash return self._convert_pf(self._records[hash]) KeyError: (('32aa7d1d4941760ffd8fdcab4ea97e1f',),
, ('32aa7d1d4941760ffd8fdcab4ea97e1f',)) -- Sent from my computer. _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
-- Sent from my computer. _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
-- Sent from my computer. _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
Yeah, these are the kind of subtleties we really want to avoid at this point. The complexity makes it into a black box; this impedes the ability to dump things into crazy layouts and whatnot.
The subtleties I meant were the matplotlib subtleties, not the yt subtleties. I actually really appreciate that yt has plot functions that take care of most of those details for me, I've gotten quite far with what yt provides. Matplotlib, on the other hand, I find pretty counter-intuitive (and in some cases overtly missleading in documentation, variable names, and object structure) I think that there's a balance between user- and expert- friendliness in any complex tool, I in general appreciate where yt sits on that balance. Thanks, d.
At its heart, it's just a pcolormesh with masking for the zero values. If you rely on standard matplotlib/pylab to get there, I think you should be okay -- but yes, the complexity and subtleties that have developed there need to be eliminated. For the most part they have changed only slightly since Matplotlib 0.91, which was a long time ago. The motion to a stripped down object is to require more thought on the part of the user, but in doing so to allow greater flexibility in what can be done.
Good luck ...
-Matt
On Fri, Jul 1, 2011 at 10:48 AM, David Collins
wrote: Yes, but you should also be able to pickle just the ._data attribute (which is a dict of numpy arrays) of the BinnedProfile2D object, too.
I might revert to that. I had tried that initially, but using the BinnedProfile object lets me call PlotTypes.PhasePlot directly, and there are a number of subtleties about the plotting done in that routine that I like, so I could avoid some wheel reinvention.
Thanks a ton, d.
On Fri, Jul 1, 2011 at 9:30 AM, David Collins
wrote: designed to allow it, and I have been using successfully lately. Use yt.visualization.profile_plotter.PhasePlotter, which is substantially
Cool, I'll give that a shot.
Is it possible to cram an existing pickle (if I'm on the originating machine, where the unpickle works) into the PhasePlotter format, or will I need to remake the phase plots?
Thanks! d.
more constraining in exposed methods, but also provides the attribute .plot, which can be pickled and which itself provides a to_mpl function that takes filenames, axes or figures. You should read the source to see how it works, but this is the "future" for pickling and passing plots.
-Matt
This is a technique I've used in the past, so in principle it's sound.
Thanks, d.
Full trace: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "p8_theta_coarse.py", line 6, in <module> phase = fPickle.load(infile) File "/Users/dcollins/Sites/Research/CodeGames/yt2.0/fPickle.py", line 9, in load output = cPickle.load(inputfile,*args,**kwargs) File "/Users/dcollins/local/lib/python2.6/site-packages/yt-2.1dev-py2.6-macosx-10.4-i386.egg/yt/data_objects/static_output.py", line 192, in _reconstruct_pf pf = pfs.get_pf_hash(*args) File "/Users/dcollins/local/lib/python2.6/site-packages/yt-2.1dev-py2.6-macosx-10.4-i386.egg/yt/utilities/parameter_file_storage.py", line 104, in get_pf_hash return self._convert_pf(self._records[hash]) KeyError: (('32aa7d1d4941760ffd8fdcab4ea97e1f',),
, ('32aa7d1d4941760ffd8fdcab4ea97e1f',)) -- Sent from my computer. _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
-- Sent from my computer. _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
-- Sent from my computer. _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
-- Sent from my computer.
participants (3)
-
david collins
-
David Collins
-
Matthew Turk