iblrig.misc.truncated_exponential

iblrig.misc.truncated_exponential(scale=0.35, min_value=0.2, max_value=0.5)[source]

Generate a truncated exponential random variable within a specified range.

Parameters:
  • scale (float, optional) – Scale of the exponential distribution (inverse of rate parameter). Defaults to 0.35.

  • min_value (float, optional) – Minimum value for the truncated range. Defaults to 0.2.

  • max_value (float, optional) – Maximum value for the truncated range. Defaults to 0.5.

Returns:

Truncated exponential random variable.

Return type:

float

Parameters:

Notes

This function generates a random variable from an exponential distribution with the specified scale. It then checks if the generated value is within the specified range [min_value, max_value]. If it is within the range, it returns the generated value; otherwise, it recursively generates a new value until it falls within the specified range.

The scale should typically be greater than or equal to the min_value to avoid potential issues with infinite recursion.