BooleanGate Class

class flowkit.gates.BooleanGate(gate_name, bool_type, gate_refs)

Represents a GatingML Boolean Gate.

A BooleanGate performs the boolean operations AND, OR, or NOT on one or more other gates. Note, the boolean operation XOR is not supported in the GatingML specification but can be implemented using a combination of the supported operations.

Create a BooleanGate instance.

A gate reference is a dictionary containing keywords ref, path, and complement. The ref keyword is a text string referencing an existing gate ID. The path is a tuple of that gate’s full gate path. The complement is a boolean flag specifying whether to use the boolean complement (i.e. “NOT”).

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

  • bool_type – string specifying boolean type. Accepted values: and, or, and not (case-insensitive)

  • gate_refs – list of “gate reference” dictionaries (see above description of a gate reference)

apply(df_events)

Apply gate to events in given pandas DataFrame. The given DataFrame must have columns matching the ref keys of the gate_refs list of dictionaries.

Parameters:

df_events – pandas DataFrame with column labels matching gate_refs ‘ref’ keys

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