SpectrumLookupMixin¶
- class scqubits.core.spec_lookup.SpectrumLookupMixin(*args, **kwargs)[source]¶
SpectrumLookupMixin is used as a mix-in class by ParameterSweep.
It makes various spectrum and spectrum lookup related methods directly available at the ParameterSweep level.
Methods
SpectrumLookupMixin.__init__
(*args, **kwargs)Checks whether the indices provided fix all the parameters.
Return ndarray of bare eigenstates for given subsystems and parameter index.
SpectrumLookupMixin.bare_eigenvals
(subsys[, ...])Return
NamedSlotsNdarray
of bare eigenenergies for given subsystem, usually to be used with preslicing.SpectrumLookupMixin.bare_index
(dressed_index)For given dressed index, look up the corresponding bare index.
SpectrumLookupMixin.bare_productstate
(bare_index)Return the bare product state specified by bare_index.
SpectrumLookupMixin.dressed_index
(bare_labels)For given bare product state return the corresponding dressed-state index.
A dressed state is a superposition of bare states.
SpectrumLookupMixin.eigensys
([param_indices])Return the list of dressed eigenvectors.
SpectrumLookupMixin.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.
Label the dressed states by bare labels and generate the lookup table with one of the following methods: - Dressed Energy (ordering="DE"): traverse the eigenstates in the order of their dressed energy, and find the corresponding bare state label by overlaps (default) - Lexical (ordering="LX"): traverse the bare states in `lexical order`_, and perform the branch analysis generalized from Dumas et al. (2024).
SpectrumLookupMixin.reset_preslicing
()Convert the NpIndices parameter indices to a tuple of NpIndices.
Attributes
hilbertspace
- all_params_fixed(param_indices)[source]¶
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)[source]¶
Return ndarray of bare eigenstates for given subsystems and parameter index.
Eigenstates are expressed in the basis internal to the subsystems. Usually to be used with pre-slicing when part of ParameterSweep.
- Return type:
- Parameters:
subsys (QuantumSys)
param_indices (Tuple[int, ...] | None)
- bare_eigenvals(subsys, param_indices=None)[source]¶
Return
NamedSlotsNdarray
of bare eigenenergies for given subsystem, usually to be used with preslicing.- Parameters:
subsys (QuantumSys) – Hilbert space subsystem for which bare eigendata is to be looked up
param_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)[source]¶
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 (Tuple[int, ...] | None)
- bare_productstate(bare_index)[source]¶
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
- dressed_index(bare_labels, param_npindices=None)[source]¶
For given bare product state return the corresponding dressed-state index.
- Parameters:
bare_labels (
Tuple
[int
,...
]) – bare_labels = (index, index2, …) Dimension: (self.hilbertspace.subsystem_count,)param_npindices (
Union
[int
,slice
,Tuple
[int
],List
[int
],Tuple
[Union
[int
,slice
,Tuple
[int
],List
[int
]],...
],None
]) – indices of parameter values of interest Depending on the nature of the slice, this can be a single parameter point or multiple ones.
- Return type:
Union
[ndarray
,int
,None
]- Returns:
dressed state index closest to the specified bare state with excitation numbers given by bare_labels. If param_npindices spans multiple parameter points, then this returns a corresponding 1d array of length dictated by the number of parameter points.
- dressed_state_components(state_label, components_count=None, return_probability=True, param_npindices=None)[source]¶
A dressed state is a superposition of bare states. This function returns a dressed state’s bare conponents and the associated occupation probabilities. They are sorted by probability in descending order.
- Parameters:
state_label (
Union
[Tuple
[int
,...
],List
[int
],int
]) –- The bare label of the dressed state of interest. Could be
a tuple/list of bare labels (int)
a single dressed label (int)
components_count (
Optional
[int
]) – The number of components to be returned. If None, all components will be returned.return_probability (
bool
) – Whether to return the occupation probabilities. If not, return the probability amplitudes.param_npindices (
Union
[int
,slice
,Tuple
[int
],List
[int
],Tuple
[Union
[int
,slice
,Tuple
[int
],List
[int
]],...
],None
]) – This method only allows for a HilbertSpace object or a single parameter ParameterSweep. If it’s a multi-dimensional sweep, param_npindices should be provided to specify a point in the parameter space. If None, the current parameter preslicing will be used.
- Return type:
Dict
[Tuple
[int
,...
],float
]- Returns:
A dictionary of the bare labels and their associated probability
(or probability amplitude if specified).
- eigensys(param_indices=None)[source]¶
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)[source]¶
Return the array of dressed eigenenergies - primarily for running the sweep
- Parameters:
question (position indices of parameter values in)
param_indices (Tuple[int, ...] | None)
- 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_npindices=None)[source]¶
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_npindices (
Union
[int
,slice
,Tuple
[int
],List
[int
],Tuple
[Union
[int
,slice
,Tuple
[int
],List
[int
]],...
],None
]) – indices specifying the set of parameters
- Return type:
Union
[float
,NamedSlotsNdarray
]- Returns:
dressed energies, if lookup successful, otherwise nan;
- energy_by_dressed_index(dressed_index, subtract_ground=False, param_indices=None)[source]¶
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:
Union
[float
,NamedSlotsNdarray
]- Returns:
dressed energy
- generate_lookup(ordering='DE', subsys_priority=None, BEs_count=None)[source]¶
Label the dressed states by bare labels and generate the lookup table with one of the following methods: - Dressed Energy (ordering=”DE”): traverse the eigenstates in the order of their dressed energy, and find the corresponding bare state label by overlaps (default) - Lexical (ordering=”LX”): traverse the bare states in `lexical order`_, and perform the branch analysis generalized from Dumas et al. (2024). - Bare Energy (ordering=”BE”): traverse the bare states in the order of their energy before coupling and perform label assignment. This is particularly useful when the Hilbert space is too large and not all the eigenstates need to be labeled.
- Parameters:
ordering (
Literal
['DE'
,'LX'
,'BE'
]) – the ordering method for the dressed state labeling - “DE”: Dressed Energy (default) - “LX”: Lexical ordering - “BE”: Bare Energysubsys_priority (
Optional
[List
[int
]]) – a permutation of the subsystem indices and bare labels. If it is provided, lexical ordering is performed on the permuted labels. A “branch” is defined as a series of eigenstates formed by putting excitations into the last subsystem in the list.BEs_count (
Optional
[int
]) – the number of eigenstates to be assigned, for “BE” scheme only. If None, all available eigenstates will be labeled.
- Return type:
- Returns:
a NamedSlotsNdarray object containing the branch analysis results
organized by the parameter indices.
For each parameter point, a flattened multi-dimensional array
is stored, representing the dressed indices organized by the
bare indices. E.g. if the dimensions of the subsystems are D0, D1 and D2,
the returned array will be ravelled from the shape (D0, D1, D2).
.. _lexical order (https://en.wikipedia.org/wiki/Lexicographic_order#Cartesian_products/)