Module Methods¶
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 3point asterisms (triangles) in both images and deducing the affine transformation between them.
General registration routines try to match feature 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 stellar images.
Astroalign can match images of very different field of view, pointspread functions, seeing and atmospheric conditions.
 Martin Beroiz

astroalign.
MAX_CONTROL_POINTS
= 50¶ The maximum control points (stars) to use to build the invariants.
Default: 50

astroalign.
MIN_MATCHES_FRACTION
= 0.8¶ The minimum fraction of triangle matches to accept a transformation.
If the minimum fraction yields more than 10 triangles, 10 is used instead.
Default: 0.8

astroalign.
NUM_NEAREST_NEIGHBORS
= 5¶ The number of nearest neighbors of a given star (including itself) to construct the triangle invariants.
Default: 5

astroalign.
PIXEL_TOL
= 2¶ The pixel distance tolerance to assume two invariant points are the same.
Default: 2

astroalign.
align_image
(ref_image, img2transf, n_ref_src=50, n_img_src=70, px_tol=2.0)¶ Deprecated: Alias for
register
for backwards compatibility.

astroalign.
apply_transform
(transform, source, target)¶ Applies the transformation
transform
tosource
.The output image will have the same shape as
target
.Parameters:  transform – A scikitimage
SimilarityTransform
object.  source (numpy array) – A 2D numpy array of the source image to be transformed.
 target (numpy array) – A 2D numpy array of the target image. Only used to set the output image shape.
Returns: A numpy 2D array of the transformed source. If source is a masked array the returned image will also be a masked array with outside pixels set to True.
 transform – A scikitimage

astroalign.
find_affine_transform
(test_srcs, ref_srcs, max_pix_tol=2.0, min_matches_fraction=0.8, invariant_map=None)¶ Deprecated: Alias for
find_transform
for backwards compatibility.

astroalign.
find_transform
(source, target)¶ Estimate the transform between
source
andtarget
.Return a SimilarityTransform object
T
that maps pixel x, y indices from the source image s = (x, y) into the target (destination) image t = (x, y). T contains parameters of the tranformation:T.rotation
,T.translation
,T.scale
,T.params
.Parameters:  source (arraylike) – Either a numpy array of the source image to be transformed or an interable of (x, y) coordinates of the target control points.
 target (arraylike) – Either a numpy array of the target (destination) image or an interable of (x, y) coordinates of the target control points.
Returns: The transformation object and a tuple of corresponding star positions in source and target.:
T, (source_pos_array, target_pos_array)
Raises: TypeError
– If input type ofsource
ortarget
is not supported.Exception
– If it cannot find more than 3 stars on any input.

astroalign.
register
(source, target)¶ Transform
source
to coincide pixel to pixel withtarget
.Parameters:  source (numpy array) – A 2D numpy array of the source image to be transformed.
 target (numpy array) – A 2D numpy array of the target image. Only used to set the output image shape.
Returns: A numpy 2D array of the transformed source. If source is a masked array the returned image will also be a masked array with outside pixels set to True.