frame_stat module contains one class:
FrameStatisticOp – applies a function to subsets of a data set,
and adds the resulting statistic to the
ChannelStatisticOp, which operates on a single channel, this operation
operates on entire
- class cytoflow.operations.frame_stat.FrameStatisticOp¶
Apply a function to subsets of a data set, and add it as a statistic to the experiment.
applyfunction groups the data by the variables in
by, then applies the
functioncallable to each
pandas.DataFramesubset. The callable should take a
pandas.DataFrameas its only parameter. The return type is arbitrary, but to be used with the rest of
cytoflowit should probably be a numeric type or an iterable of numeric types.
The operation name. Becomes the first element in the
The function used to compute the statistic. Must take a
pandas.DataFrameas its only argument. The return type is arbitrary, but to be used with the rest of
cytoflowit should probably be a numeric type or an iterable of numeric types. If
statistic_nameis unset, the name of the function becomes the second in element in the
A list of metadata attributes to aggregate the data before applying the function. For example, if the experiment has two pieces of metadata,
by = ["Time", "Dox"]will apply
functionseparately to each subset of the data with a unique combination of
A Python expression sent to Experiment.query() to subset the data before computing the statistic.
The value to use in the statistic if a slice of the data is empty.
Any (default = 0)
>>> stats_op = FrameStatisticOp(name = "ByDox", ... function = lambda x: np.mean(x["FITC-A"], ... statistic_name = "Mean", ... by = ["Dox"]) >>> ex2 = stats_op.apply(ex)