{ "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.4.3" }, "name": "", "signature": "sha256:41b384ddc6f6cc06e560975b64e8d487ed4af2e2c1557df60e049255416a4a01" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "About the course" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "I'm Markus Demleitner, a member of the German Virtual Observatory; I'm using python to write a fairly complex server suite (and much besides).\n", "If you need to contact me, feel free to do so; either here or via mail (msdemlei@ari.uni-heidelberg.de).\n", "If we speak in German: I'll just echo your use of Du or Sie, so feel free to choose.\n", "\n", "This course was originally written by Thomas Robitaille, and I've just mildly adapted it to my tastes. In case you're curious how a python course written by me looks like (it had a different audience, though, and it's more than 10 years old in its core), see http://docs.g-vo.org/kurse/prog1" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "Topics\n", "------\n", "\n", "- Using the IPython Notebook\n", "- Introduction to Python\n", "- Modules and Functions\n", "- Introduction to Numpy and Matplotlib\n", "- Reading/writing data from files\n", "- Introduction to Scipy (interpolation, integration, fitting)\n", "- Object-oriented programming\n", "- Applying Python to scientific problems" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "notes" } }, "source": [ "Structure\n", "---------\n", "\n", "The block course lasts five days, and each day will follow this schedule:\n", "\n", "* 9:00-10:30 - lecture/exercises\n", "* 10:30-11:00 - break\n", "* 11:00-12:30 - lecture/exercises\n", "* 12:30-13:30 - break for lunch\n", "* 13:30-14:30 - lecture/exercises\n", "* 14:30-17:00 - computer pool available to finish homework\n", "\n", "The lectures will be mixed with exercise sessions - from time to time I will give you 5 or 10 minutes to complete a given task/exercise. There will be **problem sets** during the week, and you will be required to hand these in a deadline indicated on the problem sheet. An average of 60% in the problem sets will be required to obtain the 2 credits at the end of the course.\n", "\n", "The course will be in English or German as convenient." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "I am very happy to come by to review your code/solutions to exercises. Just drop by. Remember: Making errors and understanding them is the fastest way to actually learn things." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "Solutions\n", "---------" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "All solutions should be submitted as an IPython notebooks (one notebook per problem set). Please enter a filename that contains the name of the problem sheet and your name, and ending with ``.ipynb``, as follows:\n", "\n", " problem_set_2_thomas_robitaille.ipynb\n", "\n", "Send the file by email to [penzlin@stud.uni-heidelberg.de](mailto:penzlin@stud.uni-heidelberg.de) with ``[PY4SCI]`` in the subject." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "The following criteria are taken into account for grading problem sets - the notebook should:\n", "\n", "- run with no errors\n", "- produce the correct results\n", "- be clearly readable, and include text to explain what you are doing and why\n", "- not include any unused code!\n", "- be well presented! :)\n", "\n", "Please make use of the ability to add text around your code in the notebook. Make it so that someone not familiar with the problem could read through it and understand your solution." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**There is never a unique solution to a problem**, so it does not matter if your programs do not look the same as somebody else's! What matters most is that you get a chance to make mistakes and learn from them." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Policy on handing in solutions\n", "------------------------------\n", "\n", "Practice Problems can be done in groups, but Problem Sets should be done **individually** in order to get the full marks. If you need to work with someone else, then you can, but (a) you should submit a single solution and declare that you worked together on the solution, and (b) the final grade for the problem set will be multiplied by 0.75. If two students or more submit essentially the same solution without declaring they have worked together, then the final grade for the problem set will be multiplied by 0.50 :)" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "Laptops\n", "-------\n", "\n", "If you would like to use Python on your laptop, you have several possibilities:\n", "\n", "- If you have a linux laptop and are familiar with package managers, most major scientific Python packages are available through these\n", "- Otherwise, try and install the [Anaconda Python distribution](http://continuum.io/downloads.html)\n", "\n", "Come and speak to me in the afternoon if you have any questions or need any help getting set up." ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Getting set up" ] }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Lecture Notes" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "You can download the notebooks I'm showing, the problem sets and the ancillary data files from a subversion repository at\n", "http://svn.ari.uni-heidelberg.de/svn/edu/py4sci\n", "\n", "You can pluck the individual files as we go. Just reload your ipython notebook viewer after you've downloaded a file.\n", "\n", "The **much** cooler approach is to use this through subversion.\n", "\n", "That's a version control system, which is an essential thing in today's software (and not only software) development. Here, you can use this read only (though I'll take fixes as patches; use svn diff).\n", "\n", "When you install the subversion package (or things like [TortoiseSVN](https://tortoisesvn.net/ on Windows)), you can say\n", "\n", " svn co http://svn.ari.uni-heidelberg.de/svn/edu/trunk/py4sci\n", "\n", "to pull the whole thing. If I've made changes, you can pull them by going to that directory and saying\n", "\n", " svn update\n", "\n", "More on version control as time permits. Or have a look at http://subversion.apache.org/. Or at http://github.com, which is what today's cool kids use for version control these days." ] }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "CIP Pool" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Before you can run Python in the ways described on this page, you will need to start up a command-line Terminal application. In the CIP pool this is located in the Anwendungen -> Zubeh\u00f6r -> Terminal menu.\n", "\n", "To ensure a common environment, in the CIP pool we'll be using an updated version of ipython over what is installed on the machines themselves. To use that, you have to manipulate your path. Here is one way to do that:\n", "\n", " echo \"export PATH=/local/py4sci/anaconda3/bin:$PATH\" >> ~/.bashrc\n", " exec bash\n", "\n", "You only need to do that once.\n", "\n", "Then fetch the notebooks:\n", "\n", " svn checkout http://svn.ari.uni-heidelberg.de/svn/edu/trunk/py4sci\n", "\n", "Go to the py4sci subdirectory you created in this way and execute the notebook player:\n", "\n", " cd py4sci\n", " ipython notebook\n", "\n", "A web browser should open and you should be ready to go.\n", "\n", "The longer commandlines you can cut and paste from\n", "\n", " cat ~nd123/commands" ] } ], "metadata": {} } ] }