fishtank.decode.expectation_maximization

fishtank.decode.expectation_maximization#

fishtank.decode.expectation_maximization(intensities, codebook, max_dist=1.5, min_snr=4, iter=10, plot=False)#

Decode intensities using expectation maximization.

Parameters:
  • intensities (DataFrame | ndarray) – A (N,C) array of intensities where N is the number of spots and C is the number of channels.

  • codebook (DataFrame) – A (K,C) array of codebook vectors where K is the number of codewords.

  • max_dist (float (default: 1.5)) – Maximum distance between intensity and codebook vectors.

  • min_snr (float (default: 4)) – Minimum signal-to-noise for bits in the codebook.

  • iter (int (default: 10)) – Number of iterations.

  • plot (bool (default: False)) – Whether to plot heatmap of corrected intensities annotated with decoded values.

Return type:

tuple[DataFrame, DataFrame]

Returns:

decoding

a DataFrame of spots with decoded value, dist, intensity, and snr columns

bit_performance

a DataFrame with bit, intensity, and snr columns