{ "metadata": { "name": "", "signature": "sha256:6819663b6c2e11cf9578f7111624b2b48acddccf78844e731344c70f91f0f07c" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ " Day 4 - Thursday, April 10, 2014" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Summary:** ssh'ing to dirac, more iPython, ipythonblocks" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "---" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "`1.` Open a Terminal window and learn how to connect to a remote computer (in this case, the dirac cluster) using `ssh` (secure shell). \n", "\n", "`ssh` is a program that encrypts all communications between the local and remote computer. Because graphical information is data-intensive, `ssh` does not allow remote graphics by default. In order to force `ssh` to forward graphical output, we have to give it the flag `-X`, that stands for \"X forwarding\". \"X\" is the graphical windowing system used on UNIX machines, such as the dirac cluster. Here is the command we enter to log onto dirac5:\n", "\n", " $ ssh -X @dirac5.calpoly.edu\n", "\n", "This command will work from any networked Mac or linux machine with `ssh` installed. For Windows users, you need to install two pieces of software to be able to use dirac. First, an `ssh` client program like PuTTy and then an X-windowing system like Xming. \n", "\n", "* Here is a link to some helpful instructions for PuTTy: https://rcc.its.psu.edu/user_guides/remote_connectivity/putty/\n", "* Here is a link to some helpful instructions for Xming: https://rcc.its.psu.edu/user_guides/remote_display/xming/" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "`2.` Once we are logged onto dirac for the first time, we have to set up our environment to have the paths to all of the programs we want to run in our PATH variable. Instead of having everybody type in the contents of the .bash_profile file, we can use the copy command `cp`, to copy `jklay`'s file to our home directory. To do that enter the following command:\n", "\n", " $ cp ~jklay/.bash_profile .\n", "\n", "The `~jklay` part is a shortcut to `jklay`'s home directory. This same shortcut will work for any user account on the machine. The \"dot\" at the end of the command tells the copy command to copy the file with the same name as the source file in the current directory. As we have seen, the general form of the command is\n", "\n", " $ cp \n", "\n", "where the source is a file and the target can be either a new filename, a path to a directory or a path plus filename. Since we just created the file, our environment hasn't been configured yet. Either log out and back in again or `source` the file so that the aliases and PATH are set for the current session:\n", "\n", " $ source .bash_profile" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "`3.` We can clone our github repository to dirac so that whenever we work on that machine, we have our repository available.\n", "\n", " $ git clone https://github.com//.git\n", "\n", "This is the standard git checkout command, or you can open a browser window and copy the link directly from your github site.\n", "\n", "Set up the global configuration of git by `cd`-ing to the repository directory and `source`-ing the configure script:\n", "\n", " $ cd PHYS202-S14\n", " $ source ConfigureGit.sh\n", " " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "`4.` Verify that you can run the ipython notebook with our newly configured environment.\n", "\n", " $ ipynb\n", "\n", "This opens a firefox session on dirac, but the graphical window appears on our local machine. When we are done, we can close the firefox window and type `-c` once or twice in the terminal window to stop the python kernal and to get the command line prompt back." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "`5.` Before logging out of dirac, practice the workflow of checking the git status and making sure our local (on dirac) changes are in sync with the rmote (github) repository.\n", "\n", " $ cd PHYS202-S14\n", " $ git status\n", " $ git add \n", " $ git commit -m \"\"\n", " $ git push origin master\n", " $ git status\n", " $ exit\n", " \n", "To log out of dirac type `exit` at the command line prompt. Now we are back on our local (180-272) computer again. Check the git status of the local (180-272) repository before proceeding to work.\n", "\n", " $ cd\n", " $ cd PHYS202-S14\n", " $ git status\n", " $ git pull origin master\n", " $ ipynb" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "`6.` More on iPython (selections from Vanderplas 03 and 04)\n", "\n", "Use the iPythonIntro notebook.\n", "\n", "* Basic navigation\n", "* Accessing the underlying OS\n", "* Magic functions\n", "* Error display\n", "* raw_input\n", "* Modules" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "`7.` Visual coding with ipythonblocks\n", "\n", "Use the FunWithBlocks notebook.\n", "\n", "See the demo at \"http://nbviewer.ipython.org/github/jiffyclub/ipythonblocks/blob/master/demos/ipythonblocks_demo.ipynb\"\n", "and another person's take on it at \"http://nbviewer.ipython.org/github/catherinedevlin/mpwfw_exercises/blob/master/blocks.ipynb\" (includes fun exercises)." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "`8.` Finally, before leaving, close the notebook session and save your changes to github:\n", "\n", " $ git add \n", " $ git commit -m ''\n", " $ git push origin master\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ " Any unfinished exercises are assigned for homework due on Wednesday, 16-Apr-2013 at 11:59pm.\n" ] }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "HW:" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Complete the full Python track in Codecademy by Monday, 11:59pm. The ones we haven't been assigned yet include: \n", "\n", "* Exam Statistics\n", " * `16.` Exam Statistics\n", "* Advanced Topics in Python\n", " * `17.` Advanced Topics in Python\n", " * `18.` Introduction to Bitwise Operators\n", "* Introduction to Classes\n", " * `19.` Introduction to Classes\n", " * `20.` Classes\n", "* File Input and Output\n", " * `21.` File Input and Output" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Be sure you have completed all 21 lessons and the follow-up exercises by the deadline. Go back and complete any unfinished ones." ] }, { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "EMAIL THEM" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "* Homework (Codecademy)\n", "* Installfest announcement\n", "* Instructions for ssh/PuTTy/Xming\n", "* Installation instructions" ] }, { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "Post to Polylearn" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "* Installation instructions\n", "* ssh instructions\n", "* iPythonIntro Notebook\n", "* FunWithBlocks Notebook" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "---" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ " All content is under a modified MIT License, and can be freely used and adapted. See the full license text [here](../../../LICENSE)." ] } ], "metadata": {} } ] }