Skip to content

Commit

Permalink
Merge branch 'master' of git://github.com/astropy/ccdproc
Browse files Browse the repository at this point in the history
  • Loading branch information
mwcraig committed Jul 16, 2014
2 parents 89606a5 + 2de0289 commit 00b623d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
2 changes: 1 addition & 1 deletion ccdproc/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1096,7 +1096,7 @@ def cosmicray_clean(ccd, thresh, cr_func, crargs={},
if newccd.mask is None:
newccd.mask = crarr
else:
newccd.mask = newccd.mask + crarr.mask
newccd.mask = newccd.mask + crarr

# grow the pixels
if gbox > 0:
Expand Down
8 changes: 4 additions & 4 deletions ccdproc/tests/test_ccddata.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ def test_fromMEF(ccd_data, tmpdir):

def test_metafromheader(ccd_data):
hdr = fits.header.Header()
hdr.set('observer', 'Edwin Hubble')
hdr.set('exptime', '3600')
hdr['observer'] = 'Edwin Hubble'
hdr['exptime'] = '3600'

d1 = CCDData(np.ones((5, 5)), meta=hdr, unit=u.electron)
assert d1.meta['OBSERVER'] == 'Edwin Hubble'
Expand All @@ -130,8 +130,8 @@ def test_metafromdict():

def test_header2meta():
hdr = fits.header.Header()
hdr.set('observer', 'Edwin Hubble')
hdr.set('exptime', '3600')
hdr['observer'] = 'Edwin Hubble'
hdr['exptime'] = '3600'

d1 = CCDData(np.ones((5, 5)), unit=u.electron)
d1.header = hdr
Expand Down
15 changes: 15 additions & 0 deletions ccdproc/tests/test_cosmicray.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,21 @@ def test_cosmicray_clean_gbox(ccd_data):
assert abs(data.std() - scale) < 0.1
assert cc.mask.sum() > NCRAYS

@pytest.mark.data_scale(DATA_SCALE)
def test_cosmicray_clean_mask(ccd_data):
scale = DATA_SCALE # yuck. Maybe use pytest.parametrize?
threshold = 5
add_cosmicrays(ccd_data, scale, threshold, ncrays=NCRAYS)
cc = ccd_data # currently here because no copy command for NDData
cc.mask = (ccd_data.data==0)
cc = cosmicray_clean(cc, 5.0, cosmicray_median, crargs=(11,),
background=background_variance_box, bargs=(25,),
rbox=0, gbox=5)
data = np.ma.masked_array(cc.data, cc.mask)
assert abs(data.std() - scale) < 0.1
assert cc.mask.sum() > NCRAYS



@pytest.mark.data_scale(DATA_SCALE)
def test_cosmicray_clean(ccd_data):
Expand Down

0 comments on commit 00b623d

Please sign in to comment.