cytoflow.utility.hlog_scale

class cytoflow.utility.hlog_scale.HlogScale(**kwargs)[source]

Bases: cytoflow.utility.scale.ScaleMixin

A scale that transforms the data using the hyperlog function.

This scaling method implements a “linear-like” region around 0, and a “log-like” region for large values, with a smooth transition between them.

The transformation has one parameter, b, which specifies the location of the transition from linear to log-like. The default, 500, is good for 18-bit scales and not good for other scales.

b

the location of the transition from linear to log-like.

Type:Float (default = 500)

References

[1] Hyperlog-a flexible log-like transform for negative, zero, and positive
valued data. Bagwell CB. Cytometry A. 2005 Mar;64(1):34-42. PMID: 15700280 http://onlinelibrary.wiley.com/doi/10.1002/cyto.a.20114/abstract
name = 'hlog'
inverse(data)[source]

Transforms ‘data’ using the inverse of this scale.

clip(data)[source]
norm()[source]
get_mpl_params()[source]
class cytoflow.utility.hlog_scale.MatplotlibHlogScale(axis, **kwargs)[source]

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

name = 'hlog'
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 HlogTransform(**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]

Performs only the non-affine part of the 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.

Accepts a numpy array of shape (N x input_dims) and returns a numpy array of shape (N x output_dims).

Alternatively, accepts a numpy array of length input_dims and returns a numpy array of length output_dims.

inverted()[source]

Return the corresponding inverse transformation.

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.

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

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]

Performs only the non-affine part of the 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.

Accepts a numpy array of shape (N x input_dims) and returns a numpy array of shape (N x output_dims).

Alternatively, accepts a numpy array of length input_dims and returns a numpy array of length output_dims.

inverted()[source]

Return the corresponding inverse transformation.

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.

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

class cytoflow.utility.hlog_scale.HlogMajorLocator[source]

Bases: matplotlib.ticker.Locator

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

set_params()[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.hlog_scale.HlogMinorLocator[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

cytoflow.utility.hlog_scale.hlog_inv(y, b, r, d)[source]

Inverse of base 10 hyperlog transform.

cytoflow.utility.hlog_scale.hlog(x, b, r, d)[source]

Base 10 hyperlog transform.

Parameters:
  • x (num | num iterable) – values to be transformed.
  • b (num) – Parameter controling the location of the shift from linear to log transformation.
  • r (num (default = 10**4)) – maximal transformed value.
  • d (num (default = log10(2**18))) – log10 of maximal possible measured value. hlog_inv(r) = 10**d
Returns:

Return type:

Array of transformed values.