opticam.align

Functions

find_translation(reference_coords, coords)

Find the translation that maps reference_coords onto coords. An advantage of this over

align_batch(batch, reference_image_shape, ...)

Align an image based on some reference coordinates.

valid_transform(file, transform, rotation_limit, ...)

Find whether a transform is valid given some transform limits.

Module Contents

opticam.align.find_translation(reference_coords, coords)

Find the translation that maps reference_coords onto coords. An advantage of this over astroalign.find_transform() is that it requires fewer sources, however it is therefore more prone to errors. In general, astroalign.find_transform() should be used, but find_translation() is available if there are too few sources for astroalign.find_transform().

Parameters

reference_coordsNDArray

The reference source coordinates.

coordsNDArray

The source coordinates.

Returns

SimilarityTransform

The transformation matrix that maps coords onto reference_coords.

Parameters:
  • reference_coords (numpy.typing.NDArray)

  • coords (numpy.typing.NDArray)

Return type:

skimage.transform.SimilarityTransform

opticam.align.align_batch(batch, reference_image_shape, reference_coords, transform_type, rotation_limit, scale_limit, translation_limit, n_alignment_sources, gains, flat_corrector, rebin_factor, remove_cosmic_rays, background, finder, threshold, logger)

Align an image based on some reference coordinates.

Parameters

file: str

The file path.

reference_imageNDArray

The reference image.

reference_coordsNDArray

The source coordinates in the reference image.

transform_typeLiteral[‘affine’, ‘translation’]

The type of transform to use for image alignment.

rotation_limitfloat | None

The maximum rotation limit (in degrees) for image alignment.

scale_limitfloat | None

The maximum scaling limit for image alignment.

translation_limitList[float] | None

The maximum translation limit for image alignment.

n_alignment_sourcesint

The (maximum) number of sources to use for image alignment.

Returns

Tuple[NDArray, Dict[str, float], Dict[str, Dict[str, float]]]

The stacked image, transforms, and background results.

Parameters:
Return type:

Tuple[numpy.typing.NDArray, Dict[str, float], Dict[str, Dict[str, float]]]

opticam.align.valid_transform(file, transform, rotation_limit, scale_limit, translation_limit, logger)

Find whether a transform is valid given some transform limits.

Parameters

filestr

The file being transformed.

transformSimilarityTransform

The transform.

rotation_limitfloat | None

The rotation limit.

scale_limitfloat | None

The scale limit.

translation_limitList[float] | None

The translation limit.

Returns

bool

Whether the transform is valid.

Parameters:
  • file (str)

  • transform (skimage.transform.SimilarityTransform)

  • rotation_limit (float | None)

  • scale_limit (float | None)

  • translation_limit (List[float] | None)

  • logger (logging.Logger)

Return type:

bool