locan.analysis.convex_hull_expectation.ConvexHullExpectation#

class locan.analysis.convex_hull_expectation.ConvexHullExpectation(meta=None, convex_hull_property='region_measure_ch', expected_variance=None)[source]#

Bases: _Analysis

Analyze geometrical properties of the convex hull of localization coordinates in relation to expected values.

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

  • convex_hull_property (Literal["region_measure_ch", "subregion_measure_ch"]) – One of ‘region_measure_ch’ (i.e. area or volume) or ‘subregion_measure_ch’ (i.e. circumference or surface.)

  • expected_variance (float | Iterable[float] | None) – The expected variance for all or each localization property. The expected variance equals the squared localization precision for localization position coordinates.

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

  • parameter (dict[str, Any]) – A dictionary with all settings for the current computation.

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

  • results (ConvexHullExpectationResults | None) – Computed results.

  • distribution_statistics (dict[str, Any] | None) – Distribution parameters derived from MLE fitting of results.

Methods

__init__([meta, convex_hull_property, ...])

compute(locdata)

Run the computation.

hist([ax, bins, n_bins, bin_size, ...])

Provide plot as matplotlib.axes.Axes object showing the 2-dimensional histogram of convex_hull_property and localization counts.

plot([ax])

Provide plot as matplotlib.axes.Axes object showing the convex_hull_property as function of localization counts.

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

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.Axes object showing the 2-dimensional histogram of convex_hull_property and localization counts.

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

  • bins (UnionType[Bins, Axis, AxesTuple, None]) – The bin specification as defined in Bins

  • bin_edges (UnionType[Sequence[float], Sequence[Sequence[float]], None]) – Bin edges for all or each dimension with shape (dimension, n_bin_edges).

  • bin_range (UnionType[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 (UnionType[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 (UnionType[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 to matplotlib.pyplot.pcolormesh().

Returns:

Axes object with the plot.

Return type:

matplotlib.axes.Axes

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

Provide plot as matplotlib.axes.Axes object showing the convex_hull_property as function of localization counts.

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

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

Returns:

Axes object with the plot.

Return type:

matplotlib.axes.Axes