gridlib.tl_simulation_single

gridlib.tl_simulation_single(k: ndarray, s: ndarray, kb: float, t_int: float, t_tl: float, N: int = 10000) Dict[str, Dict[str, ndarray]][source]

Function simulates the fluorescence survival time distributions of a molecule for one time-lapse conditions. Dissociation and photobleaching of molecules with user-defined parameters is simulated and the resulting fluorescence survival time distribution is calculated.

Parameters
  • k (np.ndarray) – Decay rates with units per second.

  • s (np.ndarray) – Amplitudes for the respective decay rates.

  • kb (float) – Photobleaching rate per second (kb = a / t_int).

  • t_int (float) – The integration time in seconds.

  • t_tl (float) – The time-lapse time to simulate in seconds.

  • N (int, optional) – Number of molecules to simulate and use for the survival time distribution calculation (default 10000).

Returns

A dictionary mapping keys (time-lapse conditions) to the corresponding time and value arrays of the survival functions. For example:

{
    "0.05s": {
        "time": array([0.05, 0.1, 0.15, ...])
        "value": array([1.000e+04, 8.464e+03, 7.396e+03, ...])
    },
}

Return type

Dict[str, Dict[str, np.ndarray]]

Raises

ValueError – If kb, t_int, t_tl or N is incorrectly set. They should all atleast be larger than 0.

Examples

>>> data_sim = tl_simulation_single(np.array([0.005, 0.48, 5.2]),
... np.array([0.05, 0.25, 0.7]), 0.03, 0.05, 0.5, N=10000)

The above function call simulates fluorescence survival time distributions of a type of molecule with three different dissociation rates, and a photobleaching rate of 0.03 s^-1. The integration time is set to 50 ms and the time-lapse time is set to 500 ms. For the survival time distribution 10000 observed molecules are simulated.