Page History
...
Code Block |
---|
m = Mask(det) m.set_mask(**kwa) # forced update of cached mask, **kwa - the same list of keyword arguments as in class Mask w/o det. mask = m.mask(**kwa) # returns cached mask, **kwa - the same list of keyword arguments as in class Mask w/o det. mask = m.mask_default() mask = m.mask_calib_or_default() # if available returns mask from "pixel_mask" calibration type, otherwise array of ones. mask = m.mask_from_status(status_bits=0xffff, gain_range_inds=(0,1,2,3,4), dtype=DTYPE_MASK) mask = m.mask_edges(width=0, edge_rows=1, edge_cols=1, dtype=DTYPE_MASK) mask = m.mask_center(wcenter=0, center_rows=1, center_cols=1, dtype=DTYPE_MASK) mask = m.mask_neighbors(mask, rad=9, ptrn='r') |
A few test examples can be found in psana/detector/testman/test_mask.py
Implementation notes
- Default combined mask parameters (status=True, neighbors=False, edges=False, center=False, calib=False, umask=None) are set to define mask for pixel_status only.
- Mask defined as m = Mask(det) and property det._mask_ is cached for combined/cumulative mask retrieved by the method mask=m.mask().
- Method m.set_mask(**kwa) or its equivalent mask = m.mask(force_update=True, ...) can be used to update cached mask, if necessary.
- Method m.mask(...) applies mask_neighbors after mask_from_status only. It this is not enough, mask needs to be constructed using separate m.mask_*(...) methods.
- Most of methods mask = m.mask_*(...) do not cache intermediate results and consume time for specific mask evaluation. To optimize computing time in analysis it would be wise to evaluate mask once per run only.
- Module psana.detector.UtilsMask contains useful methods for manual mask building, for example merge_masks(...).
References
Overview
Content Tools