locan.analysis.localization_precision.LocalizationPrecision#

class locan.analysis.localization_precision.LocalizationPrecision(meta=None, radius=50)[source]#

Bases: _Analysis

Compute the localization precision from consecutive nearby localizations.

Parameters:
  • meta (locan.analysis.metadata_analysis_pb2.AMetadata | None) – Metadata about the current analysis routine.

  • radius (int | float) – Search radius for nearest-neighbor searches.

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 (pandas.DataFrame) – Computed results.

  • distribution_statistics (Distribution_fits | None) – Distribution parameters derived from MLE fitting of results.

Methods

__init__([meta, radius])

compute(locdata)

Run the computation.

fit_distributions([loc_property])

Fit probability density functions to the distributions of loc_property values in the results using MLE (scipy.stats).

hist([ax, loc_property, bins, fit])

Provide histogram as matplotlib.axes.Axes object showing the distributions of results.

plot([ax, loc_property, window])

Provide plot as matplotlib.axes.Axes object showing the running average of results over window size.

report(*args, **kwargs)

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

fit_distributions(loc_property=None, **kwargs)[source]#

Fit probability density functions to the distributions of loc_property values in the results using MLE (scipy.stats).

Parameters:
  • loc_property (str) – The LocData property for which to fit an appropriate distribution; if None all plots are shown.

  • kwargs (Any) – Other parameters passed to the distribution.fit() method.

Return type:

None

hist(ax=None, loc_property='position_distance', bins='auto', fit=True, **kwargs)[source]#

Provide histogram as matplotlib.axes.Axes object showing the distributions of results.

Parameters:
  • ax (Optional[Axes]) – The axes on which to show the image

  • loc_property (str) – The property for which to plot localization precision.

  • bins (int | Sequence[int | float] | str) – Bin specifications (passed to matplotlib.hist()).

  • fit (bool) – Flag indicating if distributions fit are shown.

  • kwargs (Any) – Other parameters passed to matplotlib.pyplot.his().

Returns:

Axes object with the plot.

Return type:

matplotlib.axes.Axes

plot(ax=None, loc_property=None, window=1, **kwargs)[source]#

Provide plot as matplotlib.axes.Axes object showing the running average of results over window size.

Parameters:
  • ax (Optional[Axes]) – The axes on which to show the image

  • loc_property (UnionType[str, list[str], None]) – The property for which to plot localization precision; if None all plots are shown.

  • window (int) – Window for running average that is applied before plotting.

  • kwargs (Any) – Other parameters passed to matplotlib.pyplot.plot().

Returns:

Axes object with the plot.

Return type:

matplotlib.axes.Axes