Issue
Implementation
igm - is a gain mode index 0,1,2 for Normal-00, Med-01, Low-11 gbits = raw>>14 # 00/01/11 - gain bits for mode 0,1,2 fg0, fg1, fg2 = gbits==0, gbits==1, gbits==3 bad = (np.logical_not(fg0),\ np.logical_not(fg1),\ np.logical_not(fg2))[igm]
Images of mask versions
User's mask
Mask from ~valmar/psana-extra-extreme-sabine2.h5 - very agressive masking
Bad pixel status as mask
mask = det.status_as_mask(par, mode=3, mstcode=63) - mask all status codes but bad gain switch
mstcode=64 - mask bad gain switch (adds <100 new bad pixels)
mstcode=127 - mask all bad status codes
- mstcode=64 strongly overlaps with 63
- mstcode=63 and 127 shows about the same mask, difference is minor...
pixel status statistics
Merged for 3 gain modes status
cxic00120 run:24 status.shape:(8, 512, 1024) size: 4194304
bad pixels w/o sw: number of pixels containing bits 63(dec) 077(oct): 3739 of total bad 3768 of total 4194304
bad pixels switch: number of pixels containing bits 64(dec) 0100(oct): 1117 of total bad 3768 of total 4194304
bad pixels total : number of pixels containing bits 127(dec) 0177(oct): 3768 of total bad 3768 of total 4194304
Bad status code 64 adds 3768-3739=29 bad pixel.
Non-merged for 3 gain modes status
cxic00120 run:24 status.shape:(3, 8, 512, 1024) size: 12582912
bad pixels w/o sw: number of pixels containing bits 63(dec) 077(oct): 6217 of total bad 6280 of total 12582912
bad pixels switch: number of pixels containing bits 64(dec) 0100(oct): 1150 of total bad 6280 of total 12582912
bad pixels total : number of pixels containing bits 127(dec) 0177(oct): 6280 of total bad 6280 of total 12582912
Bad status code 64 adds 6280-6217=63 bad pixel.
Non-merged for 3 gain modes status
cxic00120 run:42 status.shape:(3, 8, 512, 1024) size: 12582912
bad pixels w/o sw: number of pixels containing bits 63(dec) 077(oct): 7673 of total bad 7734 of total 12582912
bad pixels switch: number of pixels containing bits 64(dec) 0100(oct): 1850 of total bad 7734 of total 12582912
bad pixels total : number of pixels containing bits 127(dec) 0177(oct): 7734 of total bad 7734 of total 12582912
Bad status code 64 adds 7734-7673=61 bad pixel.
Combined mask
mask = det.mask(par, calib=False, status=True, edges=True, central=True, unbond=False, unbondnbrs=False, mode=3, width=5, wcentral=5, mstcode=0xffff)
Summary
- New bad pixel status code is added for bad gain mode switch:
[I] L0703 bad pixel status: status 1: 1240 pixel rms > 19.414 status 2: 1875 pixel rms < 0.611 status 4: 1755 pixel intensity > 16000 in more than 0.1 fraction of events status 8: 111 pixel intensity < 1 in more than 0.1 fraction of events status 16: 340 pixel average > 3761.95 status 32: 1940 pixel average < 1226.6 status 64: 1790 pixel with bad gain mode switch
- However this status bit strongly overlaps with other bad pixel status.
- User's mask contains more bad pixels in peripheral rings ???