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
84fe0e9f
Commit
84fe0e9f
authored
3 years ago
by
David Hammer
Browse files
Options
Downloads
Patches
Plain Diff
Add gain map preview layer to JungfrauCorrection
parent
b586b980
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!12
Snapshot: field test deployed version as of end of run 202201
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/calng/JungfrauCorrection.py
+19
-5
19 additions, 5 deletions
src/calng/JungfrauCorrection.py
with
19 additions
and
5 deletions
src/calng/JungfrauCorrection.py
+
19
−
5
View file @
84fe0e9f
...
@@ -5,6 +5,7 @@ import numpy as np
...
@@ -5,6 +5,7 @@ import numpy as np
from
karabo.bound
import
(
from
karabo.bound
import
(
DOUBLE_ELEMENT
,
DOUBLE_ELEMENT
,
KARABO_CLASSINFO
,
KARABO_CLASSINFO
,
OUTPUT_CHANNEL
,
OVERWRITE_ELEMENT
,
OVERWRITE_ELEMENT
,
STRING_ELEMENT
,
STRING_ELEMENT
,
VECTOR_STRING_ELEMENT
,
VECTOR_STRING_ELEMENT
,
...
@@ -12,7 +13,7 @@ from karabo.bound import (
...
@@ -12,7 +13,7 @@ from karabo.bound import (
from
.
import
base_gpu
,
calcat_utils
,
utils
from
.
import
base_gpu
,
calcat_utils
,
utils
from
._version
import
version
as
deviceVersion
from
._version
import
version
as
deviceVersion
from
.base_correction
import
BaseCorrection
,
add_correction_step_schema
from
.base_correction
import
BaseCorrection
,
add_correction_step_schema
,
preview_schema
_pretend_pulse_table
=
np
.
arange
(
16
,
dtype
=
np
.
uint8
)
_pretend_pulse_table
=
np
.
arange
(
16
,
dtype
=
np
.
uint8
)
...
@@ -58,8 +59,8 @@ class JungfrauGpuRunner(base_gpu.BaseGpuRunner):
...
@@ -58,8 +59,8 @@ class JungfrauGpuRunner(base_gpu.BaseGpuRunner):
# TODO: avoid superclass creating cell table with wrong dtype first
# TODO: avoid superclass creating cell table with wrong dtype first
self
.
cell_table_gpu
=
cupy
.
empty
(
self
.
memory_cells
,
dtype
=
cupy
.
uint8
)
self
.
cell_table_gpu
=
cupy
.
empty
(
self
.
memory_cells
,
dtype
=
cupy
.
uint8
)
self
.
input_gain_map_gpu
=
cupy
.
empty
(
self
.
input_shape
,
dtype
=
cupy
.
uint8
)
self
.
input_gain_map_gpu
=
cupy
.
empty
(
self
.
input_shape
,
dtype
=
cupy
.
uint8
)
self
.
preview_buffer_getters
.
append
(
self
.
_get_gain_map_for_preview
)
self
.
map_shape
=
(
self
.
constant_memory_cells
,
self
.
pixels_y
,
self
.
pixels_x
,
3
)
self
.
map_shape
=
(
self
.
constant_memory_cells
,
self
.
pixels_y
,
self
.
pixels_x
,
3
)
# is jungfrau stuff gain mapped?
self
.
offset_map_gpu
=
cupy
.
zeros
(
self
.
map_shape
,
dtype
=
cupy
.
float32
)
self
.
offset_map_gpu
=
cupy
.
zeros
(
self
.
map_shape
,
dtype
=
cupy
.
float32
)
self
.
rel_gain_map_gpu
=
cupy
.
ones
(
self
.
map_shape
,
dtype
=
cupy
.
float32
)
self
.
rel_gain_map_gpu
=
cupy
.
ones
(
self
.
map_shape
,
dtype
=
cupy
.
float32
)
self
.
bad_pixel_map_gpu
=
cupy
.
zeros
(
self
.
map_shape
,
dtype
=
cupy
.
uint32
)
self
.
bad_pixel_map_gpu
=
cupy
.
zeros
(
self
.
map_shape
,
dtype
=
cupy
.
uint32
)
...
@@ -93,6 +94,9 @@ class JungfrauGpuRunner(base_gpu.BaseGpuRunner):
...
@@ -93,6 +94,9 @@ class JungfrauGpuRunner(base_gpu.BaseGpuRunner):
def
_get_corrected_for_preview
(
self
):
def
_get_corrected_for_preview
(
self
):
return
self
.
processed_data_gpu
return
self
.
processed_data_gpu
def
_get_gain_map_for_preview
(
self
):
return
self
.
input_gain_map_gpu
def
load_data
(
self
,
image_data
,
input_gain_map
,
cell_table
):
def
load_data
(
self
,
image_data
,
input_gain_map
,
cell_table
):
"""
Experiment: loading all three in one function as they are tied
"""
"""
Experiment: loading all three in one function as they are tied
"""
self
.
input_data_gpu
.
set
(
image_data
)
self
.
input_data_gpu
.
set
(
image_data
)
...
@@ -270,6 +274,13 @@ class JungfrauCorrection(BaseCorrection):
...
@@ -270,6 +274,13 @@ class JungfrauCorrection(BaseCorrection):
.
commit
(),
.
commit
(),
)
)
(
OUTPUT_CHANNEL
(
expected
)
.
key
(
"
preview.outputGainMap
"
)
.
dataSchema
(
preview_schema
)
.
commit
(),
)
JungfrauCalcatFriend
.
add_schema
(
expected
,
JungfrauCorrection
.
_managed_keys
)
JungfrauCalcatFriend
.
add_schema
(
expected
,
JungfrauCorrection
.
_managed_keys
)
add_correction_step_schema
(
add_correction_step_schema
(
expected
,
expected
,
...
@@ -352,9 +363,11 @@ class JungfrauCorrection(BaseCorrection):
...
@@ -352,9 +363,11 @@ class JungfrauCorrection(BaseCorrection):
_pretend_pulse_table
,
_pretend_pulse_table
,
warn_func
=
self
.
log_status_warn
,
warn_func
=
self
.
log_status_warn
,
)
)
preview_raw
,
preview_corrected
=
self
.
kernel_runner
.
compute_previews
(
(
preview_slice_index
preview_raw
,
)
preview_corrected
,
preview_gain_map
)
=
self
.
kernel_runner
.
compute_previews
(
preview_slice_index
)
# reusing input data hash for sending
# reusing input data hash for sending
data_hash
.
set
(
self
.
_image_data_path
,
buffer_handle
)
data_hash
.
set
(
self
.
_image_data_path
,
buffer_handle
)
...
@@ -367,6 +380,7 @@ class JungfrauCorrection(BaseCorrection):
...
@@ -367,6 +380,7 @@ class JungfrauCorrection(BaseCorrection):
(
(
(
"
preview.outputRaw
"
,
preview_raw
),
(
"
preview.outputRaw
"
,
preview_raw
),
(
"
preview.outputCorrected
"
,
preview_corrected
),
(
"
preview.outputCorrected
"
,
preview_corrected
),
(
"
preview.outputGainMap
"
,
preview_gain_map
),
),
),
train_id
,
train_id
,
source
,
source
,
...
...
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