PolygonGate Class

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

Represents a GatingML Polygon Gate

A PolygonGate must have exactly 2 dimensions, and must specify at least three vertices. Polygons can have crossing boundaries, and interior regions are defined by the winding number method:

https://en.wikipedia.org/wiki/Winding_number

Create a PolygonGate instance.

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

  • dimensions – list of Dimension instances

  • vertices – list of 2-D coordinates used to define gate boundary

  • 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