module dist

Distribution functions

This module provides functions for dealing with normal distributions and generating error maps.

When called directly as main, it allows for converting a threshold map into an error map.

$ python -m mlcsim.dist --help

usage: dist.py [-h] [-b {1,2,3,4}] -f F [-o O]

options:

    -h, --help    show this help message and exit

    -b {1,2,3,4}  bits per cell

    -f F          Threshold map json to convert

    -o O          output to file

function normalMidpoint

normalMidpoint(mean_a: float, mean_b: float, std_a: float, std_b: float) → float

Find the midpoint between two normal distributions

Args:

  • mean_a (float): Mean of first distribution
  • mean_b (float): Mean of second distribution
  • std_a (float): Std dev of first distribution
  • std_b (float): Std dev of second distribution

Returns:

  • float: Midpoint between distributions

function normalChance

normalChance(mean: float, stdev: float, thr: float) → float

Find the chance of a normal distribution above/below a given value

Args:

  • mean (float): Mean of the distribution
  • stdev (float): Std dev of the distribution
  • thr (float): Threshold to check above/below

Returns:

  • float: Chance for threshold to end up above/below the given point in the distribution

function genErrorMap

genErrorMap(
    thr_maps: Dict[str, List[List[float]]],
    bpc: int
) → List[List[float]]

Generate an error map from a threshold map

Args:

  • thr_maps (dict): Threshold map
  • bpc (int): Bits per cell

Raises:

  • ValueError: if the given bpc is not in the threshold map

Returns:

  • list: Error map from the threshold map

This file was automatically generated via lazydocs.