Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bob
bob.io.stream
Commits
a79df6b1
Commit
a79df6b1
authored
Aug 07, 2020
by
Vincent POLLET
Browse files
Refactor subtract_dark filter to subtract, change implementation to avoid type casting
parent
615981af
Changes
1
Hide whitespace changes
Inline
Side-by-side
bob/io/stream/stream.py
View file @
a79df6b1
...
...
@@ -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
)
################################################################################
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment