Combiner¶
-
class
ccdproc.
Combiner
(ccd_list, dtype=None)[source]¶ Bases:
object
A class for combining CCDData objects.
The Combiner class is used to combine together CCDData objects including the method for combining the data, rejecting outlying data, and weighting used for combining frames
Parameters: ccd_list :
list
A list of CCDData objects that will be combined together.
dtype : ‘numpy dtype’
Allows user to set dtype.
Raises: TypeError
If the
ccd_list
are notCCDData
objects, have different units, or are different shapesNotes
The following is an example of combining together different
CCDData
objects:>>> import numpy as np >>> import astropy.units as u >>> from ccdproc import Combiner, CCDData >>> ccddata1 = CCDData(np.ones((4, 4)), unit=u.adu) >>> ccddata2 = CCDData(np.zeros((4, 4)), unit=u.adu) >>> ccddata3 = CCDData(np.ones((4, 4)), unit=u.adu) >>> c = Combiner([ccddata1, ccddata2, ccddata3]) >>> ccdall = c.average_combine() >>> ccdall CCDData([[ 0.66666667, 0.66666667, 0.66666667, 0.66666667], [ 0.66666667, 0.66666667, 0.66666667, 0.66666667], [ 0.66666667, 0.66666667, 0.66666667, 0.66666667], [ 0.66666667, 0.66666667, 0.66666667, 0.66666667]])
Attributes Summary
dtype
scaling
Scaling factor used in combining images. weights
Weights used when combining the CCDData
objects.Methods Summary
average_combine
([scale_func, scale_to, ...])Average combine together a set of arrays. median_combine
([median_func, scale_to, ...])Median combine a set of arrays. minmax_clipping
([min_clip, max_clip])Mask all pixels that are below min_clip or above max_clip. sigma_clipping
([low_thresh, high_thresh, ...])Pixels will be rejected if they have deviations greater than those set by the threshold values. Attributes Documentation
-
dtype
¶
-
scaling
¶ Scaling factor used in combining images.
Parameters: scale : function or array-like or None, optional
-
weights
¶ Weights used when combining the
CCDData
objects.Parameters: weight_values :
ndarray
An array with the weight values. The dimensions should match the the dimensions of the data arrays being combined.
Methods Documentation
-
average_combine
(scale_func=<function average>, scale_to=None, uncertainty_func=<numpy.ma.core._frommethod instance>)[source]¶ Average combine together a set of arrays.
A
CCDData
object is returned with the data property set to the average of the arrays. If the data was masked or any data have been rejected, those pixels will not be included in the average. A mask will be returned, and if a pixel has been rejected in all images, it will be masked. The uncertainty of the combined image is set by the standard deviation of the input images.Parameters: scale_func : function, optional
Function to calculate the average. Defaults to
average
.scale_to : float, optional
Scaling factor used in the average combined image. If given, it overrides
CCDData.scaling
. Defaults to None.uncertainty_func: function, optional
Function to calculate uncertainty. Defaults to
numpy.ma.std
Returns: combined_image:
CCDData
CCDData object based on the combined input of CCDData objects.
-
median_combine
(median_func=<function median>, scale_to=None, uncertainty_func=<function sigma_func>)[source]¶ Median combine a set of arrays.
A
CCDData
object is returned with the data property set to the median of the arrays. If the data was masked or any data have been rejected, those pixels will not be included in the median. A mask will be returned, and if a pixel has been rejected in all images, it will be masked. The uncertainty of the combined image is set by 1.4826 times the median absolute deviation of all input images.Parameters: median_func : function, optional
Function that calculates median of a
masked_array
. Default is to usenumpy.ma.median
to calculate median.scale_to : float, optional
Scaling factor used in the average combined image. If given, it overrides
CCDData.scaling
. Defaults to None.uncertainty_func : function, optional
Function to calculate uncertainty. Defaults to
ccdproc.sigma_func
Returns: combined_image:
CCDData
CCDData object based on the combined input of CCDData objects.
Warning
The uncertainty currently calculated using the median absolute deviation does not account for rejected pixels.
-
minmax_clipping
(min_clip=None, max_clip=None)[source]¶ Mask all pixels that are below min_clip or above max_clip.
Parameters: min_clip : None or float
If specified, all pixels with values below min_clip will be masked
max_clip : None or float
If specified, all pixels with values above min_clip will be masked
-
sigma_clipping
(low_thresh=3, high_thresh=3, func=<numpy.ma.core._frommethod instance>, dev_func=<numpy.ma.core._frommethod instance>)[source]¶ - Pixels will be rejected if they 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 dev_func and the input data array. Any pixel with a deviation from the baseline value greater than that set by high_thresh or lower than that set by low_thresh will be rejected.
Parameters: low_thresh : positive float or None
Threshold for rejecting pixels that deviate below the baseline value. If negative value, then will be convert to a positive value. If None, no rejection will be done based on low_thresh.
high_thresh : positive float or None
Threshold for rejecting pixels that deviate above the baseline value. If None, no rejection will be done based on high_thresh.
func : function
Function for calculating the baseline values (i.e. mean or median). This should be a function that can handle numpy.ma.core.MaskedArray objects.
dev_func : function
Function for calculating the deviation from the baseline value (i.e. std). This should be a function that can handle numpy.ma.core.MaskedArray objects.
-