[IPython-dev] generating input cells dynamically

Fernando Perez fperez.net at gmail.com
Sat Mar 22 19:56:40 EDT 2014


Here:

http://nbviewer.ipython.org/gist/fperez/9716279

Cheers,

f


On Sat, Mar 22, 2014 at 1:11 AM, Zoltán Vörös <zvoros at gmail.com> wrote:

>  But LaTeX has nothing to do with the problem. The question was, given an
> empty notebook, how does one *generate* the following:
>
> In [1]: plot(sin(1*x))
>
> In [2]: plot(sin(2*x))
>
> In [3]: plot(sin(3*x))
> .
> .
> .
>
> In [200]: plot(sin(200*x))
>
> The 200 plots have to be in separate cells, so that their order can be
> changed afterwards, e.g. I want to have an IPython notebook as we
> understand it, but I would like to generate its content (executable code)
> dynamically. Metaprogramming, if you wish.
>
> Zoltán
>
>
>  On 22/03/14 00:28, Paul Hobson wrote:
>
> At this point, I have to wonder if it makes more sense to just write a
> small utility to build a LaTeX document for yourself.
> -paul
>
>
> On Fri, Mar 21, 2014 at 12:30 PM, Zoltán Vörös <zvoros at gmail.com> wrote:
>
>>  Hi Araron,
>>
>> Thanks for the suggestion! But the main problem was not how to run the
>> notebook, but how to generate the code in the first place. Basically, I
>> would like to have a notebook that writes itself. Once it's written, it can
>> be run in many ways, as you pointed out.
>>
>> Cheers,
>> Zoltán
>>
>>   On 21/03/14 20:13, Aaron O'Leary wrote:
>>
>>  Once you've generated the notebook, you could use runipy to run it without
>> having to go through the noteboko UI: https://github.com/paulgb/runipy/
>>
>>  Or, if you're using IPython 2.0 you can do
>>
>>     ipython -c "%run your_notebook.ipynb"
>>
>> from the command line. This is the same as opening it and clicking "run
>> all cells".
>>
>> aaron
>> _______________________________________________
>> IPython-dev mailing listIPython-dev at scipy.orghttp://mail.scipy.org/mailman/listinfo/ipython-dev
>>
>>
>>
>> _______________________________________________
>> IPython-dev mailing list
>> IPython-dev at scipy.org
>> http://mail.scipy.org/mailman/listinfo/ipython-dev
>>
>>
>
>
> _______________________________________________
> IPython-dev mailing listIPython-dev at scipy.orghttp://mail.scipy.org/mailman/listinfo/ipython-dev
>
>
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>
>


-- 
Fernando Perez (@fperez_org; http://fperez.org)
fperez.net-at-gmail: mailing lists only (I ignore this when swamped!)
fernando.perez-at-berkeley: contact me here for any direct mail
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20140322/57d99aed/attachment.html>


More information about the IPython-dev mailing list