Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion source/contest/bounce.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ window.

In order to run this you should copy the lines above into a file
called ``bounce.py`` in your working directory. Then start IPython as usual
with ``ipython -pylab`` or with the Pylab application on Windows and enter the following::
with ``ipython --pylab`` or with the Pylab application on Windows and enter the following::

execfile("bounce.py")

Expand Down
2 changes: 1 addition & 1 deletion source/core/ipython.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Before going further, open a new terminal window and change to your main Python
for Astronomers working directory. Then start IPython by typing "ipython
-pylab" at the command prompt::

% ipython -pylab
% ipython --pylab

As we saw in the Introduction and Installation workshops, for interactive data
analysis IPython has a special ``-pylab`` command line option which
Expand Down
2 changes: 1 addition & 1 deletion source/core/numpy_scipy.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ the workshop. Now that you have a working Python installation we can do this
without worrying about details of the platform (e.g. linux has wget,
Mac has curl, Windows might not have tar, etc etc).

Now start IPython ("ipython -pylab") or use your existing session and enter::
Now start IPython ("ipython --pylab") or use your existing session and enter::

import urllib2, tarfile
url = 'http://python4astronomers.github.com/core/core_examples.tar'
Expand Down
2 changes: 1 addition & 1 deletion source/files/asciifiles.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ there are more types that we did not speak about. One of these is the

Let's start off by downloading :download:`this <../downloads/data.txt>` data file, then launching IPython the directory where you have the file::

$ ipython -pylab
$ ipython --pylab

If you have trouble downloading the file, then start up IPython (``ipython --pylab``) and enter::

Expand Down
4 changes: 2 additions & 2 deletions source/files/atpy.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ Reading in an existing table

First, download :download:`this <../downloads/catalog.fits.gz>` FITS table, then launch IPython in the directory where you have the file::

$ ipython -pylab
$ ipython --pylab

If you have trouble downloading the file, then start up IPython (``ipython -pylab``) and enter::
If you have trouble downloading the file, then start up IPython (``ipython --pylab``) and enter::

import urllib2
url = 'http://python4astronomers.github.com/_downloads/catalog.fits.gz'
Expand Down
2 changes: 1 addition & 1 deletion source/fitting/classes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Basics

Begin by starting IPython with pylab::

$ ipython -pylab
$ ipython --pylab


Classes definitions include the ``class`` declaration, an identifier, and a
Expand Down
2 changes: 1 addition & 1 deletion source/fitting/image.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Fit image data of a supernova remnant G21.5-0.9 using a 2-D multi-component
source model. First, download the FITS image of :download:`G21.5-0.9 <./image2.fits>`
and start IPython::

$ ipython -pylab
$ ipython --pylab

If you have trouble accessing the image you can download it straight away using
Python::
Expand Down
2 changes: 1 addition & 1 deletion source/fitting/low-level.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Explore the Sherpa Object Model
In a new working directory, download a MAST spectrum of :download:`3C 273 <./3c273.fits>`
and start IPython::

$ ipython -pylab
$ ipython --pylab

If you have trouble accessing the spectrum you can download it straight away
using Python::
Expand Down
4 changes: 2 additions & 2 deletions source/fitting/sherpa.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ If you still have the 3C120 data from the
`NumPy introduction <../core/numpy_scipy.html#setup>`_
then go to the py4ast/core directory, otherwise ::

$ ipython -pylab
$ ipython --pylab
import urllib2, tarfile
url = 'http://python4astronomers.github.com/core/core_examples.tar'
tarfile.open(fileobj=urllib2.urlopen(url), mode='r|').extractall()
Expand Down Expand Up @@ -369,7 +369,7 @@ current session as a single file.::
This file can then be
loaded into a new session with the ``restore`` command.::

ipython -pylab
ipython --pylab
In [1]: import sherpa.astro.ui as ui

In [2]: ui.restore("simple1.sherpa")
Expand Down
13 changes: 12 additions & 1 deletion source/fitting/spectrum.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ three arrays: x values, y values, and errors on the y values.
In a new working directory, download a MAST spectrum of :download:`3C 273 <./3c273.fits>`
and start IPython ::

$ ipython -pylab
$ ipython --pylab

If you have trouble accessing the spectrum you can download it straight away
using Python ::
Expand All @@ -35,6 +35,17 @@ Loading the data
staterror = None
syserror = None

.. Note::
The ``load_data`` command may not work in the stand-alone version of
Sherpa. If not, you can use ``pyfits`` to load in the data and then
``load_arrays``, for example::

import pyfits
dat = pyfits.open('3c273.fits')[1].data
wlen = dat.field('WAVELENGTH')
flux = dat.field('FLUX')
ui.load_arrays(1, wlen, flux)

As the file contains two columns, they are taken to be the ``x`` and
``y`` data values. The y values are small (of order 10^-14): ::

Expand Down
10 changes: 10 additions & 0 deletions source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,13 @@ original creation.

:Authors: Tom Aldcroft, Tom Robitaille, Brian Refsdal, Gus Muench
:Copyright: 2011 Smithsonian Astrophysical Observatory

.. toctree::
:hidden:

astropy/data/README
fitting/classes
installation/recommended_options
installation/requirements
intro/comparison
references
5 changes: 2 additions & 3 deletions source/installation/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ Python Installation and Understanding Packages
==============================================

Installing the Python language itself on most platforms is generally very easy.
However, installing the other core packages that you will need in day to day
work can be more of a challenge. In addition the basic mechanics behind
However, the basic mechanics behind
package management can be confusing at first sight.

Workshop goals:
Expand All @@ -30,7 +29,7 @@ Workshop goals:
python_install
packages

:Authors: Tom Aldcroft, Tom Robitaille
:Authors: Tom Aldcroft, Tom Robitaille, Moritz Guenther
:Copyright: 2011 Smithsonian Astrophysical Observatory


Expand Down
52 changes: 16 additions & 36 deletions source/installation/linux.rst
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
Linux
.. _linux_install:

Linux
==========================

There are three options for a linux Python installation that we describe:
Here we provide further details for two methods of installing scientific Python on a linux
system. In this case you will *not* use a standalone Python distribution like Anaconda or
Enthought, but instead use the operating system installation of Python:

- System install in /usr/bin and /usr/lib where you have root privilege
- User installation of EPD in a non-system directory without root
- Non-root setup with an existing full-featured Python on the system

System install with root
------------------------

For a modern linux installation such as Ubuntu, the system Python version
will be 2.6 or newer and all of the required core packages are available as
will be 2.6 or newer and all of the required core packages are available as
package installs. The instructions below have been developed and tested with
Ubuntu 10. Corresponding packages for recent Fedora are probably available but
this has not been verified. In this case you will NOT use the Enthought Python
Expand All @@ -33,7 +36,7 @@ Install the core packages for analysis with the following::
sudo apt-get install python-matplotlib
sudo apt-get install python-setuptools

Quick installation check
Quick installation check
^^^^^^^^^^^^^^^^^^^^^^^^^^^

Open a new terminal window and type::
Expand All @@ -46,35 +49,6 @@ You should see::

.. _linux_nonroot:

User install of EPD without root
--------------------------------

Assuming that you have downloaded the appropriate EPD tar file for your system,
follow the instructions for `Getting Started with EPD
<http://www.enthought.com/products/epdgetstart.php?platform=linux>`_ for Linux.

Once installed then follow the Getting Started page and look at Pylab and plain
Python.

Next you need to edit the appropriate shell startup file (e.g. ``~/.cshrc`` or
``~/.bash_profile``) and update your path to include the EPD path. For
instance if you specified to install EPD in ``/home/me/epd7.0`` then the
following will work::

export PATH=/home/me/epd7.0/bin:$PATH # bash
set path=(/home/me/epd7.0/bin $path) # csh or tcsh

Quick installation check
^^^^^^^^^^^^^^^^^^^^^^^^^^^

Open a new terminal window and type::

which ipython

You should see (where ``/home/me/epd7.0`` is replaced by your installation root
path)::

/home/me/epd7.0/bin/ipython

Non-root setup using virtualenv
---------------------------------------------
Expand Down Expand Up @@ -121,7 +95,14 @@ if it already exists in the system python::

pip install --upgrade ipython

Quick installation check
.. Note::

You can make managing your virtual environments even easier with the popular
`virtualenvwrapper <http://virtualenvwrapper.readthedocs.org/en/latest/>`_
package.


Quick installation check
^^^^^^^^^^^^^^^^^^^^^^^^^^^

Open a new terminal window and type::
Expand All @@ -131,4 +112,3 @@ Open a new terminal window and type::
You should see something like the following::

~/py27/bin/ipython

50 changes: 3 additions & 47 deletions source/installation/macosx.rst
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
.. _Mac_OSX:

Mac OSX
=======

Install the distribution
------------------------
MacPorts
========

If you can follow instructions and have a little patience then MacPorts is
probably the best option. If anything beyond a one-click install is too much
of a bother then choose EPD Academic or ActiveState. For something in-between
choose Homebrew.

MacPorts
^^^^^^^^
a very good option for a long-term commitment to using Python on a Mac.

To install Python using MacPorts follow the detailed instructions at `MacPorts
Python installation on Mac - 10 easy steps
Expand All @@ -21,38 +13,6 @@ on MacPorts for Python which is well-written and helpful is
`Setting Up a Mac for Python Development
<http://jakevdp.github.com/blog/2013/02/02/setting-up-a-mac-for-python-development>`_.

Homebrew
^^^^^^^^^

To install Python using `Homebrew <http://mxcl.github.com/homebrew/>`_ follow
the detailed instructions at `Install Python, NumPy, SciPy, and matplotlib on
Mac OS X <http://penandpants.com/2012/02/24/install-python/>`_.

Enthought Python Distribution (EPD)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Assuming that you have downloaded the `EPD Academic
<http://www.enthought.com/products/edudownload.php>`_ or `EPD Free
<http://www.enthought.com/products/epd_free.php>`_ disk image, open it, then
double-click on ``EPD.mpkg`` and follow the prompts to install. Choose all the
defaults for installing (in particular use the default installation location).

Additional information can be found on the `Getting Started with EPD
<http://www.enthought.com/products/epdgetstart.php?platform=mac>`_ page.

ActiveState
^^^^^^^^^^^^

Download the `ActivePython community edition
<http://www.activestate.com/activepython/downloads>`_ disk image for Python 2.7
and run the installer, choosing all defaults at the prompts. Next install the
core packages from the terminal command line::

sudo /usr/local/bin/pypm -g install numpy scipy matplotlib ipython

Now edit the file `~/.bash_profile` and insert the following line at the end::

export PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"

Quick installation check
----------------------------------------
Expand All @@ -67,8 +27,6 @@ You should see one of the following:
Dist Path
=========== ===========================================================================
MacPorts ``/opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/ipython``
EPD ``/Library/Frameworks/EPD64.framework/Versions/Current/bin/ipython``
ActiveState ``/Library/Frameworks/Python.framework/Versions/2.7/bin/ipython``
=========== ===========================================================================

If not go to the `Troubleshooting`_ section.
Expand Down Expand Up @@ -151,8 +109,6 @@ problem with your PATH. In the instructions below use the correct PATH for your
Dist Path
=========== ====================================================================
MacPorts ``/opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/``
EPD ``/Library/Frameworks/EPD64.framework/Versions/Current/bin/``
ActiveState ``/Library/Frameworks/Python.framework/Versions/2.7/bin/``
=========== ====================================================================

Step 1
Expand Down
7 changes: 5 additions & 2 deletions source/installation/packages.rst
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ installation via a standard ``setup.py`` script. This is used as follows::
More information is available in the `Installing Python Modules
<http://docs.python.org/install/index.html>`_ page.


Where do packages get installed?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Expand Down Expand Up @@ -312,12 +313,14 @@ at the front of the list using insert::
You can also add paths to the search path using the `PYTHONPATH
<http://docs.python.org/using/cmdline.html#envvar-PYTHONPATH>`_ environment variable.

.. _multiple_pythons:

Multiple Pythons on your computer
---------------------------------

Apart from being a scary thought, this is a practical problem that you are
This is a practical problem that you are
likely to encounter. Straight away you probably have the system Python
(/usr/bin) and the EPD Python. Then if you install PyRaf, CIAO, and CASA you
(/usr/bin) and the Anaconda Python. Then if you install PyRaf, CIAO, and CASA you
will get one more Python installation for each analysis package (there are good
reasons for this). **In general, different Python installations cannot
reliably share packages or resources**. Each installation should be considered
Expand Down
Loading