wholecell.utils.random

random.py

Special random number generators. Most are holdovers from the original port.

wholecell.utils.random.make_elongation_rates(random, size, base, amplified, ceiling, time_step, variable_elongation=False)[source]

Create an array of rates where all values are at a base rate except for a set which is at another rate. Also performs a stochastic rounding of values after applying the provided time step.

Parameters:
  • random (RandomState) – for generating random numbers.

  • size (int) – size of new array of rates.

  • base (int) – unadjusted value for all rates.

  • amplified (array[int]) – indexes of each rate to adjust.

  • ceiling (int) – adjusted rate for amplified indexes.

  • time_step (float) – the current time step.

  • variable_elongation (bool) – whether to add amplified values to the array.

Returns:

new array with lengths to extend for base and adjusted

rates multiplied by the time step

Return type:

array[int]

wholecell.utils.random.make_elongation_rates_flat(size, base, amplified, ceiling, variable_elongation=False)[source]

Create an array of rates where all values are at a base rate except for a set which is at another rate.

Parameters:
  • size (int) – size of new array of rates.

  • base (int) – unadjusted value for all rates.

  • amplified (ndarray) – indexes of each rate to adjust.

  • ceiling (int) – adjusted rate for amplified indexes.

  • variable_elongation (bool) – words go here.

Returns:

new array with base and adjusted rates.

Return type:

rates

wholecell.utils.random.randCounts(randomState, counts, N)[source]
wholecell.utils.random.randomlySelectNRows(randomState, mat, nRndRows=inf)[source]
wholecell.utils.random.randomlySelectRows(randomState, mat, prob)[source]
wholecell.utils.random.stochasticRound(randomState, value)[source]