made loop a bit clearer

This commit is contained in:
2024-02-11 23:49:34 +01:00
committed by Auf keinen Fall Jens
parent 8cc0f8c031
commit b8d8aedb89
+5 -7
View File
@@ -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)