mirror of
https://github.com/paulscherrerinstitute/sf_daq_broker.git
synced 2026-08-31 09:20:44 +02:00
made loop a bit clearer
This commit is contained in:
@@ -312,20 +312,18 @@ def create_pedestal_file(
|
|||||||
gains = [None] * 3
|
gains = [None] * 3
|
||||||
gainsRMS = [None] * 3
|
gainsRMS = [None] * 3
|
||||||
|
|
||||||
for gain in range(4):
|
for gain in (0, 1, 3):
|
||||||
if gain == 2:
|
gv = 2 if gain == 3 else gain
|
||||||
continue
|
|
||||||
g = gain if gain < 3 else gain - 1
|
|
||||||
numberFramesAverage = max(1, min(frames_average, nMgain[gain]))
|
numberFramesAverage = max(1, min(frames_average, nMgain[gain]))
|
||||||
mean = adcValuesN[gain] / float(numberFramesAverage)
|
mean = adcValuesN[gain] / float(numberFramesAverage)
|
||||||
mean2 = adcValuesNN[gain] / float(numberFramesAverage)
|
mean2 = adcValuesNN[gain] / float(numberFramesAverage)
|
||||||
variance = mean2 - np.float_power(mean, 2)
|
variance = mean2 - np.float_power(mean, 2)
|
||||||
stdDeviation = np.sqrt(variance)
|
stdDeviation = np.sqrt(variance)
|
||||||
_logger.debug(f"{detector_name}: results for gain {gain}: test pixel ({tY}, {tX}), mean: {mean[tY][tX]}, stddev: {stdDeviation[tY][tX]}")
|
_logger.debug(f"{detector_name}: results for gain {gain}: test pixel ({tY}, {tX}), mean: {mean[tY][tX]}, stddev: {stdDeviation[tY][tX]}")
|
||||||
gains[g] = mean
|
gains[gv] = mean
|
||||||
gainsRMS[g] = stdDeviation
|
gainsRMS[gv] = stdDeviation
|
||||||
|
|
||||||
pixelMask[np.isclose(stdDeviation, 0)] |= (1 << (6 + g))
|
pixelMask[np.isclose(stdDeviation, 0)] |= (1 << (6 + gv))
|
||||||
|
|
||||||
with h5py.File(full_fileNameOut, "w") as outFile:
|
with h5py.File(full_fileNameOut, "w") as outFile:
|
||||||
outFile.create_dataset("pixel_mask", data=pixelMask)
|
outFile.create_dataset("pixel_mask", data=pixelMask)
|
||||||
|
|||||||
Reference in New Issue
Block a user