Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

AstroML: Machine Learning for Astronomy

Reference proceedings Github Actions CI Status Latest PyPI version PyPI download stat License badge

AstroML is a Python module for machine learning and data mining built on numpy, scipy, scikit-learn, and matplotlib, and distributed under the BSD license. It contains a growing library of statistical and machine learning routines for analyzing astronomical data in python, loaders for several open astronomical datasets, and a large suite of examples of analyzing and visualizing astronomical datasets.

This project was started in 2012 by Jake VanderPlas to accompany the book Statistics, Data Mining, and Machine Learning in Astronomy by Zeljko Ivezic, Andrew Connolly, Jacob VanderPlas, and Alex Gray.

Important Links


Before installation, make sure your system meets the prerequisites listed in Dependencies, listed below.


To install the core astroML package in your home directory, use:

pip install astroML

A conda package for astroML is also available either on the conda-forge or on the astropy conda channels:

conda install -c astropy astroML

The core package is pure python, so installation should be straightforward on most systems. To install from source, use:

python install

You can specify an arbitrary directory for installation using:

python install --prefix='/some/path'

To install system-wide on Linux/Unix systems:

python build
sudo python install


There are two levels of dependencies in astroML. Core dependencies are required for the core astroML package. Optional dependencies are required to run some (but not all) of the example scripts. Individual example scripts will list their optional dependencies at the top of the file.

Core Dependencies

The core astroML package requires the following (some of the functionality might work with older versions):

Optional Dependencies

Several of the example scripts require specialized or upgraded packages. These requirements are listed at the top of the particular scripts

  • HEALPy provides an interface to the HEALPix pixelization scheme, as well as fast spherical harmonic transforms.


This package is designed to be a repository for well-written astronomy code, and submissions of new routines are encouraged. After installing the version-control system Git, you can check out the latest sources from GitHub using:

git clone git://

or if you have write privileges:

git clone


We strongly encourage contributions of useful astronomy-related code: for astroML to be a relevant tool for the python/astronomy community, it will need to grow with the field of research. There are a few guidelines for contribution:


Any contribution should be done through the github pull request system (for more information, see the help page Code submitted to astroML should conform to a BSD-style license, and follow the PEP8 style guide.

Documentation and Examples

All submitted code should be documented following the Numpy Documentation Guide. This is a unified documentation style used by many packages in the scipy universe.

In addition, it is highly recommended to create example scripts that show the usefulness of the method on an astronomical dataset (preferably making use of the loaders in astroML.datasets). These example scripts are in the examples subdirectory of the main source repository.


Package Author



  • Alex Conley
  • Andreas Kopecky
  • Andrew Connolly
  • Asif Imran
  • Benjamin Alan Weaver
  • Brigitta Sipőcz
  • Chris Desira
  • Daniel Andreasen
  • Dino Bektešević
  • Edward Betts
  • Hans Moritz Günther
  • Hugo van Kemenade
  • Jake Vanderplas
  • Jeremy Blow
  • Jonathan Sick
  • Joris van Vugt
  • Juanjo Bazán
  • Julian Taylor
  • Lars Buitinck
  • Michael Radigan
  • Morgan Fouesneau
  • Nicholas Hunt-Walker
  • Ole Streicher
  • Pey Lian Lim
  • Rodrigo Nemmen
  • Ross Fadely
  • Vlad Skripniuk
  • Zlatan Vasović
  • Engineero
  • stonebig


Machine learning, statistics, and data mining for astronomy and astrophysics







No packages published