qutip_qtrl.pulsegen
Pulse generator - Generate pulses for the timeslots Each class defines a gen_pulse function that produces a float array of size num_tslots. Each class produces a differ type of pulse. See the class and gen_pulse function descriptions for details
Functions
|
Create and return a pulse generator object matching the given type. |
Classes
|
Pulse generator Base class for all Pulse generators The object can optionally be instantiated with a Dynamics object, in which case the timeslots and amplitude scaling and offset are copied from that. |
|
Base class for all CRAB pulse generators Note these are more involved in the optimisation process as they are used to produce piecewise control amplitudes each time new optimisation parameters are tried |
|
Generates a pulse using the Fourier basis functions, i.e. sin and cos. |
|
Generates pulses with a Gaussian profile |
|
Generate pulses with inverted Gaussian ramping in and out It's intended use for a ramping modulation, which is often required in experimental setups. |
|
Generates linear pulses |
|
Intermediate class for all periodic pulse generators All of the periodic pulses range from -1 to 1 All have a start phase that can be set between 0 and 2pi |
|
Generates random pulses as simply random values for each timeslot |
|
Generates pulses by summing sine waves as a Fourier series with random coefficients |
|
Generates pulses by using a random walk algorithm |
|
Generates pulses by using a random walk algorithm Note this is best used with bounds as the walks tend to wander far |
|
Generates pulses by summing sine waves with random frequencies amplitudes and phase offset |
|
Generates saw tooth wave pulses |
|
Generates sine wave pulses |
|
Generates square wave pulses |
|
Generates triangular wave pulses |
|
Generates a flat pulse |
- class qutip_qtrl.pulsegen.PulseGen(dyn=None, params=None)[source]
Pulse generator Base class for all Pulse generators The object can optionally be instantiated with a Dynamics object, in which case the timeslots and amplitude scaling and offset are copied from that. Otherwise the class can be used independently by setting: tau (array of timeslot durations) or num_tslots and pulse_time for equally spaced timeslots
- Attributes:
- num_tslotsinteger
Number of timeslots, aka timeslices (copied from Dynamics if given)
- pulse_timefloat
total duration of the pulse (copied from Dynamics.evo_time if given)
- scalingfloat
linear scaling applied to the pulse (copied from Dynamics.initial_ctrl_scaling if given)
- offsetfloat
linear offset applied to the pulse (copied from Dynamics.initial_ctrl_offset if given)
- tauarray[num_tslots] of float
Duration of each timeslot (copied from Dynamics if given)
- lboundfloat
Lower boundary for the pulse amplitudes Note that the scaling and offset attributes can be used to fully bound the pulse for all generators except some of the random ones This bound (if set) may result in additional shifting / scaling Default is -Inf
- uboundfloat
Upper boundary for the pulse amplitudes Note that the scaling and offset attributes can be used to fully bound the pulse for all generators except some of the random ones This bound (if set) may result in additional shifting / scaling Default is Inf
- periodicboolean
True if the pulse generator produces periodic pulses
- randomboolean
True if the pulse generator produces random pulses
- log_levelinteger
level of messaging output from the logger. Options are attributes of qutip_qtrl.logging_utils, in decreasing levels of messaging, are: DEBUG_INTENSE, DEBUG_VERBOSE, DEBUG, INFO, WARN, ERROR, CRITICAL Anything WARN or above is effectively ‘quiet’ execution, assuming everything runs as expected. The default NOTSET implies that the level will be taken from the QuTiP settings file, which by default is WARN
- apply_params(params=None)[source]
Set object attributes based on the dictionary (if any) passed in the instantiation, or passed as a parameter This is called during the instantiation automatically. The key value pairs are the attribute name and value
- class qutip_qtrl.pulsegen.PulseGenCrab(dyn=None, num_coeffs=None, params=None)[source]
Base class for all CRAB pulse generators Note these are more involved in the optimisation process as they are used to produce piecewise control amplitudes each time new optimisation parameters are tried
- Attributes:
- num_coeffsinteger
Number of coefficients used for each basis function
- num_basis_funcsinteger
Number of basis functions In this case set at 2 and should not be changed
- coeffsfloat array[num_coeffs, num_basis_funcs]
The basis coefficient values
- randomize_coeffsbool
If True (default) then the coefficients are set to some random values when initialised, otherwise they will all be equal to self.scaling
- estimate_num_coeffs(dim)[source]
Estimate the number coefficients based on the dimensionality of the system. :returns: num_coeffs – estimated number of coefficients :rtype: int
- get_optim_var_vals()[source]
Get the parameter values to be optimised :rtype: list (or 1d array) of floats
- init_coeffs(num_coeffs=None, init_coeffs=None)[source]
Generate or set the initial ceofficent values.
- Parameters:
- num_coeffsinteger
Number of coefficients used for each basis function If given this overides the default and sets the attribute of the same name.
- init_coeffsfloat array[num_coeffs * num_basis_funcs]
Typically this will be the initial basis coefficients. If set to None (the default), the initial coefficients will be automatically generated.
- class qutip_qtrl.pulsegen.PulseGenCrabFourier(dyn=None, num_coeffs=None, params=None, fix_freqs=True)[source]
Generates a pulse using the Fourier basis functions, i.e. sin and cos
- Attributes:
- freqsfloat array[num_coeffs]
Frequencies for the basis functions
- randomize_freqsbool
If True (default) the some random offset is applied to the frequencies
- fix_freqsbool
If True (default) then the frequencies of the basis functions are fixed and the number of basis functions is set to 2 (sin and cos). If False then the frequencies are also optimised, adding an additional parameter for each pair of basis functions.
- gen_pulse(coeffs=None)[source]
Generate a pulse using the Fourier basis with the freqs and coeffs attributes.
- Parameters:
- coeffsfloat array[num_coeffs, num_basis_funcs]
The basis coefficient values If given this overides the default and sets the attribute of the same name.
- class qutip_qtrl.pulsegen.PulseGenGaussian(dyn=None, params=None)[source]
Generates pulses with a Gaussian profile
- gen_pulse(mean=None, variance=None)[source]
Generate a pulse with Gaussian shape. The peak is centre around the mean and the variance determines the breadth The scaling and offset attributes are applied as an amplitude and fixed linear offset. Note that the maximum amplitude will be scaling + offset.
- class qutip_qtrl.pulsegen.PulseGenGaussianEdge(dyn=None, params=None)[source]
Generate pulses with inverted Gaussian ramping in and out It’s intended use for a ramping modulation, which is often required in experimental setups.
- Attributes:
- decay_timefloat
Determines the ramping rate. It is approximately the time required to bring the pulse to full amplitude It is set to 1/10 of the pulse time by default
- class qutip_qtrl.pulsegen.PulseGenLinear(dyn=None, params=None)[source]
Generates linear pulses
- Attributes:
- gradientfloat
Gradient of the line. Note this is calculated from the start_val and end_val if these are given
- start_valfloat
Start point of the line. That is the starting amplitude
- end_valfloat
End point of the line. That is the amplitude at the start of the last timeslot
- gen_pulse(gradient=None, start_val=None, end_val=None)[source]
Generate a linear pulse using either the gradient and start value or using the end point to calulate the gradient Note that the scaling and offset parameters are still applied, so unless these values are the default 1.0 and 0.0, then the actual gradient etc will be different Returns the pulse as an array of vales for each timeslot
- class qutip_qtrl.pulsegen.PulseGenPeriodic(dyn=None, params=None)[source]
Intermediate class for all periodic pulse generators All of the periodic pulses range from -1 to 1 All have a start phase that can be set between 0 and 2pi
- Attributes:
- num_wavesfloat
Number of complete waves (cycles) that occur in the pulse. wavelen and freq calculated from this if it is given
- wavelenfloat
Wavelength of the pulse (assuming the speed is 1) freq is calculated from this if it is given
- freqfloat
Frequency of the pulse
- start_phasefloat
Phase of the pulse signal when t=0
- init_pulse(num_waves=None, wavelen=None, freq=None, start_phase=None)[source]
Calculate the wavelength, frequency, number of waves etc from the each other and the other parameters If num_waves is given then the other parameters are worked from this Otherwise if the wavelength is given then it is the driver Otherwise the frequency is used to calculate wavelength and num_waves
- class qutip_qtrl.pulsegen.PulseGenRandom(dyn=None, params=None)[source]
Generates random pulses as simply random values for each timeslot
- class qutip_qtrl.pulsegen.PulseGenRndFourier(dyn=None, params=None)[source]
Generates pulses by summing sine waves as a Fourier series with random coefficients
- Attributes:
- scalingfloat
The pulses should fit approximately within -/+scaling (before the offset is applied) as it is used to set a maximum for each component wave Use bounds to be sure (copied from Dynamics.initial_ctrl_scaling if given)
- min_wavelenfloat
Minimum wavelength of any component wave Set by default to 1/10th of the pulse time
- class qutip_qtrl.pulsegen.PulseGenRndWalk1(dyn=None, params=None)[source]
Generates pulses by using a random walk algorithm
- Attributes:
- scalingfloat
Used as the range for the starting amplitude Note must used bounds if values must be restricted. Also scales the max_d_amp value (copied from Dynamics.initial_ctrl_scaling if given)
- max_d_ampfloat
Maximum amount amplitude will change between timeslots Note this is also factored by the scaling attribute
- class qutip_qtrl.pulsegen.PulseGenRndWalk2(dyn=None, params=None)[source]
Generates pulses by using a random walk algorithm Note this is best used with bounds as the walks tend to wander far
- Attributes:
- scalingfloat
Used as the range for the starting amplitude Note must used bounds if values must be restricted. Also scales the max_d2_amp value (copied from Dynamics.initial_ctrl_scaling if given)
- max_d2_ampfloat
Maximum amount amplitude gradient will change between timeslots Note this is also factored by the scaling attribute
- class qutip_qtrl.pulsegen.PulseGenRndWaves(dyn=None, params=None)[source]
Generates pulses by summing sine waves with random frequencies amplitudes and phase offset
- Attributes:
- scalingfloat
The pulses should fit approximately within -/+scaling (before the offset is applied) as it is used to set a maximum for each component wave Use bounds to be sure (copied from Dynamics.initial_ctrl_scaling if given)
- num_comp_wavesinteger
Number of component waves. That is the number of waves that are summed to make the pulse signal Set to 20 by default.
- min_wavelenfloat
Minimum wavelength of any component wave Set by default to 1/10th of the pulse time
- max_wavelenfloat
Maximum wavelength of any component wave Set by default to twice the pulse time
- class qutip_qtrl.pulsegen.PulseGenSaw(dyn=None, params=None)[source]
Generates saw tooth wave pulses
- class qutip_qtrl.pulsegen.PulseGenSine(dyn=None, params=None)[source]
Generates sine wave pulses
- gen_pulse(num_waves=None, wavelen=None, freq=None, start_phase=None)[source]
Generate a sine wave pulse If no params are provided then the class object attributes are used. If they are provided, then these will reinitialise the object attribs. returns the pulse as an array of vales for each timeslot
- class qutip_qtrl.pulsegen.PulseGenSquare(dyn=None, params=None)[source]
Generates square wave pulses
- class qutip_qtrl.pulsegen.PulseGenTriangle(dyn=None, params=None)[source]
Generates triangular wave pulses
- qutip_qtrl.pulsegen.create_pulse_gen(pulse_type='RND', dyn=None, pulse_params=None)[source]
Create and return a pulse generator object matching the given type. The pulse generators each produce a different type of pulse, see the gen_pulse function description for details. These are the random pulse options:
RND - Independent random value in each timeslot RNDFOURIER - Fourier series with random coefficients RNDWAVES - Summation of random waves RNDWALK1 - Random change in amplitude each timeslot RNDWALK2 - Random change in amp gradient each timeslot
These are the other non-periodic options:
LIN - Linear, i.e. contant gradient over the time ZERO - special case of the LIN pulse, where the gradient is 0
These are the periodic options
SINE - Sine wave SQUARE - Square wave SAW - Saw tooth wave TRIANGLE - Triangular wave
If a Dynamics object is passed in then this is used in instantiate the PulseGen, meaning that some timeslot and amplitude properties are copied over.