krotov.shapes module¶
Functions that may be used for the shape attribute of
PulseOptions
, or for generating guess pulses
Summary¶
Data:
blackman |
Blackman window shape |
box |
Box-shape (Theta-function) |
flattop |
Flat shape (one) with a switch-on/switch-off from zero |
one_shape |
Shape function 1 for all values of t |
qutip_callback |
Convert func into the correct form of a QuTiP time-dependent control |
zero_shape |
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” functins 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: - t (float) – Time point or time grid
- t_start (float) – Start of flattop window
- t_stop (float) – Stop of flattop window
- t_rise (float) – Duration of ramp-up, starting at t_start
- t_fall (float) – Duration of ramp-down, ending at t_stop.
If not given,
t_fall=t_rise
. - func (str) – One of ‘blackman’, ‘sinsq’
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 shape attribute ofPulseOptions
, 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
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 start and 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 of Blackman shape
- t_stop (float) – End point of Blackman shape
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: