Skip to content
Snippets Groups Projects
Commit cfb4708a authored by Karim Ahmed's avatar Karim Ahmed
Browse files

skip PC sanitization with constants of v1

parent 58064bfe
No related branches found
No related tags found
1 merge request!654[AGIPD][PC] Feat/skip sanitization based on the retrieved PC's variant
...@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment