[IPython-dev] [QUAR] Using Ipython cache as file proxy

Mark Voorhies mark.voorhies at ucsf.edu
Wed Oct 20 15:30:33 EDT 2010


On Wednesday, October 20, 2010 10:45:30 am Gökhan Sever wrote:
<snip>
> heavy reading and plotting of 8 pages of figures. I am doing slight
> modifications and annotations on my figures to make them look more
> readable, and each run airplot.py is taking a while to bring plots the
> screen and produce the final multipage pdf file.
<snip>
> variable access queries. About %99 of my time, I leave my dataset as
> is, and making changes on processing/analysis code. As far I know
> there is no feature in IPython to look up the local namespace and not
> make any duplicate reads of the same name (It sounds a bit fantasy I
> know :). Anyways, could this be easily implemented? 

If you factor your script in to reading/analysis/plotting functions then
you can do:
1) Start iPython
2) import yourmodule and run full pipeline
3) hack on analysis/plotting functions
4) reload(yourmodule) and rerun just the analysis and/or plotting parts

I use an object oriented equivalent of this a lot, e.g.:

>>> import mymodule
# First load (e.g., 30 minutes of reading and pre-processing)
>>> data = mymodule.Data()
# First analysis (e.g. 30 seconds)
>>> data.analyze()
# hack on mymodule
>>> reload(mymodule)
# re-link methods rather than re-loading data
>>> data.__class__ = mymodule.Data
# Updated analysis
>>> data.analyze()

HTH,

Mark



More information about the IPython-dev mailing list