cytoflow.utility.hlog_scale¶
A scale that transforms the data using the hyperlog
function. hlog_scale
has
several classes:
HlogScale
– implements IScale
, the cytoflow
interface for the scale.
MatplotlibHlogScale
– inherits matplotlib.scale.ScaleBase
, implements
the matplotlib interface
HlogMajorLocator
– inherits matplotlib.ticker.Locator
, lets matplotlib know where major
tics are along a plot axis.
HlogMinorLocator
– inherits matplotlib.ticker.Locator
, lets matplotlib know where minor
tics are along a plot axis
hlog
, hlog_inv
– the actual functions that perform the scale and inverse
- 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'¶
- norm()[source]¶
A factory function that returns
matplotlib.colors.Normalize
instance, which normalizes values for amatplotlib
color palette.
- get_mpl_params()[source]¶
Returns a dict with the traits needed to initialize an instance of
MatplotlibHlogScale
- class cytoflow.utility.hlog_scale.MatplotlibHlogScale(axis, **kwargs)[source]¶
Bases:
traits.has_traits.HasTraits
,matplotlib.scale.ScaleBase
A class that inherits from
matplotlib.scale.ScaleBase
, which implements all the bits formatplotlib
to use a new scale.- 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
A class that implements the actual transformation
- input_dims = 1¶
The number of input dimensions of this transform. Must be overridden (with integers) in the subclass.
- output_dims = 1¶
The number of output dimensions of this transform. Must be overridden (with integers) in the subclass.
- is_separable = True¶
True if this transform is separable in the x- and y- dimensions.
- has_inverse = True¶
True if this transform has a corresponding inverse transform.
- transform_non_affine(values)[source]¶
Apply only the non-affine part of this transformation.
transform(values)
is always equivalent totransform_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 xinput_dims
).- Returns
The output values as NumPy array of length
input_dims
or shape (N xoutput_dims
), depending on the input.- Return type
array
- class InvertedLogicleTransform(**kwargs)[source]¶
Bases:
traits.has_traits.HasTraits
,matplotlib.transforms.Transform
A class that implements the inverse transformation
- input_dims = 1¶
The number of input dimensions of this transform. Must be overridden (with integers) in the subclass.
- output_dims = 1¶
The number of output dimensions of this transform. Must be overridden (with integers) in the subclass.
- is_separable = True¶
True if this transform is separable in the x- and y- dimensions.
- has_inverse = True¶
True if this transform has a corresponding inverse transform.
- transform_non_affine(values)[source]¶
Apply only the non-affine part of this transformation.
transform(values)
is always equivalent totransform_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 xinput_dims
).- Returns
The output values as NumPy array of length
input_dims
or shape (N xoutput_dims
), depending on the input.- Return type
array
- class cytoflow.utility.hlog_scale.HlogMajorLocator[source]¶
Bases:
matplotlib.ticker.Locator
Determine the tick locations for hlog axes. Based on matplotlib.LogLocator
- class cytoflow.utility.hlog_scale.HlogMinorLocator[source]¶
Bases:
matplotlib.ticker.Locator
Determine the tick locations for logicle axes. Based on matplotlib.LogLocator
- 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
- Return type
Array of transformed values.