Skip to content

Latest commit

 

History

History
85 lines (55 loc) · 3.26 KB

python-day1.rst

File metadata and controls

85 lines (55 loc) · 3.26 KB

Introductory Python

We'll be looking at the following IPython Notebooks, all of which are under the python/ directory of the git repository:

Scientific Python basics: python-full.ipynb

Plotting with matplotlib: matplotlib-full.ipynb

Reading and writing files: readwrite-full.ipynb

---

Loading and plotting files: loading-and-plotting-data.ipynb

make_figure.py script

End of day data Analysis mix: end-of-day-data-analysis.ipynb

Running IPython Notebook

Honestly, the hardest part is just getting things running :(. Pick whichever one of the solutions below works...

Running the notebook on Mac OS X using Anaconda CE

Once you get the Anaconda CE file (see :doc:`install` for download links!), go run it at the command line -- double clicking it doesn't seem to work :(.

This should be as simple as opening up a Terminal window and typing:

bash ~/Downloads/AnacondaCE-1.2.0-macosx.sh

and answering all the questions with the defaults ('yes' where appropriate).

Then, once it's all done installing, cd to the git directory that you downloaded earlier, cd into the python/ subdirectory, and type

~/anaconda/bin/ipython notebook --pylab=inline

Your Web browser should pop up. Tada!

Running the notebooks in the Virtual Box virtual machine

Start up your virtual machine (see :doc:`install` for instructions on installing VirtualBox), and then click 'Terminal'. Inside of terminal, run the following commands:

git clone https://github.com/swcarpentry/2012-11-scripps
ls
cd 2012-11-scripps/
ls
cd python
ls
./run-in-vm.sh

(You can copy on your Web browser, and then paste into the Terminal in your VM with 'ctrl-shift-V'.)

This will start up a Firefox browser pointing at IPython Notebook

Extra -- upgrading ipython notebook

You can upgrade ipython notebook to a newer version like so. Type:

sudo apt-get install python-pip
sudo pip install --upgrade ipython

This will take a few minutes to do, because it has to download some files...

IPython Notebook, a brief intro

The IPython Notebook (ipynb for short) is a simple notebook interface to Python that lets you interactively run Python code and view figures and graphics. You can load, save, and download notebooks as a record of your research as well as for interaction with colleagues.

The main thing you need to know about IPython is that to execute code in a cell, you hit Shift-ENTER.