ParameterSweepBase#
- class scqubits.core.param_sweep.ParameterSweepBase(*args, **kwds)[source]#
The_ParameterSweepBase class is an abstract base class for ParameterSweep and StoredSweep
Methods
ParameterSweepBase.__init__(*args, **kwargs)ParameterSweepBase.add_matelem_sweep(...[, ...])Generate data for matrix elements with respect to a given operator, as a function of the sweep parameter(s)
ParameterSweepBase.add_sweep(sweep_function)Add a new sweep to the ParameterSweep object.
Checks whether the indices provided fix all the parameters.
Return ndarray of bare eigenstates for given subsystems and parameter index.
ParameterSweepBase.bare_eigenvals(subsys[, ...])Return NamedSlotsNdarray of bare eigenenergies for given subsystem, usually to be used with preslicing.
ParameterSweepBase.bare_index(dressed_index)For given dressed index, look up the corresponding bare index.
ParameterSweepBase.bare_productstate(bare_index)Return the bare product state specified by bare_index.
Returns number of dressed eigenvalues included in sweep.
ParameterSweepBase.dressed_index(bare_labels)For given bare product state return the corresponding dressed-state index.
ParameterSweepBase.eigensys([param_indices])Return the list of dressed eigenvectors
ParameterSweepBase.eigenvals([param_indices])Return the array of dressed eigenenergies - primarily for running the sweep
Look up dressed energy most closely corresponding to the given bare-state labels
Look up the dressed eigenenergy belonging to the given dressed index, usually to be used with pre-slicing
For each parameter value of the parameter sweep, generate the map between bare states and dressed states.
ParameterSweepBase.get_subsys(index)- rtype
ParameterSweepBase.get_subsys_index(subsys)- rtype
int
ParameterSweepBase.get_sweep_indices(multi_index)For given generalized multi-index, return a list of the indices that are being swept.
ParameterSweepBase.keys()Plot transition energies as a function of one external parameter.
ParameterSweepBase.receive(event, sender, ...)Hook to CENTRAL_DISPATCH.
ParameterSweepBase.set_npindextuple([...])- rtype
Tuple[Union[int,slice,Tuple[int],List[int]],...]
Account for the two possible signatures of the update_hilbertspace function.
ParameterSweepBase.subsys_by_id_str(id_str)- rtype
ParameterSweepBase.subsys_evals_count(...)- rtype
int
Use dressed eigenenergy data and lookup based on bare product state labels to extract transition energy data.
Attributes
Wrap bare eigensystem data into a SpectrumData object.
Wrap dressed eigensystem data into a SpectrumData object.
hilbertspaceosc_subsys_listReturn a dictionary of the parameter names and values used in this sweep.
Return the Parameter object (access parameter values/indexing)
qbt_subsys_listsubsystem_countsystem_params- add_matelem_sweep(operator, sweep_name, subsystem=None)[source]#
Generate data for matrix elements with respect to a given operator, as a function of the sweep parameter(s)
- Parameters
operator (
Union[str,Qobj]) – name of the operator in question (str), or full operator in Qobj formsweep_name (
str) – The sweep data will be accessible as <ParameterSweep>[<sweep_name>]subsystem (
Optional[QuantumSystem]) – subsystems for which to compute matrix elements, required if operator is given in str form
- Return type
None- Returns
None; results are saved as <ParameterSweep>[<sweep_name>]
- add_sweep(sweep_function, sweep_name=None, **kwargs)[source]#
Add a new sweep to the ParameterSweep object. The generated data is subsequently accessible through <ParameterSweep>[<sweep_function>] or <ParameterSweep>[<sweep_name>]
- Parameters
sweep_function (
Union[str,Callable]) – name of a sweep function in scq.sweeps as str, or custom function ( callable) provided by the usersweep_name (
Optional[str]) – if given, the generated data is stored in <ParameterSweep>[<sweep_name>] rather than [<sweep_name>]kwargs – keyword arguments handed over to the sweep function
- Return type
None- Returns
None
- all_params_fixed(param_indices)#
Checks whether the indices provided fix all the parameters.
- Parameters
param_indices (
Union[slice,tuple]) – Tuple or slice fixing all or a subset of the parameters.- Return type
bool- Returns
True if all parameters are being fixed by param_indices.
- bare_eigenstates(subsys, param_indices=None)#
Return ndarray of bare eigenstates for given subsystems and parameter index. Eigenstates are expressed in the basis internal to the subsystems. Usually to be with pre-slicing.
- Return type
- Parameters
subsys (Union[QubitBaseClass, Oscillator, KerrOscillator, GenericQubit]) –
param_indices (Optional[Tuple[int, ...]]) –
- bare_eigenvals(subsys, param_indices=None)#
Return NamedSlotsNdarray of bare eigenenergies for given subsystem, usually to be used with preslicing.
- Parameters
subsys (
Union[QubitBaseClass, Oscillator, KerrOscillator, GenericQubit]) – Hilbert space subsystem for which bare eigendata is to be looked upparam_indices (
Optional[Tuple[int,...]]) – position indices of parameter values in question
- Return type
- Returns
bare eigenenergies for the specified subsystem and the external parameter fixed to the value indicated by its index
- bare_index(dressed_index, param_indices=None)#
For given dressed index, look up the corresponding bare index.
- Return type
Optional[Tuple[int,...]]- Returns
Bare state specification in tuple form. Example: (1,0,3) means subsystem 1 is in bare state 1, subsystem 2 in bare state 0, and subsystem 3 in bare state 3.
- Parameters
dressed_index (int) –
param_indices (Optional[Tuple[int, ...]]) –
- bare_productstate(bare_index)#
Return the bare product state specified by bare_index. Note: no parameter dependence here, since the Hamiltonian is always represented in the bare product eigenbasis.
- Parameters
bare_index (
Tuple[int,...]) –- Return type
Qobj- Returns
ket in full Hilbert space
- property bare_specdata_list: List[SpectrumData]#
Wrap bare eigensystem data into a SpectrumData object. To be used with pre-slicing, e.g. <ParameterSweep>[0, :].bare_specdata_list
- Return type
List of SpectrumData objects with bare eigensystem data, one per subsystem
- dressed_evals_count()[source]#
Returns number of dressed eigenvalues included in sweep.
- Return type
int
- dressed_index(bare_labels, param_indices=None)#
For given bare product state return the corresponding dressed-state index.
- Parameters
bare_labels (
Tuple[int,...]) – bare_labels = (index, index2, …)param_indices (
Union[int,slice,Tuple[int],List[int],Tuple[Union[int,slice,Tuple[int],List[int]],...],None]) – indices of parameter values of interest
- Return type
Union[ndarray,int,None]- Returns
dressed state index closest to the specified bare state
- property dressed_specdata: SpectrumData#
Wrap dressed eigensystem data into a SpectrumData object. To be used with pre-slicing, e.g. <ParameterSweep>[0, :].dressed_specdata
- Return type
SpectrumData object with bare eigensystem data
- eigensys(param_indices=None)#
Return the list of dressed eigenvectors
- Parameters
param_indices (
Optional[Tuple[int,...]]) – position indices of parameter values in question- Return type
ndarray- Returns
dressed eigensystem for the external parameter fixed to the value indicated by the provided index
- eigenvals(param_indices=None)#
Return the array of dressed eigenenergies - primarily for running the sweep
- Parameters
question (position indices of parameter values in) –
param_indices (Optional[Tuple[int, ...]]) –
- Return type
ndarray- Returns
dressed eigenenergies for the external parameters fixed to the values indicated by the provided indices
- energy_by_bare_index(bare_tuple, subtract_ground=False, param_indices=None)#
Look up dressed energy most closely corresponding to the given bare-state labels
- Parameters
bare_tuple (
Tuple[int,...]) – bare state indicessubtract_ground (
bool) – whether to subtract the ground state energyparam_indices (
Union[int,slice,Tuple[int],List[int],Tuple[Union[int,slice,Tuple[int],List[int]],...],None]) – indices specifying the set of parameters
- Return type
- Returns
dressed energies, if lookup successful, otherwise nan;
- energy_by_dressed_index(dressed_index, subtract_ground=False, param_indices=None)#
Look up the dressed eigenenergy belonging to the given dressed index, usually to be used with pre-slicing
- Parameters
dressed_index (
int) – index of dressed state of interestsubtract_ground (
bool) – whether to subtract the ground state energyparam_indices (
Optional[Tuple[int,...]]) – specifies the desired choice of parameter values
- Return type
float- Returns
dressed energy
- generate_lookup()#
For each parameter value of the parameter sweep, generate the map between bare states and dressed states.
- Return type
- Returns
each list item is a list of dressed indices whose order corresponds to the ordering of bare indices (as stored in .canonical_bare_labels, thus establishing the mapping)
- get_sweep_indices(multi_index)[source]#
For given generalized multi-index, return a list of the indices that are being swept.
- Return type
List[int]- Parameters
multi_index (Tuple[Union[int, float, complex, slice, Tuple[int], List[int]], ...]) –
- property param_info: Dict[str, ndarray]#
Return a dictionary of the parameter names and values used in this sweep.
- property parameters: Parameters#
Return the Parameter object (access parameter values/indexing)
- plot_transitions(subsystems=None, initial=None, final=None, sidebands=False, photon_number=1, make_positive=True, coloring='transition', param_indices=None, **kwargs)[source]#
Plot transition energies as a function of one external parameter. Usage is based on preslicing of the ParameterSweep object to select a single parameter to be involved in the sweep. E.g.,
<ParameterSweep>[0, :, 2].plot_transitions()
plots all eigenenergy differences for transitions starting in the ground state (default when no initial state is specified) as a function of the middle parameter while parameters 1 and 3 are fixed by the indices 0 and 2.
- Parameters
subsystems (
Union[QuantumSystem,List[QuantumSystem],None]) – single subsystems or list of subsystems considered as “active” for the transitions to be generated; if omitted as a parameter, all subsystems are considered as actively participating in the transitionsinitial (
Union[int,Tuple[int,...],None]) – initial state from which transitions originate: the initial state can either be specified as a tuple referring to a bare product state, or as an integer representing the dressed state index. For bare product states, the required tuple has as many entries as the underlying HilbertSpace object has subsystems. (If subsystems is given, then the tuple may be reduced to entries for just these subsystems; other subsystems are given a “0” entry automatically.) The dressed state corresponding to the given bare product state is determined by considerations of overlaps. Note: for an initial dressed state, the sidebands option is ignored.final (
Union[int,Tuple[int,...],None]) – concrete final state for which the transition energy should be generated, given either as a bare product state (tuple of excitation numbers), or as a dressed state (non-negative integer). If final is omitted a list of final states is generated for dispersive transitions within each (active) subsystem. Sidebands can be switched on with the subsequent keyword option. final=-1 can be chosen for a final state list to all other dressed states (helpful when the dispersive limit breaks down).sidebands (
bool) – if set to true, sideband transitions with multiple subsystems changing excitation levels are included (default: False). This option is ignored if initial is given as an integer dressed state index.photon_number (
int) – number of photons involved in transition; transition frequencies are divided by this number (default: photon_number=1, i.e., single-photon transitions)make_positive (
bool) – boolean option relevant if the initial state is an excited state; downwards transition energies would regularly be negative, but are converted to positive if this flag is set to True (default: True)coloring (
Union[str,ndarray]) – For “transition” (default), transitions are colored by their dispersive nature; for “plain” no selective highlighting is attempted.param_indices (
Union[int,slice,Tuple[int],List[int],Tuple[Union[int,slice,Tuple[int],List[int]],...],None]) – usually to be omitted, as param_indices will be set via pre-slicing
- Return type
Tuple[Figure,Axes]- Returns
Plot Figure and Axes objects
- receive(event, sender, **kwargs)[source]#
Hook to CENTRAL_DISPATCH. This method is accessed by the global CentralDispatch instance whenever an event occurs that ParameterSweep is registered for. In reaction to update events, the lookup table is marked as out of sync.
- Parameters
event (
str) – type of event being receivedsender (
object) – identity of sender announcing the event**kwargs –
- Return type
None
- set_update_func(update_hilbertspace)[source]#
Account for the two possible signatures of the update_hilbertspace function. Inspect whether a self argument is given. If not, return a function that accepts self as a dummy argument.
- Return type
Callable- Parameters
update_hilbertspace (Callable) –
- transitions(as_specdata=False, subsystems=None, initial=None, final=None, sidebands=False, photon_number=1, make_positive=False, param_indices=None)[source]#
Use dressed eigenenergy data and lookup based on bare product state labels to extract transition energy data. Usage is based on preslicing to select all or a subset of parameters to be involved in the sweep, e.g.,
<ParameterSweep>[0, :, 2].transitions()
produces all eigenenergy differences for transitions starting in the ground state (default when no initial state is specified) as a function of the middle parameter while parameters 1 and 3 are fixed by the indices 0 and 2.
- Parameters
subsystems (
Union[QuantumSystem,List[QuantumSystem],None]) – single subsystems or list of subsystems considered as “active” for the transitions to be generated; if omitted as a parameter, all subsystems are considered as actively participating in the transitionsinitial (
Union[int,Tuple[int,...],None]) – initial state from which transitions originate, specified either (1) as a bare product state (tuple of excitation numbers of all subsystems or of the active ones given in subsystems); or (2) as a dressed-state index in the form of an integer >= 0. (default: (0,0,…,0) which is usually closest to the ground state)final (
Union[int,Tuple[int,...],None]) – concrete final state for which the transition energy should be generated, given either as a bare product state (tuple of excitation numbers), or as a dressed state (non-negative integer). If final is omitted a list of final states is generated for dispersive transitions within each (active) subsystem. Sidebands can be switched on with the subsequent keyword option. final=-1 can be chosen for a final state list to all other dressed states (helpful when the dispersive limit breaks down).sidebands (
bool) – if set to true, sideband transitions with multiple subsystems changing excitation levels are included (default: False)photon_number (
int) – number of photons involved in transition; transition frequencies are divided by this number (default: photon_number=1, i.e., single-photon transitions)make_positive (
bool) – boolean option relevant if the initial state is an excited state; downwards transition energies would regularly be negative, but are converted to positive if this flag is set to Trueas_specdata (
bool) – whether data is handed back in raw array form or wrapped into a SpectrumData object (default: False)param_indices (
Union[int,slice,Tuple[int],List[int],Tuple[Union[int,slice,Tuple[int],List[int]],...],None]) – usually to be omitted, as param_indices will be set via pre-slicing
- Return type
Union[Tuple[List[Tuple[Union[int,Tuple[int,...]],Union[int,Tuple[int,...]]]],List[NamedSlotsNdarray]],SpectrumData]- Returns
A tuple consisting of a list of all the transitions and a corresponding list of difference energies, e.g. ((0,0,0), (0,0,1)), <energy array for transition 0,0,0 -> 0,0,1>. If as_specdata is set to True, a SpectrumData object is returned instead, saving transition label info in an attribute named labels.