locan.analysis.localization_property_2d.LocalizationProperty2d#
- class locan.analysis.localization_property_2d.LocalizationProperty2d(meta=None, loc_properties=None, other_property='local_background', bins=None, n_bins=None, bin_size=100, bin_edges=None, bin_range=None, rescale=None)[source]#
Bases:
_Analysis
Analyze 2d distribution of histogram for two localization properties.
Fit a two dimensional Gauss distribution.
- Parameters:
meta (locan.analysis.metadata_analysis_pb2.AMetadata) – Metadata about the current analysis routine.
loc_properties (Sequence[str] | None) – Localization properties to be grouped into bins. If None, the coordinate_values of locdata are used.
other_property (str | None) – Localization property (columns in locdata.data) that is averaged in each pixel. If None, the localization counts are shown.
bins (Bins | boost_histogram.axis.Axis | boost_histogram.axis.AxesTuple | None) – The bin specification as defined in
Bins
bin_edges (Sequence[float] | Sequence[Sequence[float]] | None) – Bin edges for all or each dimension with shape (dimension, n_bin_edges).
bin_range (tuple[float, float] | Sequence[float] | Sequence[Sequence[float]] | str | None) – Minimum and maximum edge for all or each dimensions with shape (2,) or (dimension, 2). If None (min, max) ranges are determined from data and returned; if ‘zero’ (0, max) ranges with max determined from data are returned. if ‘link’ (min_all, max_all) ranges with min and max determined from all combined data are returned.
n_bins (int | Sequence[int] | None) – The number of bins for all or each dimension. 5 yields 5 bins in all dimensions. (2, 5) yields 2 bins for one dimension and 5 for the other dimension.
bin_size (float | Sequence[float] | Sequence[Sequence[float]] | None) – The size of bins for all or each bin and for all or each dimension with shape (dimension,) or (dimension, n_bins). 5 would describe bin_size of 5 for all bins in all dimensions. ((2, 5),) yield bins of size (2, 5) for one dimension. (2, 5) yields bins of size 2 for one dimension and 5 for the other dimension. ((2, 5), (1, 3)) yields bins of size (2, 5) for one dimension and (1, 3) for the other dimension. To specify arbitrary sequence of bin_size use bin_edges instead.
rescale (int | str | locan.Trafo | Callable[..., Any] | bool | None) – Transformation as defined in
locan.Trafo
or by transformation function. For None or False no rescaling occurs. Legacy behavior: For tuple with upper and lower bounds provided in percent, rescale intensity values to be within percentile of max and min intensities. For ‘equal’ intensity values are rescaled by histogram equalization.
- Variables:
count (int) – A counter for counting instantiations (class attribute).
parameter (dict) – A dictionary with all settings for the current computation.
meta (locan.analysis.metadata_analysis_pb2.AMetadata) – Metadata about the current analysis routine.
results (lmfit.model.ModelResult) – Computed fit results.
Methods
__init__
([meta, loc_properties, ...])compute
(locdata)Run the computation.
plot
([ax])Provide histogram as
matplotlib.axes.Axes
object showing plot(results).plot_deviation_from_mean
([ax])Provide histogram as
matplotlib.axes.Axes
object showing plot(results).Provide histogram as
matplotlib.axes.Axes
object showing plot(results).plot_residuals
([ax])Provide histogram as
matplotlib.axes.Axes
object showing plot(results).report
()Show a report about analysis results.
Attributes
count
A counter for counting Analysis class instantiations (class attribute).
- compute(locdata)[source]#
Run the computation.
- Parameters:
locdata (
LocData
) – Localization data.- Return type:
Self
- plot(ax=None, **kwargs)[source]#
Provide histogram as
matplotlib.axes.Axes
object showing plot(results).- Parameters:
ax (
Optional
[Axes
]) – The axes on which to show the imagekwargs (
Any
) – Other parameters passed tomatplotlib.pyplot.contour()
.
- Returns:
Axes object with the plot.
- Return type:
matplotlib.axes.Axes
- plot_deviation_from_mean(ax=None)[source]#
Provide histogram as
matplotlib.axes.Axes
object showing plot(results).- Parameters:
ax (
Optional
[Axes
]) – The axes on which to show the image- Returns:
Axes object with the plot.
- Return type:
matplotlib.axes.Axes
- plot_deviation_from_median(ax=None)[source]#
Provide histogram as
matplotlib.axes.Axes
object showing plot(results).- Parameters:
ax (
Optional
[Axes
]) – The axes on which to show the image- Returns:
Axes object with the plot.
- Return type:
matplotlib.axes.Axes
- plot_residuals(ax=None, **kwargs)[source]#
Provide histogram as
matplotlib.axes.Axes
object showing plot(results).- Parameters:
ax (
Optional
[Axes
]) – The axes on which to show the imagekwargs (
Any
) – Other parameters passed tomatplotlib.pyplot.contour()
.
- Returns:
Axes object with the plot.
- Return type:
matplotlib.axes.Axes