FlowCytometryTools.FCPlate.subsample

FCPlate.subsample(key, order='random', auto_resize=False, ID=None)

Allows arbitrary slicing (subsampling) of the data.

Note

When using order=’random’, the sampling is random for each of the measurements in the collection.

key : [int | float | tuple | slice]

When key is a single number, it specifies a number/fraction of events to use. Use the parameter ‘order’ to specify how to subsample the requested number/fraction of events.

  • int : specifies a number of events to use
  • float : specifies a fraction of events to use (a number between 0 and 1)
  • tuple : consists of two floats, each between 0 and 1. For example, key = (0.66666, 1.0) returns the last one third of events.
  • slice : applies a slice. For example, key = slice(10, 1000, 20) returns events with indexes [10, 30, 50, …]
order : [‘random’ | ‘start’ | ‘end’]

Specifies which events to choose. This is only relevant when key is either an int or a float.

  • ‘random’ : chooses the events randomly (without replacement)
  • ‘start’ : subsamples starting from the start
  • ‘end’ : subsamples starting from the end
auto_resize : [False | True]
If True, attempts to automatically control indexing errors. For example, if there are only 1000 events in the fcs sample, but the key is set to subsample 2000 events, then an error will be raised. However, with auto_resize set to True, the key will be adjusted to 1000 events.
FCCollection or a subclass
new collection of subsampled event data.