<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>scienceoss.com &#187; help</title>
	<atom:link href="http://scienceoss.com/tags/help/feed/" rel="self" type="application/rss+xml" />
	<link>http://scienceoss.com</link>
	<description>useful tidbits for using open source software in science</description>
	<lastBuildDate>Wed, 26 May 2010 03:34:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>History: keep track of your work in IPython</title>
		<link>http://scienceoss.com/keeping-track-of-your-work-in-ipython/</link>
		<comments>http://scienceoss.com/keeping-track-of-your-work-in-ipython/#comments</comments>
		<pubDate>Sun, 02 Dec 2007 17:23:10 +0000</pubDate>
		<dc:creator>ryan</dc:creator>
				<category><![CDATA[IPython]]></category>
		<category><![CDATA[help]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://scienceoss.com/?p=35</guid>
		<description><![CDATA[This post shows the different ways of keeping track of your work in IPython: the command history, saving the history (or parts of the history to file) for later use, and storing variables so you don&#8217;t have to create them next time you use IPython. History Note: In the history, you may see _ip.magic().&#160; This [...]]]></description>
			<content:encoded><![CDATA[<p>This post shows the different ways of keeping track of your work in IPython: the command history, saving the history (or parts of the history to file) for later use, and storing variables so you don&#8217;t have to create them next time you use IPython.<span id="more-35"></span></p>
<h2>History</h2>
<p style="margin-bottom: 0in; font-style: normal">
<strong>Note:</strong> In the history, you may see _ip.magic().&nbsp; This is the wrapper used to run magic commands</p>
<p style="margin-bottom: 0in; font-style: normal">&nbsp;</p>
<table border="0" cellpadding="4" >
<tbody>
<tr>
<td class="command">In[5]:</td>
<td>The prompt shows the number of the command in the history</td>
</tr>
<tr>
<td class="command">In[3]</td>
<td>The list, <span class="c">In</span>, contains the history.&nbsp; So this command shows the third item in the history&nbsp; (item 0 is a newline)&nbsp;</td>
</tr>
<tr>
<td class="command">Out.keys()</td>
<td>The output cache, <span class="c">Out</span>, is a dictionary.&nbsp; Use this to see the keys in the output cache</td>
</tr>
<tr>
<td class="command">_i</td>
<td>show the last command</td>
</tr>
<tr>
<td class="command">_ii</td>
<td>show the second-to-last command</td>
</tr>
<tr>
<td class="command">_iii</td>
<td>show the third-to-last command (and so<br />
on)</td>
</tr>
<tr>
<td class="command">_i10</td>
<td>show the tenth command in history (same as <span class="c">In[10]</span>)</td>
</tr>
<tr>
<td class="command">exec _i</td>
<td>execute the last command</td>
</tr>
<tr>
<td class="command">exec _i4</td>
<td>execute the fourth command in the history</td>
</tr>
<tr>
<td class="command">hist</td>
<td>display the last 20 or so commands</td>
</tr>
<tr>
<td class="command">hist 100</td>
<td>display the last 100 commands</td>
</tr>
<tr>
<td class="command">hist 3 10</td>
<td>display commands 3 through 10 in the<br />
history</td>
</tr>
<tr>
<td class="command">hist -r</td>
<td>hide the wrappers around magic commands</td>
</tr>
<tr>
<td class="command">macro mac 1-4 7</td>
<td>create a macro called mac out of lines 1, 2, 3, 4, and 7 of the history</td>
</tr>
<tr>
<td class="command">mac</td>
<td>runs the macro called <span class="c">mac</span></td>
</tr>
<tr>
<td class="command">print mac</td>
<td>prints the commands in <span class=<br />
"c">mac</span></td>
</tr>
<tr>
<td class="command">store mac</td>
<td>stores the macro in the profile, it will be available next time you start IPython</td>
</tr>
</tbody>
</table>
<table border="0" cellpadding="4" >
<tbody>
<tr>
<td class="command">store x</td>
<td>store <span class="c">x</span> in the profile. It will be loaded next time you start IPython.</td>
</tr>
<tr>
<td class="command">store x &gt; /tmp/a.txt</td>
<td>store <span class="c">x</span> in the file, <span class="c">a.txt</span></td>
</tr>
<tr>
<td class="command">store -r</td>
<td>restore into the workspace the variables that have been stored. Overwrites exisiting variables in workspace.</td>
</tr>
<tr>
<td class="command">store -d x</td>
<td>delete just <span class="c">x</span> from<br />
storage</td>
</tr>
<tr>
<td class="command">store -z</td>
<td>remove ALL variables from storage</td>
</tr>
</tbody>
</table>
<p></p>
<p style="margin-bottom: 0in"></p>
<h2>Logging your session for later use</h2>
<table border="0" cellpadding="4" >
<tbody>
<tr>
<td class="command">logstate</td>
<td>show state of the logger (on or off)</td>
</tr>
<tr>
<td class="command">logstart</td>
<td>start logging (default log file is <span class="c">ipython_log.py</span>, in the present working directory</td>
</tr>
<tr>
<td class="command">logstart filename</td>
<td>store history up to this point, and continue logging history, in <span class="c">filename</span></td>
</tr>
<tr>
<td class="command">logstart -r filename</td>
<td>same as above, but use the raw input: don&#8217;t put the <span class="c">_ip.magic()</span> wrapper around magic commands</td>
</tr>
<tr>
<td class="command">logon</td>
<td>start logging after stopping</td>
</tr>
<tr>
<td class="command">logoff</td>
<td>stop logging after starting</td>
</tr>
<tr>
<td class="command">runlog log1 log2</td>
<td>run the log file <span class="c">log1</span>, then run the log file <span class="c">log2</span> (this executes the logged histories)</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://scienceoss.com/keeping-track-of-your-work-in-ipython/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Managing variables in IPython</title>
		<link>http://scienceoss.com/managing-variables-in-ipython/</link>
		<comments>http://scienceoss.com/managing-variables-in-ipython/#comments</comments>
		<pubDate>Sun, 02 Dec 2007 17:18:02 +0000</pubDate>
		<dc:creator>ryan</dc:creator>
				<category><![CDATA[IPython]]></category>
		<category><![CDATA[help]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://scienceoss.com/?p=34</guid>
		<description><![CDATA[After working in IPython for a while, sometimes you&#8217;d like to use a variable you created way back at the beginning, but you don&#8217;t remember exactly what it was called. Here are some useful commands for working with variables in IPython. who show contents of workspace who int show integers in workspace whos show details [...]]]></description>
			<content:encoded><![CDATA[<p>After working in IPython for a while, sometimes you&#8217;d like to use a variable you created way back at the beginning, but you don&#8217;t remember exactly what it was called.  Here are some useful commands for working with variables in IPython.<span id="more-34"></span></p>
<table border="0" cellpadding="4" >
<tbody>
<tr>
<td class="command">who</td>
<td>show contents of workspace</td>
</tr>
<tr>
<td class="command">who int</td>
<td>show integers in workspace</td>
</tr>
<tr>
<td class="command">whos</td>
<td>show details of workspace contents</td>
</tr>
<tr>
<td class="command">whos int</td>
<td>show details of integers in workspace</td>
</tr>
<tr>
<td class="command">psearch msg*</td>
<td>search for objects in the workspace starting with <span class="c">msg</span></td>
</tr>
<tr>
<td class="command">psearch msg* int</td>
<td>restrict search to just integers</td>
</tr>
<tr>
<td class="command">reset</td>
<td>delete all variables from workspace</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://scienceoss.com/managing-variables-in-ipython/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Getting help in IPython</title>
		<link>http://scienceoss.com/getting-help-in-ipython/</link>
		<comments>http://scienceoss.com/getting-help-in-ipython/#comments</comments>
		<pubDate>Sun, 02 Dec 2007 17:04:08 +0000</pubDate>
		<dc:creator>ryan</dc:creator>
				<category><![CDATA[IPython]]></category>
		<category><![CDATA[help]]></category>
		<category><![CDATA[IPython help]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://scienceoss.com/?p=31</guid>
		<description><![CDATA[IPython has an in-depth integrated help system. You can get help on IPython&#8217;s magic functions, view documentation from a single function, check out syntax-highlighted source code, or enter the Python interactive help system. Here&#8217;s a list of the commands to use. lsmagic lists the magic commands ? (at the end of a function or variable) [...]]]></description>
			<content:encoded><![CDATA[<p>IPython has an in-depth integrated help system.  You can get help on IPython&#8217;s magic functions, view documentation from a single function, check out syntax-highlighted source code, or enter the Python interactive help system.  Here&#8217;s a list of the commands to use.<span id="more-31"></span></p>
<table border="0" cellpadding="4" >
<tbody>
<tr>
<td class="command">lsmagic</td>
<td>lists the magic commands</td>
</tr>
<tr>
<td class="command">?</td>
<td>(at the end of a function or variable) show help</td>
</tr>
<tr>
<td class="command">??</td>
<td>(at the end of a function or object) show detailed help; often includes source code</td>
</tr>
<tr>
<td class="command">help(sys)</td>
<td>online documentation for the <span class="c">sys</span> module (sys must be imported first)</td>
</tr>
<tr>
<td class="command">help(&#8216;for&#8217;)</td>
<td>online doc for the <span class="c">for</span><br />
keyword</td>
</tr>
<tr>
<td class="command">help()</td>
<td>enters the help system</td>
</tr>
<tr>
<td class="command">topics</td>
<td>(at the help prompt) lists help topics.&nbsp; Type<br />
one to view it.</td>
</tr>
<tr>
<td class="command">q</td>
<td>(at the help prompt) Exit the help<br />
system.</td>
</tr>
</tbody>
</table>
<p>&nbsp;<br />
Import the <span class="mainbody">re</span> module (regular expression module) as an example for the commands below:</p>
<pre class="prettyprint">
import re
</pre>
<table border="0" cellpadding="4" >
<tbody>
<tr>
<td class="command">pdef re.match</td>
<td>just the initialization expression for the <span class="c">re.match</span> function</td>
</tr>
<tr>
<td class="command">pdoc re.match</td>
<td>just the help text for <span class="c">re.match</span></td>
</tr>
<tr>
<td class="command">pinfo re.match</td>
<td>same as using <span class="c">re.match?</span><br />
(shows help)</td>
</tr>
<tr>
<td class="command">psource re.match</td>
<td>same as using <span class="c">re.match??</span><br />
(shows detailed help)</td>
</tr>
<tr>
<td class="command">pfile re.match</td>
<td>shows the contents of the file where the function<br />
is defined</td>
</tr>
<tr>
<td class="command">pycat scriptName</td>
<td>displays the file, <span class= "c">scriptName</span>, in syntax-highlighted text</td>
</tr>
<tr>
<td class="command">edit -x re.match</td>
<td>opens the source file for <span class= "c">re.match</span> in default editor</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://scienceoss.com/getting-help-in-ipython/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

