Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pycalibration
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Analyze
Contributor 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
pycalibration
Commits
cfb4708a
Commit
cfb4708a
authored
3 years ago
by
Karim Ahmed
Browse files
Options
Downloads
Patches
Plain Diff
skip PC sanitization with constants of v1
parent
58064bfe
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!654
[AGIPD][PC] Feat/skip sanitization based on the retrieved PC's variant
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/cal_tools/agipdlib.py
+34
-24
34 additions, 24 deletions
src/cal_tools/agipdlib.py
with
34 additions
and
24 deletions
src/cal_tools/agipdlib.py
+
34
−
24
View file @
cfb4708a
...
@@ -1225,30 +1225,40 @@ class AgipdCorrections:
...
@@ -1225,30 +1225,40 @@ class AgipdCorrections:
pc_high_l_med
=
np
.
nanmedian
(
pc_high_l
,
axis
=
(
0
,
1
))
pc_high_l_med
=
np
.
nanmedian
(
pc_high_l
,
axis
=
(
0
,
1
))
pc_med_l_med
=
np
.
nanmedian
(
pc_med_l
,
axis
=
(
0
,
1
))
pc_med_l_med
=
np
.
nanmedian
(
pc_med_l
,
axis
=
(
0
,
1
))
# sanitize PC data
if
variant
==
0
:
# (it should be done already on the level of constants)
# sanitize PC data with CCV variant = 0.
# In the following loop,
# Sanitization is already done for constants
# replace `nan`s across memory cells with
# with CCV variant = 1
# the median value calculated previously.
# In the following loop,
# Then, values outside of the valid range (0.8 and 1.2)
# replace `nan`s across memory cells with
# are fixed to the median value.
# the median value calculated previously.
# This is applied for high and medium gain stages
# Then, values outside of the valid range (0.8 and 1.2)
for
i
in
range
(
self
.
max_cells
):
# are fixed to the median value.
pc_high_m
[
np
.
isnan
(
pc_high_m
[...,
i
]),
i
]
=
pc_high_med
[
i
]
# This is applied for high and medium gain stages
pc_med_m
[
np
.
isnan
(
pc_med_m
[...,
i
]),
i
]
=
pc_med_med
[
i
]
for
i
in
range
(
self
.
max_cells
):
pc_high_m
[
pc_high_l
[
np
.
isnan
(
pc_high_l
[...,
i
]),
i
]
=
pc_high_l_med
[
i
]
np
.
isnan
(
pc_high_m
[...,
i
]),
i
]
=
pc_high_med
[
i
]
pc_med_l
[
np
.
isnan
(
pc_med_l
[...,
i
]),
i
]
=
pc_med_l_med
[
i
]
pc_med_m
[
np
.
isnan
(
pc_med_m
[...,
i
]),
i
]
=
pc_med_med
[
i
]
pc_high_m
[(
pc_high_m
[...,
i
]
<
0.8
*
pc_high_med
[
i
])
|
(
pc_high_m
[...,
i
]
>
1.2
*
pc_high_med
[
i
]),
i
]
=
pc_high_med
[
i
]
# noqa
pc_high_l
[
pc_med_m
[(
pc_med_m
[...,
i
]
<
0.8
*
pc_med_med
[
i
])
|
np
.
isnan
(
pc_high_l
[...,
i
]),
i
]
=
pc_high_l_med
[
i
]
(
pc_med_m
[...,
i
]
>
1.2
*
pc_med_med
[
i
]),
i
]
=
pc_med_med
[
i
]
# noqa
pc_med_l
[
np
.
isnan
(
pc_med_l
[...,
i
]),
i
]
=
pc_med_l_med
[
i
]
pc_high_l
[(
pc_high_l
[...,
i
]
<
0.8
*
pc_high_l_med
[
i
])
|
(
pc_high_l
[...,
i
]
>
1.2
*
pc_high_l_med
[
i
]),
i
]
=
pc_high_l_med
[
i
]
# noqa
pc_high_m
[
pc_med_l
[(
pc_med_l
[...,
i
]
<
0.8
*
pc_med_l_med
[
i
])
|
(
pc_high_m
[...,
i
]
<
0.8
*
pc_high_med
[
i
])
|
(
pc_med_l
[...,
i
]
>
1.2
*
pc_med_l_med
[
i
]),
i
]
=
pc_med_l_med
[
i
]
# noqa
(
pc_high_m
[...,
i
]
>
1.2
*
pc_high_med
[
i
]),
i
]
=
pc_high_med
[
i
]
# noqa
pc_med_m
[
(
pc_med_m
[...,
i
]
<
0.8
*
pc_med_med
[
i
])
|
(
pc_med_m
[...,
i
]
>
1.2
*
pc_med_med
[
i
]),
i
]
=
pc_med_med
[
i
]
# noqa
pc_high_l
[
(
pc_high_l
[...,
i
]
<
0.8
*
pc_high_l_med
[
i
])
|
(
pc_high_l
[...,
i
]
>
1.2
*
pc_high_l_med
[
i
]),
i
]
=
pc_high_l_med
[
i
]
# noqa
pc_med_l
[
(
pc_med_l
[...,
i
]
<
0.8
*
pc_med_l_med
[
i
])
|
(
pc_med_l
[...,
i
]
>
1.2
*
pc_med_l_med
[
i
]),
i
]
=
pc_med_l_med
[
i
]
# noqa
# ration between HG and MG per pixel per mem cell used
# ration between HG and MG per pixel per mem cell used
# for rel gain calculation
# for rel gain calculation
...
...
This diff is collapsed.
Click to expand it.
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