Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Test Data

Looking at det.raw(eatevt) it appears inner panels for xcs1008621 run 340 are in fixed-low-gain mode and outer panels are in fixed-high-gain mode:

The first few events:

   

Test Script And Results

...

Code Block
languagepy
from psana import *
import numpy as np
import matplotlib.pyplot as plt
from skimage.measure import shannon_entropy
import gzip
ds = DataSource('exp=xcsl1008621:run=340')
det = Detector('epix10k2M')
ref=None
for nevt,evt in enumerate(ds.events()):
    raw = (det.raw(evt).astype(np.int32))&0xbfff # eliminate gain bit
    img = det.image(evt)
    img_med = np.median(img[612:680,663:726]) # a "normalization area" in the water-ring
    if ref is None:
        ref = raw
        ref_med = img_med
    residuals = (raw-(img_med/ref_med)*ref).astype(np.int16)
    f = open('junk%d.dat'%nevt,'w')
    residuals.tofile(f)
    f.close()
    #plt.hist(residuals.flatten(),bins=1000)
    #plt.show()
    print(shannon_entropy(residuals),shannon_entropy(det.raw(evt))
    if nevt==4: break

...