utility

maxwellbloch.utility.full_width_at_half_max(x: ndarray, y: ndarray) float[source]

Return the full width at half maximum (FWHM) of a peak.

Parameters:
  • x – 1-D array of independent variable values (must be monotonically increasing and have enough points for spline fitting).

  • y – 1-D array of dependent variable values, same length as x.

Returns:

the distance between the two points where y equals half its maximum value.

Return type:

The FWHM as a scalar

maxwellbloch.utility.half_max_roots(x: ndarray, y: ndarray) tuple[float, float, float][source]

Return the half-maximum value and the two roots where y crosses it.

Parameters:
  • x – 1-D array of independent variable values (must be monotonically increasing and have enough points for spline fitting).

  • y – 1-D array of dependent variable values, same length as x.

Returns:

Tuple (half_max, r1, r2) where half_max = max(y) / 2 and r1 < r2 are the two x-values where y == half_max.

maxwellbloch.utility.maxwell_boltzmann(v: ndarray, fwhm: float, offset: float = 0.0) ndarray[source]

Maxwell-Boltzmann probability distribution.

Parameters:
  • v – velocity (or detuning) values.

  • fwhm – full-width at half-maximum of the distribution.

  • offset – centre of the distribution (default 0).

Returns:

Probability density at each value in v.