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)

SpectrumLookupMixin.all_params_fixed(...)

Checks whether the indices provided fix all the parameters.

SpectrumLookupMixin.bare_eigenstates(subsys)

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.

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

SpectrumLookupMixin.energy_by_bare_index(...)

Look up dressed energy most closely corresponding to the given bare-state labels

SpectrumLookupMixin.energy_by_dressed_index(...)

Look up the dressed eigenenergy belonging to the given dressed index, usually to be used with pre-slicing

SpectrumLookupMixin.generate_lookup()

For each parameter value of the parameter sweep, generate the map between bare states and dressed states.

SpectrumLookupMixin.reset_preslicing()

SpectrumLookupMixin.set_npindextuple([...])

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:

NamedSlotsNdarray

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:

NamedSlotsNdarray

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.

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 indices

  • subtract_ground (bool) – whether to subtract the ground state energy

  • param_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 interest

  • subtract_ground (bool) – whether to subtract the ground state energy

  • param_indices (Optional[Tuple[int, ...]]) – specifies the desired choice of parameter values

Return type:

Union[float, NamedSlotsNdarray]

Returns:

dressed energy

generate_lookup()[source]

For each parameter value of the parameter sweep, generate the map between bare states and dressed states.

Return type:

NamedSlotsNdarray

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)

set_npindextuple(param_indices=None)[source]

Convert the NpIndices parameter indices to a tuple of NpIndices.

Return type:

Tuple[Union[int, slice, Tuple[int], List[int]], ...]

Parameters:

param_indices (int | slice | Tuple[int] | List[int] | Tuple[int | slice | Tuple[int] | List[int], ...] | None)