dcnum.feat.gate =============== .. py:module:: dcnum.feat.gate .. autoapi-nested-parse:: Feature gating Classes ------- .. autoapisummary:: dcnum.feat.gate.Gate Module Contents --------------- .. py:class:: Gate(data, *, online_gates: bool = False, size_thresh_mask: int | None = None) Gate feature data :param data: dcnum data instance :type data: .hdf5_data.HDF5Data :param online_gates: 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 :type online_gates: bool :param size_thresh_mask: 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. :type size_thresh_mask: int .. py:attribute:: _default_size_thresh_mask :value: 10 the default value for `size_thresh_mask` if not given as kwarg .. py:attribute:: box_gates box gating (value range for each feature) .. py:attribute:: kwargs gating keyword arguments .. py:method:: _extract_online_gates(data) .. py:property:: features Sorted list of feature gates defined .. py:method:: get_ppid() 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 .. py:method:: get_ppid_code() :classmethod: .. py:method:: get_ppid_from_ppkw(kwargs) :classmethod: return full pipeline identifier from the given keywords .. py:method:: get_ppkw_from_ppid(gate_ppid) :staticmethod: .. py:method:: gate_event(event) Return None if the event should not be used, else `event` .. py:method:: gate_events(events) Return boolean array with events that should be used .. py:method:: gate_feature(feat: str, data: numbers.Number | numpy.ndarray) 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). .. py:method:: gate_mask(mask, mask_sum=None) Gate the mask, return False if the mask should not be used :param mask: The boolean mask image for the event. :type mask: 2d ndarray :param mask_sum: The sum of the mask (if not specified, it is computed) :type mask_sum: int