combine#
- ccdproc.combine(img_list, output_file=None, method='average', weights=None, scale=None, mem_limit=16000000000.0, clip_extrema=False, nlow=1, nhigh=1, minmax_clip=False, minmax_clip_min=None, minmax_clip_max=None, sigma_clip=False, sigma_clip_low_thresh=3, sigma_clip_high_thresh=3, sigma_clip_func=None, sigma_clip_dev_func=None, dtype=None, combine_uncertainty_function=None, overwrite_output=False, array_package=None, **ccdkwargs)[source]#
Convenience function for combining multiple images.
- Parameters:
- img_list
numpy.ndarray, list or str A list of fits filenames or
CCDDataobjects, or a mix of the two, that will be combined together. Or a string of fits filenames separated by comma “,”.- output_filestr or None, optional
Optional output fits file-name to which the final output can be directly written. Default is
None.- methodstr, optional
Method to combine images:
'average': To combine by calculating the average.'median': To combine by calculating the median.'sum': To combine by calculating the sum.
Default is
'average'.- weights
numpy.ndarrayor None, optional Weights to be used when combining images. An array with the weight values. The dimensions should match the the dimensions of the data arrays being combined. Default is
None.- scalefunction or
numpy.ndarray-like or None, optional Scaling factor to be used when combining images. Images are multiplied by scaling prior to combining them. Scaling may be either a function, which will be applied to each image to determine the scaling factor, or a list or array whose length is the number of images in the
Combiner. Default isNone.- mem_limitfloat, optional
Maximum memory which should be used while combining (in bytes). Default is
16e9.- clip_extremabool, optional
Set to True if you want to mask pixels using an IRAF-like minmax clipping algorithm. The algorithm will mask the lowest nlow values and the highest nhigh values before combining the values to make up a single pixel in the resulting image. For example, the image will be a combination of Nimages-low-nhigh pixel values instead of the combination of Nimages.
Parameters below are valid only when clip_extrema is set to True, see
Combiner.clip_extrema()for the parameter description:nlow: int or None, optionalnhigh: int or None, optional
- minmax_clipbool, optional
Set to True if you want to mask all pixels that are below minmax_clip_min or above minmax_clip_max before combining. Default is
False.Parameters below are valid only when minmax_clip is set to True, see
Combiner.minmax_clipping()for the parameter description:minmax_clip_min: float or None, optionalminmax_clip_max: float or None, optional
- sigma_clipbool, optional
Set to True if you want to reject pixels which have deviations greater than those set by the threshold values. The algorithm will first calculated a baseline value using the function specified in func and deviation based on sigma_clip_dev_func and the input data array. Any pixel with a deviation from the baseline value greater than that set by sigma_clip_high_thresh or lower than that set by sigma_clip_low_thresh will be rejected. Default is
False.Parameters below are valid only when sigma_clip is set to True. See
Combiner.sigma_clipping()for the parameter description.sigma_clip_low_thresh: positive float or None, optionalsigma_clip_high_thresh: positive float or None, optionalsigma_clip_func: function, optionalsigma_clip_dev_func: function, optional
- dtypedtype-like or None, optional
The intermediate and resulting
dtypefor the combined CCDs; seeccdproc.Combinerfor the accepted forms. IfNonethis is set to the namespace’sfloat64. Default isNone.- combine_uncertainty_functioncallable, None, optional
If
Noneuse the default uncertainty func when using average, median or sum combine, otherwise use the function provided. Default isNone.- overwrite_outputbool, optional
If
output_fileis specified, this is passed to theastropy.nddata.fits_ccddata_writerunder the keywordoverwrite; has no effect otherwise. Default isFalse.- array_packagearray namespace or module, optional
The array package to read files into. Either an array namespace or a plain module that follows the array API standard (e.g.
numpyordask.array); it is normalised to its array-api-compat namespace. Default is the array package of theCCDDataobjects inimg_list, or NumPy if there are none; see Notes.- ccdkwargsOther keyword arguments for
astropy.nddata.fits_ccddata_reader.
- img_list
- Returns:
- combined_image
CCDData CCDData object based on the combined input of CCDData objects.
- combined_image
- Raises:
Notes
Files in
img_listare read into the array package, and onto the device, of theCCDDataobjects in it, so a list that mixes file names and images in memory combines in the array package of the images in memory. Anarray_packagethat disagrees with an image in memory raises rather than converting the image, since the conversion could be a silent copy through host memory.