Transforms a statistic.
xform_stat has one class:
TransformStatisticOp – apply a function to a statistic, making a new statistic.
- class cytoflow.operations.xform_stat.TransformStatisticOp¶
Apply a function to a statistic, creating a new statistic. The function can be applied to the entire statistic, or it can be applied individually to groups of the statistic. The function should take a
pandas.Seriesas its only argument. Return type is arbitrary, but a to be used with the rest of
cytoflowit should probably be a numeric type or an iterable of numeric types.
As a special case, if the function returns a
pandas.Serieswith the same index that it was passed, it is interpreted as a transformation. The resulting statistic will have the same length, index names and index levels as the original statistic.
The operation name. Becomes the first element in the
The statistic to apply the function to.
The function used to transform the statistic.
functionmust take a
pandas.Seriesas its only parameter. The return type is arbitrary, but to work 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
The name of the function; if present, becomes the second element in the
A list of metadata attributes to aggregate the input statistic before applying the function. For example, if the statistic has two indices
by = ["Time", "Dox"]will apply
functionseparately to each subset of the data with a unique combination of
Value to use in the statistic if a slice of the data is empty.
Any (default = 0)
>>> stats_op = ChannelStatisticOp(name = "Mean", ... channel = "Y2-A", ... function = np.mean, ... by = ["Dox"]) >>> ex2 = stats_op.apply(ex) >>> log_op = TransformStatisticOp(name = "LogMean", ... statistic = ("Mean", "mean"), ... function = np.log) >>> ex3 = log_op.apply(ex2)