Commit a79df6b1 authored by Vincent POLLET's avatar Vincent POLLET
Browse files

Refactor subtract_dark filter to subtract, change implementation to avoid type casting

parent 615981af
......@@ -528,7 +528,7 @@ class StreamReproject(StreamFilter):
image_points=image_points)
### subtract dark frame ###
@stream_filter('subtract_dark')
@stream_filter('subtract')
class StreamSubtractDark(StreamFilter):
def __init__(self, dark, name, parent):
......@@ -540,14 +540,10 @@ class StreamSubtractDark(StreamFilter):
self.dark.set_source(src)
def process(self, data, indices):
dtype = data.dtype
data = data.astype(np.float)
dark_data = self.dark.load(indices)
assert data.shape == dark_data.shape
dark_data = dark_data.astype(np.float)
data = data - dark_data
data[data < 0.] = 0.
return data.astype(dtype)
# if data > dark_data: return data - dark-data, else return 0 (substraction of uint can be problematic)
return np.where(data > dark_data, data - dark_data, 0)
################################################################################
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment