imcombine#

astropop.image.imcombine.imcombine(frames, method='median', memory_limit=1000000000.0, **kwargs)#

Combine a list of images or frames in a single one.

Parameters:
frames: list

List of the frames to be combined. Can be a list of FrameData, a list of file names, a list of ImageHDU or a list of ndarray. All members must have the same dimensions. For FrameData, all units must be the compatible.

method: {‘sum’, ‘median’, ‘mean’}

Combining method. Each one has a proper math and a proper error computation.

memory_limit: int (optional)

The maximum memory limit (in bytes) to be used in the combining. If the data exceeds the maximum memory limit, it will be slipted in chunks for the rejection and combining processes.

**kwargs:
sigma_clip: float or tuple (optional)

Threshold of sigma clipping rejection. If None, it disables the sigma clipping. If a number is provided, it is applied for both low and high values. If a tuple is provided, it is interpreted as (sigma_low, sigma_high) values. Default: None

sigma_cen_func: callable or {‘median’, ‘mean’} (optional)

Function to compute the central value of sigma clipping rejection. If a name is provided, it must follow the convention in Notes. If a callable is provided, it will be applied directly on the data and must accept ‘axis’ argument. Default: ‘median’

sigma_dev_func: callable or {‘std’, ‘mad_std’} (optional)

Function to compute the std deviation of sigma clipping rejection. If a name is provided, it must follow the convention in Notes. If a callable is provided, it will be applied directly on the data and must accept ‘axis’ argument. Default: ‘std’

minmax_clip: tuple (optional)

Minimum and maximum limits for minmax clipping. The values are interpreted as (min, max) limits. All values lower then the minimum limit and greater then the maximum limit will be masked. If None, the minmax clipping will be disabled. Default: None

merge_header: {‘first’, ‘selected_keys’, ‘no_merge’} (optional)

Strategy to merge the headers of the images. If ‘first’, the first image header will be used. If ‘selected_keys’, the headers will be merged using the keys provided in the header_merge_keys. If ‘no_merge’, the headers will not be merged. Default: ‘no_merge’

header_merge_keys: list (optional)

List of the keywords to be used to merge the headers. Defaut: None

Returns:
result: FrameData

A FrameData containing the combined image and its uncertainty.

Notes

  • It is not recomended using clipping with ‘sum’ method, since it will change the number of elements to be summed in each column.

  • To disable a low or high clipping, use tuple with None. For example, using sigma_clip=(None, 2), the lower clipping will be disabled.

  • The center function names are: - ‘median’: nanmedian - ‘mean’: nanmean

  • The standard deviation funcion names are: - ‘std’: nanstd - ‘mad_std’: mad_std