Add jupyter intro

parent 1764dcaa
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"To run a cell, click on it and use shift-enter:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import openpathsampling as paths"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"If you want a little information about an object, use the `?` operator."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"?paths.ShootingPointAnalysis"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The `?` can come before or after the object:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"paths.CommittorSimulation?"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"There's also a `help()` function, which gives much more detailed information, including all the inherited methods for a class. Note that this reports in the output, whereas the others pop up a special window. That's because `help` is standard Python, whereas `?` is an IPython extension."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"help(paths.CVDefinedVolume)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"You can also use the `??` operator to get directly to the code:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"??paths.PathSampling"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"All of these work with any object (including instances of object) or any method/function. If thing being queried is missing a docstring, then `?` isn't very informative, but you can always see the code with `??`."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Jupyter notebooks (and IPython) also support tab-completion. This can be a quick way to browse for functions. In the cell below, type `paths.` and hit tab: you'll see a list of the (many) options."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"paths."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Notebooks are extremely useful for the way they allow you to combine code with text. All the little text I've interleaved here is simply Markdown-formatted. You can change the nature of the cell by going to the Cell -> Cell Type menu.\n",
"\n",
"Take the cell below, and change it back and forth between Markdown and Code types. Hit shift-enter to see the Markdown rendered."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# Shows as comment in code; as header in Markdown. *Italics in Markdown*"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"To learn more about Jupyter, go through the Help menu."
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"language": "python",
"name": "python2"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.12"
}
},
"nbformat": 4,
"nbformat_minor": 1
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment