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
cdacb787
Commit
cdacb787
authored
3 years ago
by
David Hammer
Browse files
Options
Downloads
Patches
Plain Diff
Reuse correction flag enum definition
parent
9c1fee01
No related branches found
Branches containing commit
No related tags found
Tags containing commit
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
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/calng/agipd_gpu.py
+1
-0
1 addition, 0 deletions
src/calng/agipd_gpu.py
src/calng/agipd_gpu_kernels.cpp
+6
-11
6 additions, 11 deletions
src/calng/agipd_gpu_kernels.cpp
src/calng/utils.py
+8
-0
8 additions, 0 deletions
src/calng/utils.py
with
15 additions
and
11 deletions
src/calng/agipd_gpu.py
+
1
−
0
View file @
cdacb787
...
...
@@ -145,6 +145,7 @@ class AgipdGpuRunner(base_gpu.BaseGpuRunner):
"
constant_memory_cells
"
:
self
.
constant_memory_cells
,
"
input_data_dtype
"
:
utils
.
np_dtype_to_c_type
(
self
.
input_data_dtype
),
"
output_data_dtype
"
:
utils
.
np_dtype_to_c_type
(
self
.
output_data_dtype
),
"
corr_enum
"
:
utils
.
enum_to_c_template
(
CorrectionFlags
),
}
)
self
.
source_module
=
cupy
.
RawModule
(
code
=
kernel_source
)
...
...
This diff is collapsed.
Click to expand it.
src/calng/agipd_gpu_kernels.cpp
+
6
−
11
View file @
cdacb787
#include
<cuda_fp16.h>
#include
<math_constants.h>
const
unsigned
char
CORR_THRESHOLD
=
1
;
const
unsigned
char
CORR_OFFSET
=
2
;
const
unsigned
char
CORR_BLSHIFT
=
4
;
const
unsigned
char
CORR_REL_GAIN_PC
=
8
;
const
unsigned
char
CORR_REL_GAIN_XRAY
=
16
;
const
unsigned
char
CORR_BPMASK
=
32
;
{{
corr_enum
}}
extern
"C"
{
/*
...
...
@@ -82,7 +77,7 @@ extern "C" {
if
(
map_cell
<
map_cells
)
{
unsigned
char
gain
=
0
;
if
(
corr_flags
&
CORR_
THRESHOLD
)
{
if
(
corr_flags
&
THRESHOLD
)
{
const
float
threshold_0
=
threshold_map
[
0
*
threshold_map_stride_threshold
+
map_cell
*
threshold_map_stride_cell
+
y
*
threshold_map_stride_y
+
...
...
@@ -110,20 +105,20 @@ extern "C" {
y
*
gm_map_stride_y
+
x
*
gm_map_stride_x
;
if
((
corr_flags
&
CORR_
BPMASK
)
&&
bad_pixel_map
[
gm_map_index
])
{
if
((
corr_flags
&
BPMASK
)
&&
bad_pixel_map
[
gm_map_index
])
{
corrected
=
CUDART_NAN_F
;
}
else
{
if
(
corr_flags
&
CORR_
OFFSET
)
{
if
(
corr_flags
&
OFFSET
)
{
corrected
-=
offset_map
[
gm_map_index
];
}
// TODO: baseline shift
if
(
corr_flags
&
CORR_
REL_GAIN_PC
)
{
if
(
corr_flags
&
REL_GAIN_PC
)
{
corrected
*=
rel_gain_pc_map
[
gm_map_index
];
if
(
gain
==
1
)
{
corrected
+=
md_additional_offset
[
map_index
];
}
}
if
(
corr_flags
&
CORR_
REL_GAIN_XRAY
)
{
if
(
corr_flags
&
REL_GAIN_XRAY
)
{
// TODO
//corrected *= rel_gain_xray_map[map_index];
}
...
...
This diff is collapsed.
Click to expand it.
src/calng/utils.py
+
8
−
0
View file @
cdacb787
...
...
@@ -31,6 +31,14 @@ def np_dtype_to_c_type(dtype):
return
_np_typechar_to_c_typestring
[
as_char
]
def
enum_to_c_template
(
enum_class
):
res
=
[
f
"
enum
{
enum_class
.
__name__
}
{{
"
]
for
field
in
enum_class
:
res
.
append
(
f
"
\t
{
field
.
name
}
=
{
field
.
value
}
,
"
)
res
.
append
(
"
};
"
)
return
"
\n
"
.
join
(
res
)
def
ceil_div
(
num
,
denom
):
return
(
num
+
denom
-
1
)
//
denom
...
...
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