t_funcs

Named time-function factories for use with the time-dependent solver.

Each function takes an integer index and returns a callable with signature f(t, args) where args is a dict of named parameters suffixed by the index. For example, square(1) returns a function that reads {'on_1', 'off_1', 'ampl_1'} from args.

maxwellbloch.t_funcs.gaussian(index: int) Callable[[float | ndarray, dict[str, Any]], float | ndarray][source]

Return a Gaussian pulse time function.

Parameters:

index – Integer suffix used to look up parameters in args.

Returns:

Callable f(t, args) reading fwhm_{index}, centre_{index}, and either ampl_{index} or n_pi_{index} from args. Raises KeyError if both or neither amplitude parameters are present.

Notes

The amplitude can be set directly via ampl_{index} or indirectly via n_pi_{index} (desired pulse area in multiples of π).

maxwellbloch.t_funcs.intp(index: int) Callable[[float | ndarray, dict[str, Any]], float | ndarray][source]

Return an interpolated time function.

Linearly interpolates a user-supplied (tlist, ylist) pair, returning zero outside the supplied range.

Parameters:

index – Integer suffix used to look up parameters in args.

Returns:

Callable f(t, args) reading tlist_{index} and ylist_{index} from args. Returns a Python complex scalar when called with scalar t (as required by QuTiP 5), or an array when called with array t.

maxwellbloch.t_funcs.ramp_off(index: int) Callable[[float | ndarray, dict[str, Any]], float | ndarray][source]

Return a ramp-off time function.

The pulse holds at ampl until the turn-off time off, then falls smoothly to zero using a half-Gaussian.

Parameters:

index – Integer suffix used to look up parameters in args.

Returns:

Callable f(t, args) reading ampl_{index}, fwhm_{index}, and off_{index} from args.

maxwellbloch.t_funcs.ramp_offon(index: int) Callable[[float | ndarray, dict[str, Any]], float | ndarray][source]

Return a ramp-off / ramp-on time function.

The pulse starts at ampl, dips smoothly to zero, then rises back to ampl. Built by composing ramp_on() and ramp_off().

Parameters:

index – Integer suffix used to look up parameters in args.

Returns:

Callable f(t, args) reading ampl_{index}, fwhm_{index}, off_{index}, and on_{index} from args.

maxwellbloch.t_funcs.ramp_on(index: int) Callable[[float | ndarray, dict[str, Any]], float | ndarray][source]

Return a ramp-on time function.

The pulse rises smoothly from zero using a half-Gaussian, then holds at ampl after the turn-on time on.

Parameters:

index – Integer suffix used to look up parameters in args.

Returns:

Callable f(t, args) reading ampl_{index}, fwhm_{index}, and on_{index} from args.

maxwellbloch.t_funcs.ramp_onoff(index: int) Callable[[float | ndarray, dict[str, Any]], float | ndarray][source]

Return a ramp-on / ramp-off time function.

The pulse rises smoothly, holds at ampl, then falls smoothly. Built by composing ramp_on() and ramp_off().

Parameters:

index – Integer suffix used to look up parameters in args.

Returns:

Callable f(t, args) reading ampl_{index}, fwhm_{index}, on_{index}, and off_{index} from args.

maxwellbloch.t_funcs.sech(index: int) Callable[[float | ndarray, dict[str, Any]], float | ndarray][source]

Return a sech pulse time function.

Parameters:

index – Integer suffix used to look up parameters in args.

Returns:

Callable f(t, args) reading centre_{index}, either ampl_{index} or n_pi_{index}, and either width_{index} or fwhm_{index} from args. Raises KeyError if conflicting or missing parameters are found.

Notes

  • The amplitude can be set directly via ampl_{index} or indirectly via n_pi_{index} (desired pulse area in multiples of π).

  • The width can be set directly via width_{index} or indirectly via fwhm_{index} (full-width at half maximum).

maxwellbloch.t_funcs.sinc(index: int) Callable[[float | ndarray, dict[str, Any]], float | ndarray][source]

Return a sinc pulse time function.

Parameters:

index – Integer suffix used to look up parameters in args.

Returns:

Callable f(t, args) reading ampl_{index} and width_{index} from args.

maxwellbloch.t_funcs.square(index: int) Callable[[float | ndarray, dict[str, Any]], float | ndarray][source]

Return a square (top-hat) pulse time function.

Parameters:

index – Integer suffix used to look up parameters in args.

Returns:

Callable f(t, args) reading ampl_{index}, on_{index}, off_{index} from args. Returns ampl between on and off, zero outside.