# Description¶

## Overview¶

The `mrs_imatch`

step that “matches” image intensities of several input
2D MIRI MRS images by fitting polynomials to cube intensities (cubes built
from input 2D images) in such a way as to minimize inter-image mismatch
in the least squares sense. These “background matching” polynomials
are defined in terms of world coordinates (e.g., `RA`

, `DEC`

, `lambda`

).

## Assumptions¶

Because polynomials are defined in terms of world coordinates, and because the algorithm needs to build 3D cubes for each input image, input images need to have valid WCS.

## Algorithm¶

This step builds a system of linear equations

whose solution is a set of coefficients of (multivariate) polynomials that represent the “background” in each input image (these are polynomials that are “corrections” to intensities of input images) such that the following sum is minimized:

In the above equation, index labels a position in input image’s pixel grid [NOTE: all input images share a common pixel grid].

“Background” polynomials are defined through the corresponding coefficients as:

# Step Arguments¶

The mrs_imatch step has two optional argument:

`bkg_degree`

: An integer background polynomial degree (Default: 1)`subtract`

: A boolean value indicating whether the computed matching “backgrounds” should be subtracted from image data (Default:`False`

).

# Reference Files¶

This step does not require any reference files.

# Also See¶

See wiimatch package documentation for more details.