locan.analysis.grouped_property_expectation.GroupedPropertyExpectation#

class locan.analysis.grouped_property_expectation.GroupedPropertyExpectation(meta=None, loc_property=None, other_loc_property=None, expectation=None)[source]#

Bases: _Analysis

Analyze variation of localization property in relation to other localization property that is grouped.

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

  • loc_property (str | None) – The localization property to analyze.

  • other_loc_property (str | None) – The localization property to group on.

  • expectation (int | float | Mapping | pd.Series[Any] | None) – The expected value for all or each other localization property.

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

  • distribution_statistics (Distribution_stats, None) – Distribution parameters derived from MLE fitting of results.grouped.

Methods

__init__([meta, loc_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.

plot([ax])

Provide plot as matplotlib.axes.Axes object showing the variances 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.

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.

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