It turns out that it is not a good idea to have a single box to get the statistics for flat normalization. That is a good reason for doing all the processing and cleaning and THEN merge the images. That is exactly how Luciano Fraga does in his PySOAR.samipipe.
I will not change my whole software now but I will work on a workaround. By now, I will save the area that corresponds to each detector and, then, I will calculate the normalization factor near the center of the total image but in each detector individually.
It turns out that it is not a good idea to have a single box to get the statistics for flat normalization. That is a good reason for doing all the processing and cleaning and THEN merge the images. That is exactly how Luciano Fraga does in his PySOAR.samipipe.
I will not change my whole software now but I will work on a workaround. By now, I will save the area that corresponds to each detector and, then, I will calculate the normalization factor near the center of the total image but in each detector individually.