combine_images¶
- sofia_redux.toolkit.image.combine.combine_images(data, variance=None, method='median', weighted=True, robust=True, returned=True, **kwargs)[source]¶
Combine input image arrays.
Uses masked arrays to ignore input NaNs and to clip outliers if necessary. Masked pixels in the output are replaced with NaN before returning.
- Parameters:
- data
list
of numpy.ndarray or numpy.ndarray Input data to combine. Dimensions must match for all arrays. If ndarray is provided, images will be combined along axis 0.
- variance
list
of numpy.ndarray or numpy.ndarray, optional Variance associated with input data. List length and features must match
data
.- method{‘mean’, ‘median’, ‘sum’}, optional
Combination function to use.
- weightedbool, optional
If True and method is ‘mean’, the input variance will be used to weight the mean combination. Ignored if variance is not provided.
- robustbool, optional
If True, the threshold and maxiters parameters will be used to reject outliers before combination. Outlier rejection is performed via
astropy.stats.sigma_clip
.- returnedbool, optional
If True, return the combined variance in addition to the combined image. Variance will be propagated if provided, or calculated from the RMS of each pixel over all images.
- **kwargs
Additional parameters to pass to
astropy.stats.sigma_clip
when robust=True. ‘axis’ and ‘masked’ keywords are ignored if provided.
- data
- Returns:
- tuple of numpy.ndarray
Return value is (data, variance) for the combined array. If input variance is provided, it is propagated; otherwise, the returned variance is calculated from the input data.
- Raises:
- ValueError
Any improper inputs.