Versions Compared

Key

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

...

Code Block
from pyimgalgos.RadialBkgd  import RadialBkgd, polarization_factor

nda_bkgd  = det.bkgd(runnum) # pre-defined n-d array with averaged background from calib/.../pixel_bkgd/...
nda_smask = det.mask(runnum, calib=False, status=True, edges=True, central=True, unbond=True, unbondnbrs=True)

 
mask_bkgd = nda_smask # * mask_winds_tot
rb = RadialBkgd(Xarr, Yarr, mask=mask_bkgd, radedges=(5200, 80000), nradbins=200, nphibins=1)
pf = polarization_factor(rb.pixel_rad(), rb.pixel_phi(), DIST_STOD)

    # in the event loop:
    nda_data = det.raw(evt)
    if nda_data is not None :
        nda =  np.array(nda_data, dtype=np.float32, copy=True)
        nda -= nda_peds

        #det.common_mode_apply(evt, nda, cmpars=(1,50,50,100))
        #nda = subtract_bkgd(nda, nda_bkgd, mask=nda_smask, winds=winds_bkgd, pbits=0)

        nda = rb.subtract_bkgd(nda.flatten() * pf)
        nda.shape = shape_cspad

        nda *= nda_smask

...