Skip to content

Commit

Permalink
Merge pull request #82 from crawfordsm/sigma_clip_stack_bug
Browse files Browse the repository at this point in the history
Fix bug in sigma_clip so it does it for each pixel
  • Loading branch information
mwcraig committed May 21, 2014
2 parents 84e1d38 + 52f6685 commit 530bb1f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ccdproc/combiner.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ def sigma_clipping(self, low_thresh=3, high_thresh=3,
#check for negative numbers in low_thresh

#setup baseline values
baseline = func(self.data_arr)
dev = dev_func(self.data_arr)
baseline = func(self.data_arr, axis=0)
dev = dev_func(self.data_arr, axis=0)
#reject values
if low_thresh is not None:
if low_thresh < 0:
Expand Down
18 changes: 18 additions & 0 deletions ccdproc/tests/test_combiner.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,24 @@ def test_combiner_sigmaclip_high():
dev_func=mad)
assert c.data_arr[5].mask.all()

def test_combiner_sigmaclip_single_pix():
ccd_list = [CCDData(np.zeros((10, 10)), unit=u.adu),
CCDData(np.zeros((10, 10)) - 10, unit=u.adu),
CCDData(np.zeros((10, 10)) + 10, unit=u.adu),
CCDData(np.zeros((10, 10)) - 10, unit=u.adu),
CCDData(np.zeros((10, 10)) + 10, unit=u.adu),
CCDData(np.zeros((10, 10)) - 10, unit=u.adu)]
c = Combiner(ccd_list)
#add a single pixel in another array to check that
#that one gets rejected
c.data_arr[0,5,5] = 0
c.data_arr[1,5,5] = -5
c.data_arr[2,5,5] = 5
c.data_arr[3,5,5] = -5
c.data_arr[4,5,5] = 25
c.sigma_clipping(high_thresh=3, low_thresh=None, func=np.median,
dev_func=mad)
assert c.data_arr.mask[4,5,5] == True

def test_combiner_sigmaclip_low():
ccd_list = [CCDData(np.zeros((10, 10)), unit=u.adu),
Expand Down

0 comments on commit 530bb1f

Please sign in to comment.