locan.analysis.pair_distances.PairDistances

class locan.analysis.pair_distances.PairDistances(meta=None)[source]

Bases: _Analysis

Compute the pairwise distances within data or the pairwise distances between data and other_data.

The algorithm relies on sklearn.metrics.pairwise.

Parameters:

meta (locan.analysis.metadata_analysis_pb2.AMetadata) – Metadata about the current analysis routine.

Variables:
  • count (int) – A counter for counting instantiations.

  • 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.

Methods

__init__([meta])

compute(locdata[, other_locdata])

Run the computation.

hist([ax, bins, density])

Provide histogram of all pairwise distances.

report(*args, **kwargs)

Show a report about analysis results.

Attributes

count

A counter for counting Analysis class instantiations (class attribute).

compute(locdata, other_locdata=None)[source]

Run the computation.

Parameters:
  • locdata (LocData) – Localization data.

  • other_locdata (LocData | None) – Other localization data to be taken as pairs.

Return type:

Self

count: int = 0

A counter for counting Analysis class instantiations (class attribute).

hist(ax=None, bins='auto', density=True, **kwargs)[source]

Provide histogram of all pairwise distances.

Parameters:
  • ax (Axes | None) – The axes on which to show the image.

  • bins (Union[int, list[int | float], Literal['auto']]) – Bin specification as used in matplotlib.hist()

  • density (bool) – Flag for normalization as used in matplotlib.hist. True returns probability density function; None returns counts.

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

Returns:

Axes object with the plot.

Return type:

matplotlib.axes.Axes