Skip to content

Commit

Permalink
Merge 0c3187d into ac9bee7
Browse files Browse the repository at this point in the history
  • Loading branch information
heidtna committed Oct 27, 2014
2 parents ac9bee7 + 0c3187d commit 213c048
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 5 additions & 2 deletions ccdproc/combiner.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,13 @@ class Combiner(object):
"""

def __init__(self, ccd_list):
def __init__(self, ccd_list, dtype=None):
if ccd_list is None:
raise TypeError("ccd_list should be a list of CCDData objects")

if dtype is None:
dtype = np.float64

default_shape = None
default_unit = None
for ccd in ccd_list:
Expand Down Expand Up @@ -75,7 +78,7 @@ def __init__(self, ccd_list):
#set up the data array
ydim, xdim = default_shape
new_shape = (len(ccd_list), ydim, xdim)
self.data_arr = ma.masked_all(new_shape)
self.data_arr = ma.masked_all(new_shape, dtype=dtype)

#populate self.data_arr
for i, ccd in enumerate(ccd_list):
Expand Down
7 changes: 7 additions & 0 deletions ccdproc/tests/test_combiner.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@ def test_combiner_create(ccd_data):
assert c.data_arr.mask.shape == (3, 100, 100)


#test if dtype matches the value that is passed
def test_combiner_dtype(ccd_data):
ccd_list = [ccd_data, ccd_data, ccd_data]
c = Combiner(ccd_list, dtype = np.float32)
assert c.data_arr.dtype == np.float32


#test mask is created from ccd.data
def test_combiner_mask(ccd_data):
data = np.zeros((10, 10))
Expand Down

0 comments on commit 213c048

Please sign in to comment.