Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
calng
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
calibration
calng
Commits
028556c5
Commit
028556c5
authored
3 years ago
by
David Hammer
Browse files
Options
Downloads
Patches
Plain Diff
Add (re)configurability of bad pixel masking value
parent
adb87351
No related branches found
No related tags found
2 merge requests
!12
Snapshot: field test deployed version as of end of run 202201
,
!3
Base correction device, CalCat interaction, DSSC and AGIPD devices
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/calng/AgipdCorrection.py
+27
-2
27 additions, 2 deletions
src/calng/AgipdCorrection.py
src/calng/agipd_gpu.py
+5
-2
5 additions, 2 deletions
src/calng/agipd_gpu.py
with
32 additions
and
4 deletions
src/calng/AgipdCorrection.py
+
27
−
2
View file @
028556c5
...
...
@@ -153,6 +153,20 @@ class AgipdCorrection(BaseCorrection):
.
reconfigurable
()
.
commit
()
)
(
STRING_ELEMENT
(
expected
)
.
key
(
"
corrections.badPixelMaskValue
"
)
.
displayedName
(
"
Bad pixel masking value
"
)
.
description
(
"
Any pixels masked by the bad pixel mask will have their value
"
"
replaced with this. Note that this setting is evaluated as a string;
"
"
use float(
'
nan
'
) to get NaN value.
"
)
.
assignmentOptional
()
.
defaultValue
(
"
float(
'
nan
'
)
"
)
.
reconfigurable
()
.
commit
()
)
@property
def
input_data_shape
(
self
):
...
...
@@ -177,7 +191,11 @@ class AgipdCorrection(BaseCorrection):
def
__init__
(
self
,
config
):
# TODO: different gpu runner for fixed gain mode
self
.
gain_mode
=
AgipdGainMode
[
config
.
get
(
"
gainMode
"
)]
self
.
_gpu_runner_init_args
=
{
"
gain_mode
"
:
self
.
gain_mode
}
self
.
bad_pixel_mask_value
=
eval
(
config
.
get
(
"
corrections.badPixelMaskValue
"
))
self
.
_gpu_runner_init_args
=
{
"
gain_mode
"
:
self
.
gain_mode
,
"
bad_pixel_mask_value
"
:
self
.
bad_pixel_mask_value
,
}
super
().
__init__
(
config
)
self
.
_output_transpose
=
{
...
...
@@ -389,6 +407,11 @@ class AgipdCorrection(BaseCorrection):
for
path
in
config
.
getPaths
()
):
self
.
_has_updated_bad_pixel_selection
=
False
if
config
.
has
(
"
corrections.badPixelMaskValue
"
):
self
.
bad_pixel_mask_value
=
eval
(
config
.
get
(
"
corrections.badPixelMaskValue
"
)
)
self
.
gpu_runner
.
set_bad_pixel_mask_value
(
self
.
bad_pixel_mask_value
)
def
postReconfigure
(
self
):
super
().
postReconfigure
()
...
...
@@ -405,4 +428,6 @@ class AgipdCorrection(BaseCorrection):
if
not
self
.
_has_updated_bad_pixel_selection
:
self
.
_update_bad_pixel_selection
()
self
.
gpu_runner
.
override_bad_pixel_flags_to_use
(
self
.
_override_bad_pixel_flags
)
self
.
gpu_runner
.
override_bad_pixel_flags_to_use
(
self
.
_override_bad_pixel_flags
)
This diff is collapsed.
Click to expand it.
src/calng/agipd_gpu.py
+
5
−
2
View file @
028556c5
...
...
@@ -36,7 +36,7 @@ class AgipdGpuRunner(base_gpu.BaseGpuRunner):
output_transpose
=
(
1
,
2
,
0
),
# default: memorycells-fast
input_data_dtype
=
cupy
.
uint16
,
output_data_dtype
=
cupy
.
float32
,
bad_pixel_mask_value
=
cupy
.
float32
(
cupy
.
nan
)
,
bad_pixel_mask_value
=
cupy
.
nan
,
gain_mode
=
AgipdGainMode
.
ADAPTIVE_GAIN
,
):
self
.
gain_mode
=
gain_mode
...
...
@@ -70,7 +70,7 @@ class AgipdGpuRunner(base_gpu.BaseGpuRunner):
self
.
md_additional_offset_gpu
=
cupy
.
zeros
(
self
.
map_shape
,
dtype
=
cupy
.
float32
)
self
.
rel_gain_xray_map_gpu
=
cupy
.
ones
(
self
.
map_shape
,
dtype
=
cupy
.
float32
)
self
.
bad_pixel_map_gpu
=
cupy
.
zeros
(
self
.
gm_map_shape
,
dtype
=
cupy
.
uint32
)
self
.
bad_pixel_mask_value
=
bad_pixel_mask_value
# TODO: make this configurable
self
.
set_
bad_pixel_mask_value
(
bad_pixel_mask_value
)
self
.
update_block_size
((
1
,
1
,
64
))
...
...
@@ -212,6 +212,9 @@ class AgipdGpuRunner(base_gpu.BaseGpuRunner):
f
"
Percentage of bad pixels now:
{
cupy
.
count_nonzero
(
self
.
bad_pixel_map_gpu
)
/
self
.
bad_pixel_map_gpu
.
size
*
100
:
.
02
f
}
"
)
def
set_bad_pixel_mask_value
(
self
,
mask_value
):
self
.
bad_pixel_mask_value
=
cupy
.
float32
(
mask_value
)
def
flush_buffers
(
self
):
self
.
offset_map_gpu
.
fill
(
0
)
self
.
rel_gain_pc_map_gpu
.
fill
(
1
)
...
...
This diff is collapsed.
Click to expand it.
David Hammer
@hammerd
mentioned in commit
3566342d
·
2 years ago
mentioned in commit
3566342d
mentioned in commit 3566342d031db1bb435b6430f100afdbaaa6c4bf
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment