From AstroBaki

Jump to: navigation, search


[edit] Astronomical Interferometry in PYthon

This package collects together tools for radio astronomical interferometry. In addition to pure-python phasing, calibration, imaging, and deconvolution code, this package includes interfaces to MIRIAD (a Fortran interferometry package) and HEALPix (a package for representing spherical data sets), and some math/fitting routines from SciPy.

The primary driver for this software is the Precision Array for Probing the Epoch of Reionization (PAPER), an experiment for detecting the first stars and galaxies that formed in the universe via the effect of their radiation on intergalactic hydrogen. This experiment presents many new challenges, including widefield imaging, non-tracking antennas, high data-rates, a large fractional bandwidth, and power-spectrum detection.

For an overview of the latest changes to this package, see the CHANGELOG.

You are invited to edit this wiki.

[edit] Download

If you have setuptools and numpy is already installed, then with root permissions, you can just type:

easy_install aipy

Otherwise, you may download from

If you want the bleeding-edge source tree, or are interested in source development, you can checkout a copy from using GIT. See GitAipy for more information about using GIT with AIPY.

[edit] Installation

[edit] Resolving Dependencies

This is primarily a *nix package. With some trouble it can install on intel-based Macs. It probably doesn't install on Windows. You need to have python >= 2.4. AIPY depends of the following Python packages:

numpy >= 1.2
pyephem >=
pyfits >= 1.1
*matplotlib >= 0.98
*matplotlib-basemap >= 0.99

(* installation can proceed without these, but some scripts will choke)

To resolve these dependencies, your options are:

  • (safest) -- Manually install the dependencies.
  • (experimental) -- Open up the AIPY download, and with network connectivity and root access, type:

and then (if you want matplotlib/basemap):

[edit] Installing with Root Permission

If you used easy_install, and everything worked, then you're set. Otherwise, download the AIPY package, open it up, and then run (with root permission):

python install

If any of the dependencies fails to install, you should download the package source and build it manually.

[edit] Installing without Root Permission

To resolve dependencies using setuptools, but without root access, you'll need to follow the instructions at, and apply them to each line in Once dependencies have been solved, run the following command:

python install --install-lib "module_dir" --install-scripts "scripts_dir"

where "module_dir" and "scripts_dir" are 2 directories you define. "module_dir" will hold the python module for the package you install, and "scripts_dir" will hold any scripts associated with the package. If you take this second route, you should also run (for bash)

export PYTHONPATH="module_dir"

so that python can find the modules. You should also add "scripts_dir" to your path:

export PATH=$PATH:"scripts_dir"

To avoid having to type these lines every time you open a console, add them to your .bashrc file.

[edit] Additional Packages

Here's a short list of additional packages that I find generally useful when working in Python:

  • IPython: A slick interactive command-line interface.
  • SciPy: General-purpose math, signal processing, fitting, and science stuff.

[edit] Documentation

There are several options for obtaining information about the structure and usage of AIPY:

  • a tutorial that includes primers on various packages, code documentation, and some examples
  • online code documentation generated automatically from docstrings in the source code
  • this wiki, which you are welcome to join and edit, especially the list of topics below:
    • AipyPhilosophy - pedantry you may or may not find useful
    • AipyFaq - a place to post (and answer) questions
    • AipyCookBook - a repository for example code snippets and explanations
  • you may also send emails to aparsons at astron berkeley edu (with dots between astron, berkeley, and edu).

[edit] Contributing Code

AIPY is open-source software released under the GNU Public License. It may be freely used and modified. That said, the interferometry community as a whole stands to benefit from cooperative, organized development. A general model for contributing to the AIPY code-base goes as follows:

  • If you find a bug, write an AipyBugReport to help get it fixed.
  • Write an AipyEnhancementProposal that details what you're interested in changing, how it used to work, how it will work after your enhancment, and why the enhancement is better
  • Get a copy of the latest source code git (see GitAipy for instructions)
  • Make your edits (writing unit tests for any new features), and then check that you haven't broken any other unit tests.
  • Contact a primary developer (currently, Aaron Parsons: aparsons at astron berkeley edu) with an emailed patch. These patches, which may be produced automatically with git, will be merged into the primary source code branch.

Personal tools