locan.analysis.position_variance_expectation.PositionVarianceExpectation¶
- class locan.analysis.position_variance_expectation.PositionVarianceExpectation(meta=None, loc_property='position_x', expectation=None, biased=True)[source]¶
Bases:
_AnalysisAnalyze variation of localization properties in relation to expected variations.
- Parameters:
meta (locan.analysis.metadata_analysis_pb2.AMetadata) – Metadata about the current analysis routine.
loc_property (str) – The localization property to analyze.
expectation (int | float | Mapping[str, Any] | pd.Series[Any] | None) – The expected variance for all or each localization property. The expected variance equals the squared localization precision for localization position coordinates.
biased (bool) – Flag to use biased or unbiased (Bessel-corrected) variance
- 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 (PositionVarianceExpectationResults) – Computed results.
distribution_statistics (Distribution_stats, None) – Distribution parameters derived from MLE fitting of results.
Methods
__init__([meta, loc_property, expectation, ...])compute(locdata)Run the computation.
hist([ax, bins, n_bins, bin_size, ...])Provide plot as
matplotlib.axes.Axesobject showing the 2-dimensional histogram of variances and localization counts.plot([ax])Provide plot as
matplotlib.axes.Axesobject showing the variances as function of localization counts.report(*args, **kwargs)Show a report about analysis results.
Attributes
countA counter for counting Analysis class instantiations (class attribute).
- compute(locdata)[source]¶
Run the computation.
- Parameters:
locdata (
LocData) – Localization data.- Return type:
Self
- hist(ax=None, bins=None, n_bins=None, bin_size=None, bin_edges=None, bin_range=None, log=True, fit=False, **kwargs)[source]¶
Provide plot as
matplotlib.axes.Axesobject showing the 2-dimensional histogram of variances and localization counts.- Parameters:
ax (
Axes|None) – The axes on which to show the imagebins (
Bins|Axis|AxesTuple|None) – The bin specification as defined inBinsbin_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]] |None) – Minimum and maximum edge for all or each dimensions with shape (2,) or (dimension, 2).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.log (
bool) – Flag for plotting on a log scale.fit (
bool) – Flag indicating if distribution fit is shown. The fit will only be computed if distribution_statistics is None.kwargs (
Any) – Other parameters passed tomatplotlib.pyplot.pcolormesh().
- Returns:
Axes object with the plot.
- Return type:
matplotlib.axes.Axes
- plot(ax=None, **kwargs)[source]¶
Provide plot as
matplotlib.axes.Axesobject showing the variances as function of localization counts.- Parameters:
ax (
Axes|None) – The axes on which to show the imagekwargs (
Any) – Other parameters passed tomatplotlib.pyplot.plot().
- Returns:
Axes object with the plot.
- Return type:
matplotlib.axes.Axes