krotov.shapes module¶
Functions that may be used for the update_shape value in the options-dict
for each control (pulse_options parameter in optimize_pulses()
), or
for generating guess pulses
Summary¶
Functions:
Blackman window shape |
|
Box-shape (Theta-function) |
|
Flat shape (one) with a switch-on/switch-off from zero |
|
Shape function 1 for all values of t |
|
Convert func into the correct form of a QuTiP time-dependent control |
|
Shape function 0 for all values of t |
__all__
: blackman
, box
, flattop
, one_shape
, qutip_callback
, zero_shape
Reference¶
-
krotov.shapes.
qutip_callback
(func, **kwargs)[source]¶ Convert func into the correct form of a QuTiP time-dependent control
QuTiP requires that “callback” functions that are used to express time-dependent controls take a parameter t and args. This function takes a function func that takes t as its first parameter and an arbitrary number of other parameters. The given kwargs set values for these other parameters. Parameters not contained in kwargs are set at runtime from the args dict.
-
krotov.shapes.
flattop
(t, t_start, t_stop, t_rise, t_fall=None, func='blackman')[source]¶ Flat shape (one) with a switch-on/switch-off from zero
The flattop function starts at 0, and ramps to to 1 during the t_rise interval. For
func='blackman'
, the switch-on shape is half of a Blackman window (seeblackman()
). Forfunc='sinsq
, it is a sine-squared curve. The function then remains at value 1, before ramping down to 0 again during t_fall.- Parameters
Note
You may use
numpy.vectorize
to transform this into a shape function for arrays,functools.partial()
to fix the function arguments other than t, creating a function suitable for the update_shape value of pulse_options, andqutip_callback()
to create a function suitable as a time-dependent control in QuTiP.
-
krotov.shapes.
box
(t, t_start, t_stop)[source]¶ Box-shape (Theta-function)
The shape is 0 before t_start and after t_stop and 1 elsewhere.
- Parameters
Note
You may use
numpy.vectorize
,functools.partial()
, orqutip_callback()
, cf.flattop()
.
-
krotov.shapes.
blackman
(t, t_start, t_stop, a=0.16)[source]¶ Blackman window shape
\[B(t; t_0, t_1) = \frac{1}{2}\left( 1 - a - \cos\left(2\pi \frac{t - t_0}{t_1 - t_0}\right) + a \cos\left(4\pi \frac{t - t_0}{t_1 - t_0}\right) \right)\,,\]with \(a = 0.16\).
See http://en.wikipedia.org/wiki/Window_function#Blackman_windows
A Blackman shape looks nearly identical to a Gaussian with a 6-sigma interval between t_start and t_stop. Unlike the Gaussian, however, it will go exactly to zero at the edges. Thus, Blackman pulses are often preferable to Gaussians.
- Parameters
t (float or numpy.ndarray) – Time point or time grid
t_start (float) – Starting point \(t_0\) of Blackman shape
t_stop (float) – End point \(t_1\) of Blackman shape
a (float) – Blackman coefficient.
- Returns
If t is a float, return the value of the Blackman shape at t. If t is an array, return an array of same size as t, containing the values for the Blackman shape (zero before t_start and after t_stop)
- Return type