dcnum.feat.gate

Feature gating

Classes

Gate

Gate feature data

Module Contents

class dcnum.feat.gate.Gate(data, *, online_gates: bool = False, size_thresh_mask: int | None = None)[source]

Gate feature data

Parameters:
  • data (.hdf5_data.HDF5Data) – dcnum data instance

  • online_gates (bool) – set to True to enable gating with “online” gates stored in the input file; online gates are applied in real-time deformability cytometry before writing data to disk during a measurement

  • size_thresh_mask (int) – Only masks with more pixels than size_thresh_mask are considered to be a valid event; Originally, the bin area min / trig_thresh value defaulted to 200 which is too large; defaults to 10 or the original value in case online_gates is set.

_default_size_thresh_mask = 10

the default value for size_thresh_mask if not given as kwarg

box_gates

box gating (value range for each feature)

kwargs

gating keyword arguments

_extract_online_gates(data)[source]
property features

Sorted list of feature gates defined

get_ppid()[source]

Return a unique gating pipeline identifier

The pipeline identifier is universally applicable and must be backwards-compatible (future versions of dcnum will correctly acknowledge the ID).

The gating pipeline ID is defined as:

KEY:KW_GATE

Where KEY is e.g. “online_gates”, and KW_GATE is the corresponding value, e.g.:

online_gates=True^size_thresh_mask=5
classmethod get_ppid_code()[source]
classmethod get_ppid_from_ppkw(kwargs)[source]

return full pipeline identifier from the given keywords

static get_ppkw_from_ppid(gate_ppid)[source]
gate_event(event)[source]

Return None if the event should not be used, else event

gate_events(events)[source]

Return boolean array with events that should be used

gate_feature(feat: str, data: numbers.Number | numpy.ndarray)[source]

Return boolean indicating whether data value is in box gate

data may be a number or an array. If no box filter is defined for feat, True is always returned. Otherwise, either a boolean or a boolean array is returned, depending on the type of data. Not that np.logical_and can deal with mixed argument types (scalar and array).

gate_mask(mask, mask_sum=None)[source]

Gate the mask, return False if the mask should not be used

Parameters:
  • mask (2d ndarray) – The boolean mask image for the event.

  • mask_sum (int) – The sum of the mask (if not specified, it is computed)