Skip to content
Snippets Groups Projects

Switch BadPixels{,FF} base class to enum.IntFlag

Merged David Hammer requested to merge feat/use-enum-intflag into master
Files
5
@@ -5,12 +5,12 @@ from typing import Any, Dict, Optional, Tuple
import h5py
import numpy as np
import sharedmem
from cal_tools.agipdutils import *
from cal_tools.enums import BadPixels, SnowResolution
from cal_tools.tools import get_constant_from_db_and_time
from iCalibrationDB import Conditions, Constants, Detectors
from cal_tools.agipdutils import *
from cal_tools.cython import agipdalgs as calgs
from cal_tools.enums import BadPixels, SnowResolution
from cal_tools.tools import get_constant_from_db_and_time
def get_num_cells(fname, loc, module):
@@ -458,7 +458,7 @@ class AgipdCorrections:
for c in cells:
std = np.nanstd(data[cellid == c, ...], axis=0)
mask_std[:, c, std == 0] |= BadPixels.DATA_STD_IS_ZERO.value
mask_std[:, c, std == 0] |= BadPixels.DATA_STD_IS_ZERO
def offset_correction(self, i_proc: int, first: int, last: int):
"""
@@ -659,7 +659,7 @@ class AgipdCorrections:
if self.corr_bools.get("zero_nans"):
bidx = ~np.isfinite(data)
data[bidx] = 0
msk[bidx] |= BadPixels.VALUE_IS_NAN.value
msk[bidx] |= BadPixels.VALUE_IS_NAN
del bidx
# Add pixels with unrealistically high and low values to the mask.
@@ -667,7 +667,7 @@ class AgipdCorrections:
if self.corr_bools.get("zero_orange"):
bidx = (data < -1e7) | (data > 1e7)
data[bidx] = 0
msk[bidx] |= BadPixels.VALUE_OUT_OF_RANGE.value
msk[bidx] |= BadPixels.VALUE_OUT_OF_RANGE
del bidx
# Mask entire ADC if they are noise above a threshold
Loading