Skip to content

Commit

Permalink
Merge pull request #80 from mwcraig/median-stuff
Browse files Browse the repository at this point in the history
Add argument for function that performs median in median_combine
  • Loading branch information
mwcraig committed May 15, 2014
2 parents 20ac8ae + c476f7e commit 1d5fcae
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions ccdproc/combiner.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,15 +168,23 @@ def sigma_clipping(self, low_thresh=3, high_thresh=3,
self.data_arr.mask[mask] = True

#set up the combining algorithms
def median_combine(self):
"""Median combine a set of arrays. A CCDData object is returned
def median_combine(self, median_func=ma.median):
"""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 ``numpy.ma.masked_array``.
Default is to use ``np.ma.median`` to calculate median.
Returns
-------
combined_image: CCDData object
Expand All @@ -189,7 +197,7 @@ def median_combine(self):
"""
#set the data
data = ma.median(self.data_arr, axis=0)
data = median_func(self.data_arr, axis=0)

#set the mask
mask = self.data_arr.mask.sum(axis=0)
Expand Down

0 comments on commit 1d5fcae

Please sign in to comment.