RectangleGate Class

class flowkit.gates.RectangleGate(gate_name, dimensions, use_complement=False)

Represents a GatingML Rectangle Gate

A RectangleGate can have one or more dimensions, and each dimension must specify at least one of a minimum or maximum value (or both). From the GatingML specification (sect. 5.1.1):

Rectangular gates are used to express range gates (n = 1, i.e., one dimension), rectangle gates (n = 2, i.e., two dimensions), box regions (n = 3, i.e., three dimensions), and hyper-rectangular regions (n > 3, i.e., more than three dimensions).

Create a RectangleGate instance.

Parameters:
  • gate_name – text string for the name of the gate

  • dimensions – list of Dimension instances used to define the gate boundaries

  • use_complement – whether to use events inside or outside gate area, default is False (inside gate area)

apply(df_events)

Apply gate to events in given pandas DataFrame. The given DataFrame must have columns matching the Dimension IDs for the Dimension instances defined for the gate.

Parameters:

df_events – pandas DataFrame with column labels matching Dimension IDs

Returns:

NumPy array of boolean values for each event. (True is inside gate)

get_dimension(dim_id)

Retrieve the Dimension instance given the dimension ID

Parameters:

dim_id – Dimension ID

Returns:

Dimension instance

get_dimension_ids()

Retrieve all gate Dimension IDs in order

Returns:

list of Dimension ID strings