ImCombiner#

class astropop.image.imcombine.ImCombiner(max_memory=1000000000.0, dtype=<class 'numpy.float64'>, tmp_dir=None, use_disk_cache=False, **kwargs)#

Bases: object

Process the combining operation of images, like the IRAF imcombine.

Methods Summary

combine(image_list, method, **kwargs)

Perform the image combining.

set_merge_header(strategy[, keys])

Set the strategy to merge headers during combination.

set_minmax_clip([min_value, max_value])

Enable minmax clipping during the combine.

set_sigma_clip([sigma_limits, center_func, ...])

Enable sigma clipping during the combine.

Methods Documentation

combine(image_list, method, **kwargs)#

Perform the image combining.

Parameters:
image_list: `list` or `tuple`

List containing the images to be combined. The values in the list must be all of the same type and FrameData supported.

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

Combining method.

**kwargs:
sum_normalize: bool (optional)

If True, the imaged will be multiplied, pixel by pixel, by the number of images divided by the number of non-masked pixels. This will avoid discrepancies by different numbers of masked pixels across the image. If False, the raw sum of images will be returned. Default: True

Returns:
combined: FrameData

The combined image.

Notes

  • For now, it don’t consider WCS, so it perform plain between the images, whitout registering.

  • Clipping parameters are set using class functions.

  • If the images exceed the maximum memory allowed, they are splited to perform the median and mean combine.

  • Masked elements are skiped. Result pixels will be masked if all the source pixels combined in it are also masked.

set_merge_header(strategy, keys=None)#

Set the strategy to merge headers during combination.

Parameters:
strategy: {‘no_merge’, ‘first’, ‘only_equal’, ‘selected_keys’}

Header merging strategy.

keys: list

List of the keys to be used for selected_keys strategy.

set_minmax_clip(min_value=None, max_value=None)#

Enable minmax clipping during the combine.

Parameters:
min_value: `float` or `None` (optional)

Minimum threshold of the clipping. None disables minimum masking. Default: None

max_value: `float` or `None` (optional)

Maximum threshold of the clipping. None disables maximum masking. Default: None

set_sigma_clip(sigma_limits=None, center_func='median', dev_func='mad_std')#

Enable sigma clipping during the combine.

Parameters:
sigma_limits: `float`, `tuple` or `None` (optional)

Set the low and high thresholds for sigma clipping. A number is applyed to both low and high limits. A tuple will be considered (low, high) limits. None disable the clipping. Default: None

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

Function to compute de central tendency of the data. Default: ‘median’

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

Function to compute the deviation sigma for clipping. Defautl: ‘mad_std’

Notes

  • ‘median’ and ‘mad_std’ gives a much better sigma clipping than ‘mean’ and ‘std’.