Recent Changes

Wednesday, June 6

Friday, September 15

  1. page Installing Python 2016-08-24 edited Installing Python and Required Packages New Instructions for 2017 If you are a student having…

    Installing Python and Required Packages
    New Instructions for 2017
    If you are a student having trouble installing this software, contact compwiki@physics.utoronto.ca
    The Department of Physics computers will already have the Python packages that are required for your coursework. However, it is useful to be able to work on your own computer; so we provide packages and instructions to enable you to get started.
    (view changes)
    11:30 am
  2. page Installing Python edited ... If you are a student having trouble installing this software, contact compwiki@physics.utoront…
    ...
    If you are a student having trouble installing this software, contact compwiki@physics.utoronto.ca
    The Department of Physics computers will already have the Python packages that are required for your coursework. However, it is useful to be able to work on your own computer; so we provide packages and instructions to enable you to get started.
    The Current Release of the University of Toronto Python Distribution (UTPPD)
    The University of Toronto Physics Python Distribution (UTPPD) is UTPPD2016 available in our software repository.
    System Requirements:
    Intel 64-bit based computer (most new computers you buy will satisfy this).
    Windows 7 or later or Mac OS X 10.10 (Yosemite) or 10.11 (El Capitan).

    Background Note
    ...
    Analytics. For 2016, UTPPD will be2017, we have transition to the most recent Anaconda distribution based on Python 2.7. Migration to3.6 (or later). Every major package now works on Python 3 is planned inand Python2, and the near future. The mainonly reason we
    ...
    3D programming.
    Windows Installation
    Execute

    Here are
    the following instructions fromon installing:
    Go to https://anaconda.org and follow
    the account"Download Anaconda" link, which takes you will useto https://www.continuum.io/downloads.
    Click on the tab
    for your work.
    Visit the UTPPD
    platform of choice for 64-bit Windows download area.
    Download the installer file: Anaconda2-4.0.0-Windows-x86_64.msi .
    Download the UTPPD setup and configuration scripts: setup.bat and utppdconfig.ps1.
    Double-click on the Anaconda installer file and provide
    your administrator password if prompted. When completed, youcomputer (Windows/Mac/Linux).
    You
    will have a full Python 2.7 distribution usefultypically choose 64-bit for Computational Physics. (Note: Installation may take 20 minutes. Just let it finish.)
    Open the folder in which
    newer computers.
    If
    you downloadedare a current U of T Physics student who is unsure how to follow the installation filesprovided instructions, please feel free to contact compwiki@physics.utoronto.ca for assistance.
    If you have an older computer or OS version,
    and double-click onfind that the setup.bat file. (It may only appears as setup, depending on your local settings.)
    With the installation completed,
    distribution you can now move on to testing, as describeddownload in Software Testing.
    OS X Installation
    Visit the UTPPD for OSX download area.
    Download the latest UTPPD2016-x.dmg file.
    If it
    this way does not open automatically,work, you can go to your Downloads folder and double click on the installer. This should create an icon on your desktop that looks likearchive of previous distributions, linked from the following:
    {installer-virtdisk-icon.png}
    Double-click on the UTPPD2016 icon, which will open
    anaconda downloads page, and find a Finder windowdistribution that looks like:
    {finder-installer-window.png}
    Now drag
    more closely matches your computer platform.
    Current U of T Physics students can contact compwiki@physics.utoronto.ca for assistance with this.
    Install
    the UTPPD2016 folder ontosoftware following the Applications folder to begin the install, which may take several minutes. (There are 2GBprompts.
    We recommend default installation. This is installation for you as a sole user, not system wide.
    If you have installed a previous version
    of files to unpackanaconda (e.g. a Python 2 distribution) and move into place.)
    With the installation completed,
    wish to maintain multiple versions, we will assume that you can now move onknow how to testing, as described in Software Testing.deal with this but can't offer support for this at this time.
    Otherwise, we recommend you uninstall the previous version of anaconda. See https://docs.continuum.io/anaconda/install for uninstall instructions.

    Note: If you want or need to run python from the MacOS Terminal, see the optional section at the end of this document.
    Software Testing
    Now test the packages you have installed. First, we will start the VIDLE program, which will let you run Python commands and scripts. Then we will run a couple of test scripts. VIDLE is described further in the tutorial.

    Caution about opening .py files:
    Files that have the extension .py are known as Python scripts. In Windows and Mac OS, these files will appear to be "clickable", i.e. will appear to be files that you can open by clicking them with the mouse. We DO NOT recommend that you open these files by clicking on them. Why? Because quite often the result can be unpredictable. Instead, use the method described below and in the tutorial: start VIDLE and open Python scripts inside a VIDLE session.
    Open VIDLE
    If you are running Windows:
    Start → All Programs → Anaconda2 (64-bit) → VIDLE (Python GUI)
    If you are running OS X:
    Applications → UTPPD2016 → <right click or control click the first time> VIDLE
    You need to right click or control click the first time you open VIDLE in order to approve use of this application from a third-party (non-Apple) site.
    On both Windows and Mac OS X, the typical result will be simple blank text document. Fonts might appear small for you; you can adjust font size and other settings using Options → Configure IDLE ...
    Run Some Example Scripts
    a. Download the example scripts:
    Download the example scripts in the file examples.zip that can be downloaded here {examples.zip} . Download the file and "unzip" it; you now have a folder called "examples".
    b. Run the bounce script
    In the IDLE program, using File → Open in Windows or Mac OS, go to the examples folder you have just downloaded and open the file called "bounce", which might show up as bounce or as bounce.py in the directory listing. You will now run the script. The contents of a script is called a "module" in Python terminology. In the menu, select Run → Run Module. (A shortcut for this is to press the function key F5.) This should produce an animation of a bouncing ball (see below) and verifies installation of VPython.
    {visual_snapshot.jpg}
    Finally, close the bouncing ball animation.
    c. Run the plot example script:
    In the examples folder, find the file called matplotlib_example.py, which might show up as matplotlib_example or matplotlib_example.py.
    Run this module as you did the bounce module (Run Module or the shortcut F5). You might need to wait a minute or so before anything happens.
    This should produce a plot of global mean surface temperature, using data from the NASA GISS website (see screenshot below). This verifies installation of the matplotlib module. Close the window and quit IDLE.
    {matplotlib_snapshot.jpg}
    You have now completed a limited test of the Python distribution you installed. Congratulations! You are ready to move on to the Tutorial, starting with First Steps, Part 1.

    Optional: Running Python at the Command Line
    Windows
    Windows users are particularly fortunate because the Python distribution comes with a special version of the Windows command-line application, cmd, called Anaconda Prompt, which ensures that you can run the correct Python interpreter by simply typing python. Look for Anaconda Prompt under the Anaconda2 (64-bit) folder in the applications menu.
    MacOS / OSX
    ...
    directories that will NOTshould include the UTPPDAnaconda directory.If you run python by default. Atfrom the same place whereterminal command you obtainedshould see the UTPPD installer, you can find a small bash shell script called utppd. Append the contents of that script to the end of your bash configuration file, ${HOME}/.bashrcword 'Anaconda' and then,version '3.6' in the same Terminal shell, type:
    exec bash
    At this point you should be able to simply type utppd in order to set up your environment correctly to run the UTPPD python and find it modules.
    Additional Notes for PHY 407 Students
    Please see Extra Packages for PHY407.
    The compwiki.physics.utoronto.ca site content is Copyright 2009-2016 Department of Physics, University
    first few lines of Toronto.text.
    The compwiki.physics.utoronto.ca site content is Copyright 2009, 2010, 2011, 2012 Department of Physics, University of Toronto.
    (view changes)
    11:23 am
  3. page Installing Python edited Type in Installing Python and Required Packages If you are a student having trouble installing…
    Type in
    Installing Python and Required Packages
    If you are a student having trouble installing this software, contact compwiki@physics.utoronto.ca
    The Department of Physics computers will already have
    the contentPython packages that are required for your coursework. However, it is useful to be able to work on your own computer; so we provide packages and instructions to enable you to get started.
    The Current Release
    of the University of Toronto Python Distribution (UTPPD)
    The University of Toronto Physics Python Distribution (UTPPD) is UTPPD2016 available in our software repository.
    System Requirements:
    Intel 64-bit based computer (most new computers you buy will satisfy this).
    Windows 7 or later or Mac OS X 10.10 (Yosemite) or 10.11 (El Capitan).
    Background Note
    The Physics Python distribution is based on the Anaconda Python distribution produced by Continuum Analytics. For 2016, UTPPD will be based on Python 2.7. Migration to Python 3 is planned in the near future. The main reason we continue to use Python 2.7 is for compatibility with the VPython package for 3D programming.
    Windows Installation
    Execute the following instructions from the account you will use for
    your page here. Please dowork.
    Visit the UTPPD for 64-bit Windows download area.
    Download the installer file: Anaconda2-4.0.0-Windows-x86_64.msi .
    Download the UTPPD setup and configuration scripts: setup.bat and utppdconfig.ps1.
    Double-click on the Anaconda installer file and provide your administrator password if prompted. When completed, you will have a full Python 2.7 distribution useful for Computational Physics. (Note: Installation may take 20 minutes. Just let it finish.)
    Open the folder in which you downloaded the installation files and double-click on the setup.bat file. (It may only appears as setup, depending on your local settings.)
    With the installation completed, you can now move on to testing, as described in Software Testing.
    OS X Installation
    Visit the UTPPD for OSX download area.
    Download the latest UTPPD2016-x.dmg file.
    If it does
    not deleteopen automatically, go to your Downloads folder and double click on the copyright noticeinstaller. This should create an icon on your desktop that looks like the following:
    {installer-virtdisk-icon.png}
    Double-click on the UTPPD2016 icon, which will open a Finder window that looks like:
    {finder-installer-window.png}
    Now drag the UTPPD2016 folder onto the Applications folder to begin the install, which may take several minutes. (There are 2GB of files to unpack and move into place.)
    With the installation completed, you can now move on to testing, as described in Software Testing.
    Note: If you want or need to run python from the MacOS Terminal, see the optional section
    at the bottomend of this document.
    Software Testing
    Now test
    the page.packages you have installed. First, we will start the VIDLE program, which will let you run Python commands and scripts. Then we will run a couple of test scripts. VIDLE is described further in the tutorial.
    Caution about opening .py files:
    Files that have the extension .py are known as Python scripts. In Windows and Mac OS, these files will appear to be "clickable", i.e. will appear to be files that you can open by clicking them with the mouse. We DO NOT recommend that you open these files by clicking on them. Why? Because quite often the result can be unpredictable. Instead, use the method described below and in the tutorial: start VIDLE and open Python scripts inside a VIDLE session.
    Open VIDLE
    If you are running Windows:
    Start → All Programs → Anaconda2 (64-bit) → VIDLE (Python GUI)
    If you are running OS X:
    Applications → UTPPD2016 → <right click or control click the first time> VIDLE
    You need to right click or control click the first time you open VIDLE in order to approve use of this application from a third-party (non-Apple) site.
    On both Windows and Mac OS X, the typical result will be simple blank text document. Fonts might appear small for you; you can adjust font size and other settings using Options → Configure IDLE ...
    Run Some Example Scripts
    a. Download the example scripts:
    Download the example scripts in the file examples.zip that can be downloaded here {examples.zip} . Download the file and "unzip" it; you now have a folder called "examples".
    b. Run the bounce script
    In the IDLE program, using File → Open in Windows or Mac OS, go to the examples folder you have just downloaded and open the file called "bounce", which might show up as bounce or as bounce.py in the directory listing. You will now run the script. The contents of a script is called a "module" in Python terminology. In the menu, select Run → Run Module. (A shortcut for this is to press the function key F5.) This should produce an animation of a bouncing ball (see below) and verifies installation of VPython.
    {visual_snapshot.jpg}
    Finally, close the bouncing ball animation.
    c. Run the plot example script:
    In the examples folder, find the file called matplotlib_example.py, which might show up as matplotlib_example or matplotlib_example.py.
    Run this module as you did the bounce module (Run Module or the shortcut F5). You might need to wait a minute or so before anything happens.
    This should produce a plot of global mean surface temperature, using data from the NASA GISS website (see screenshot below). This verifies installation of the matplotlib module. Close the window and quit IDLE.
    {matplotlib_snapshot.jpg}
    You have now completed a limited test of the Python distribution you installed. Congratulations! You are ready to move on to the Tutorial, starting with First Steps, Part 1.
    Optional: Running Python at the Command Line
    Windows
    Windows users are particularly fortunate because the Python distribution comes with a special version of the Windows command-line application, cmd, called Anaconda Prompt, which ensures that you can run the correct Python interpreter by simply typing python. Look for Anaconda Prompt under the Anaconda2 (64-bit) folder in the applications menu.
    MacOS / OSX
    To run our python from the command-line under MacOS is a little more complicated. MacOS supplies a command-line interface named Terminal (Terminal.app on the filesystem) which can be found in /Applications/Utilities. By default, the terminal application runs an interactive program -- the one that accepts your typed input and provides results -- called the bash shell. When you ask bash to run python, it searches through a list of directories that will NOT include the UTPPD python by default. At the same place where you obtained the UTPPD installer, you can find a small bash shell script called utppd. Append the contents of that script to the end of your bash configuration file, ${HOME}/.bashrc and then, in the same Terminal shell, type:
    exec bash
    At this point you should be able to simply type utppd in order to set up your environment correctly to run the UTPPD python and find it modules.
    Additional Notes for PHY 407 Students
    Please see Extra Packages for PHY407.
    The compwiki.physics.utoronto.ca site content is Copyright 2009-2016 Department of Physics, University of Toronto.

    The compwiki.physics.utoronto.ca site content is Copyright 2009, 2010, 2011, 2012 Department of Physics, University of Toronto.
    (view changes)
    11:18 am

Sunday, September 10

  1. page Getting Started (Fall 2017) edited ... Opening Spyder will first open a terminal session and then open a graphical Spyder window. Yo…
    ...
    Opening Spyder will first open a terminal session and then open a graphical Spyder window.
    You might see a message suggesting that there is an "Update Available". You can ignore this.
    ...
    the form: [warn]
    [warn]
    kq_init: detected
    These can be safely ignored
    The result will look something like what is shown below.
    (view changes)
    10:48 am
  2. page Getting Started (Fall 2017) edited ... You can also search for Spyder in Spotlight Opening Spyder will first open a terminal session…
    ...
    You can also search for Spyder in Spotlight
    Opening Spyder will first open a terminal session and then open a graphical Spyder window.
    You might see a message suggesting that there is an "Update Available". You can ignore this.
    Also, a terminal session will be started with a bunch of messages of the form: [warn] kq_init: detected broken kqueue; not using.: Undefined error: 0
    These can be safely ignored

    The result will look something like what is shown below.
    {Spyder Mac OS.png}
    (view changes)
    10:47 am

Tuesday, September 5

  1. page 8. Debugging edited ... while True: try: number = int(raw_input("Enter int(input("Enter a number break…
    ...
    while True:
    try:
    number = int(raw_input("Enterint(input("Enter a number
    break
    except ValueError:
    (view changes)
    2:05 pm

More