FlowCytometryTools.FCMeasurement.transform

FCMeasurement.transform(transform, direction='forward', channels=None, return_all=True, auto_range=True, use_spln=True, get_transformer=False, ID=None, apply_now=True, args=(), **kwargs)[source]

Applies a transformation to the specified channels.

The transformation parameters are shared between all transformed channels. If different parameters need to be applied to different channels, use several calls to transform.

Parameters:
  • transform ([‘hlog’ | ‘tlog’ | ‘glog’ | callable]) –

    Specifies the transformation to apply to the data.

    • callable : a callable that does a transformation (should accept a number or array), or one of the supported named transformations.
  • direction ([‘forward’ | ‘inverse’]) – Direction of transformation.
  • channels (str | list of str | None) –

    Names of channels to transform. If None is given, all channels will be transformed.

    Warning

    Remember that transforming all channels does not always make sense. For example, when working with the time channel, one should probably keep the data as is.

  • return_all (bool) – True - return all columns, with specified ones transformed. False - return only specified columns.
  • auto_range (bool) –

    If True data range (machine range) is automatically extracted from $PnR field of metadata.

    Warning

    If the data has been previously transformed its range may not match the $PnR value. In this case, auto_range should be set to False.

  • use_spln (bool) – If True th transform is done using a spline. See Transformation.transform for more details.
  • get_transformer (bool) – If True the transformer is returned in addition to the new Measurement.
  • args – Additional positional arguments to be passed to the Transformation.
  • kwargs – Additional keyword arguments to be passed to the Transformation.
  • ID (hashable | None) – ID for the resulting collection. If None is passed, the original ID is used.
Returns:

  • new (FCMeasurement) – New measurement containing the transformed data.
  • transformer (Transformation) – The Transformation applied to the input measurement. Only returned if get_transformer=True.

Examples

>>> trans = original.transform('hlog')
>>> trans = original.transform('tlog', th=2)
>>> trans = original.transform('hlog', d=log10(2**18), auto_range=False)
>>> trans = original.transform('hlog', r=1000, use_spln=True, get_transformer=True)
>>> trans = original.transform('hlog', channels=['FSC-A', 'SSC-A'], b=500).transform('hlog', channels='B1-A', b=100)