Skip to main content

Astrometric Alignment of Images

Project description


[![Build Status](](
[![Documentation Status](](

**ASTROALIGN** is a simple package that will try to align two stellar astronomical images, especially when there is no WCS information available.

It does so by finding similar 3-point asterisms (triangles) in both images and deducing the
affine transformation between them.

General align routines try to match interesting points, using corner detection routines to make the point correspondence.

These generally fail for stellar astronomical images, since stars have very little stable structure and so, in general, indistinguishable from each other.

Asterism matching is more robust and closer to the human way of matching images.

Astro align can match images of very different field of view, point-spread functions, seeing and atmospheric conditions.

It may not work, or work with special care, on images of extended objects with few point-like sources or in very crowded fields.



Using setuptools:

pip install astroalign

or from this distribution with

python install


Usage example

>>> import astroalign as aa
>>> aligned_image = aa.align_image(reference_image, image2transform)

In this example image2transform will be interpolated by a transformation to coincide pixel to pixel with reference_img and stored in aligned_image.

Sometimes, CCD defects can confuse the alignment. In cases where it's necessary you can mask out bad regions using a mask (True on bad) and pass a [numpy masked array]( that will ignore the masked pixels.

The returned aligned_image will be the same type as image2transform and its mask, if any, will be transformed in the same way as the image.

Pixels outside the boundaries of the transformation are filled with the image median value and masked True if mask is provided.

More information available on docstrings


*This package is inspired by the []( program*

TOROS Dev Team


Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

astroalign-1.0a4.tar.gz (7.7 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page