cytoflow.utility.logicle_scale

class cytoflow.utility.logicle_scale.LogicleScale[source]

Bases: traits.has_traits.HasStrictTraits

A scale that transforms the data using the logicle function.

This scaling method implements a “linear-like” region around 0, and a “log-like” region for large values, with a very smooth transition between them. It’s particularly good for compensated data, and data where you have “negative” events (events with a fluorescence of ~0.)

If you don’t have any data around 0, you might be better of with a more traditional log scale.

The transformation has one parameter, W, which specifies the width of the “linear” range in log10 decades. By default, the optimal value is estimated from the data; but if you assign a value to W it will be used. 0.5 is usually a good start.

experiment

the cytoflow.Experiment used to estimate the scale parameters.

Type:Instance(cytoflow.Experiment)
channel

If set, choose scale parameters from this channel in experiment. One of channel, condition or statistic must be set.

Type:Str
condition

If set, choose scale parameters from this condition in experiment. One of channel, condition or statistic must be set.

Type:Str
statistic

If set, choose scale parameters from this statistic in experiment. One of channel, condition or statistic must be set.

Type:Str
quantiles = Tuple(Float, Float) (default = (0.001, 0.999))

If there are a few very large or very small values, this can throw off matplotlib’s choice of default axis ranges. Set quantiles to choose what part of the data to consider when choosing axis ranges.

W

The width of the linear range, in log10 decades. can estimate from data, or use a fixed value like 0.5.

Type:Float (default = estimated from data)
M

The width of the log portion of the display, in log10 decades.

Type:Float (default = 4.5)
A

additional decades of negative data to include. the default display usually captures all the data, so 0 is fine to start.

Type:Float (default = 0.0)
r

Quantile used to estimate W.

Type:Float (default = 0.05)

References

[1] A new “Logicle” display method avoids deceptive effects of logarithmic
scaling for low signals and compensated data. Parks DR, Roederer M, Moore WA. Cytometry A. 2006 Jun;69(6):541-51. PMID: 16604519 http://onlinelibrary.wiley.com/doi/10.1002/cyto.a.20258/full
[2] Update for the logicle data scale including operational code
implementations. Moore WA, Parks DR. Cytometry A. 2012 Apr;81(4):273-7. doi: 10.1002/cyto.a.22030 PMID: 22411901 http://onlinelibrary.wiley.com/doi/10.1002/cyto.a.22030/full
name = 'logicle'
inverse(data)[source]

Transforms ‘data’ using the inverse of this scale.

clip(data)[source]
norm(vmin=None, vmax=None)[source]
get_mpl_params(ax)[source]
class cytoflow.utility.logicle_scale.MatplotlibLogicleScale(axis, **kwargs)[source]

Bases: traits.has_traits.HasTraits, matplotlib.scale.ScaleBase

name = 'logicle'
get_transform()[source]

Returns the matplotlib.transform instance that does the actual transformation

set_default_locators_and_formatters(axis)[source]

Set the locators and formatters to reasonable defaults for linear scaling.

class LogicleTransform(**kwargs)[source]

Bases: traits.has_traits.HasTraits, matplotlib.transforms.Transform

input_dims = 1
output_dims = 1
is_separable = True
has_inverse = True
transform_non_affine(values)[source]

Apply only the non-affine part of this transformation.

transform(values) is always equivalent to transform_affine(transform_non_affine(values)).

In non-affine transformations, this is generally equivalent to transform(values). In affine transformations, this is always a no-op.

Parameters:values (array) – The input values as NumPy array of length input_dims or shape (N x input_dims).
Returns:The output values as NumPy array of length input_dims or shape (N x output_dims), depending on the input.
Return type:array
inverted()[source]

Return the corresponding inverse transformation.

It holds x == self.inverted().transform(self.transform(x)).

The return value of this method should be treated as temporary. An update to self does not cause a corresponding update to its inverted copy.

class InvertedLogicleTransform(**kwargs)[source]

Bases: traits.has_traits.HasTraits, matplotlib.transforms.Transform

input_dims = 1
output_dims = 1
is_separable = True
has_inverse = True
transform_non_affine(values)[source]

Apply only the non-affine part of this transformation.

transform(values) is always equivalent to transform_affine(transform_non_affine(values)).

In non-affine transformations, this is generally equivalent to transform(values). In affine transformations, this is always a no-op.

Parameters:values (array) – The input values as NumPy array of length input_dims or shape (N x input_dims).
Returns:The output values as NumPy array of length input_dims or shape (N x output_dims), depending on the input.
Return type:array
inverted()[source]

Return the corresponding inverse transformation.

It holds x == self.inverted().transform(self.transform(x)).

The return value of this method should be treated as temporary. An update to self does not cause a corresponding update to its inverted copy.

class cytoflow.utility.logicle_scale.LogicleMajorLocator[source]

Bases: matplotlib.ticker.Locator

Determine the tick locations for logicle axes. Based on matplotlib.LogLocator

set_params(**kwargs)[source]

Empty

tick_values(vmin, vmax)[source]

Every decade, including 0 and negative

view_limits(data_min, data_max)[source]

Try to choose the view limits intelligently

class cytoflow.utility.logicle_scale.LogicleMinorLocator[source]

Bases: matplotlib.ticker.Locator

Determine the tick locations for logicle axes. Based on matplotlib.LogLocator

set_params()[source]

Empty

tick_values(vmin, vmax)[source]

Every tenth decade, including 0 and negative

view_limits(data_min, data_max)[source]

Try to choose the view limits intelligently