the matrix for storing bad pixels, fmask is always the same size as all the diffraction patterns, 3D. For data as large as 256^4, the fmask can use memory (GPU!) up to 16 GB! For most of the data, fmask may not change for different diffraction, then fmask should only be a single 2D matrix instead of 3D. Even if fmask is pattern dependent, bad pixels are only a small fraction. Using the indexes of bad pixels instead of a 3D matrix with many ones can save a lot of memory.
the matrix for storing bad pixels, fmask is always the same size as all the diffraction patterns, 3D. For data as large as 256^4, the fmask can use memory (GPU!) up to 16 GB! For most of the data, fmask may not change for different diffraction, then fmask should only be a single 2D matrix instead of 3D. Even if fmask is pattern dependent, bad pixels are only a small fraction. Using the indexes of bad pixels instead of a 3D matrix with many ones can save a lot of memory.