cytoflow.utility.scale

Base classes and functions for cytoflow scales.

IScale – the traits.has_traits.Interface that scales must implement

ScaleMixin – provides useful functionality that scales can inherit

scale_factory – make a new instance of a scale

register_scale – register a new type of scale

set_default_scale, get_default_scale – sets and gets the default scale

class cytoflow.utility.scale.IScale(adaptee, default=<class 'traits.adaptation.adaptation_error.AdaptationError'>)[source]

Bases: traits.has_traits.Interface

An interface for various ways we could rescale flow data.

name

The name of this view (for serialization, UI, etc.)

Type

Str

experiment

The experiment this scale is to be applied to. Needed because some scales have parameters estimated from data.

Type

Instance(Experiment)

channel

Which channel to scale. Needed because some scales have parameters estimated from data.

Type

Str

condition

What condition to scale. Needed because some scales have parameters estimated from the a condition. Must be a numeric condition; else instantiating the scale should fail.

Type

Str

statistic

What statistic to scale. Needed because some scales have parameters estimated from a statistic. The statistic must be numeric or an iterable of numerics; else instantiating the scale should fail.

Type

Tuple(Str, Str)

data

What raw data to scale.

Type

array_like

inverse(data)[source]

Transforms ‘data’ using the inverse of this scale. Must know how to handle int, float, and list, tuple, numpy.ndarray and pandas.Series of int or float. Returns the same type as passed.

clip(data)[source]

Clips the data to the scale’s domain.

norm(vmin=None, vmax=None)[source]

Return an instance of matplotlib.colors.Normalize, which normalizes this scale to [0, 1]. Among other things, this is used to correctly scale a color bar.

class cytoflow.utility.scale.ScaleMixin(**kwargs)[source]

Bases: traits.has_traits.HasStrictTraits

Provides useful functionality that scales can inherit.

cytoflow.utility.scale.scale_factory(scale, experiment, **scale_params)[source]

Make a new instance of a named scale.

Parameters
  • scale (string) – The name of the scale to build

  • experiment (Experiment) – The experiment to use to parameterize the new scale.

  • **scale_params (kwargs) – Other parameters to pass to the scale constructor

cytoflow.utility.scale.register_scale(scale_class)[source]

Register a new scale for the scale_factory and ScaleEnum.

cytoflow.utility.scale.set_default_scale(scale)[source]

Set a default scale for ScaleEnum

cytoflow.utility.scale.get_default_scale()[source]

Get the defaults scale set with set_default_scale