Data Storage Classes

SpectrumData

class scqubits.core.storage.SpectrumData(energy_table, system_params, param_name=None, param_vals=None, state_table=None, matrixelem_table=None, **kwargs)[source]

Container holding energy and state data as a function of a particular parameter that is varied. Also stores all other system parameters used for generating the set, and provides method for writing data to file.

Parameters
  • energy_table (ndarray) – energy eigenvalues stored for each param_vals point, [[evals for first param_val], [evals for second param_val], …]

  • system_params (Dict[str, Any]) – info about system parameters

  • param_name (Optional[str]) – name of parameter being varied

  • param_vals (Optional[ndarray]) – parameter values for which spectrum data are stored

  • state_table (Union[List[QutipEigenstates], ndarray, List[ndarray]]) – eigenstate data stored for each param_vals point, either as pure ndarray or list of qutip.qobj

  • matrixelem_table (Optional[ndarray]) – matrix element data stored for each param_vals point

add_data(**kwargs)

Adds one or several data sets to the DataStorage object.

Parameters

**kwargsdataname=data with data an array-like object. The data set will be accessible through <DataStorage>.dataname.

Return type

None

classmethod create_from_file(filename)

Read initdata and spectral data from file, and use those to create a new SpectrumData object.

Returns

new SpectrumData object, initialized with data read from file

Return type

SpectrumData

classmethod deserialize(io_data)

Take the given IOData and return an instance of the described class, initialized with the data stored in io_data.

Return type

Serializable

filewrite(filename)

Convenience method bound to the class. Simply accesses the write function.

Return type

None

plot_evals_vs_paramvals(which=-1, subtract_ground=False, label_list=None, **kwargs)[source]

Plots eigenvalues of as a function of one parameter, as stored in SpectrumData object.

Parameters
  • which (Union[int, List[int]]) – default: -1, signals to plot all eigenvalues; int>0: plot eigenvalues 0..int-1; list(int) plot the specific eigenvalues (indices listed)

  • subtract_ground (bool) – whether to subtract the ground state energy, default: False

  • label_list (Optional[List[str]]) – list of labels associated with the individual curves to be plotted

  • **kwargs – standard plotting option (see separate documentation)

Return type

Tuple[Figure, Axes]

Returns

Figure and Axes objects for further processing

serialize()

Convert the content of the current class instance into IOData format.

Return type

IOData

subtract_ground()[source]

Subtract ground state energies from spectrum

Return type

None

DataStore

class scqubits.core.storage.DataStore(system_params, param_name=None, param_vals=None, **kwargs)[source]

Base class for storing and processing spectral data and custom data from parameter sweeps.

Parameters
  • system_params (Dict[str, Any]) – info about system parameters

  • param_name (Optional[str]) – name of parameter being varies

  • param_vals (Optional[ndarray]) – parameter values for which spectrum data are stored

  • **kwargs – keyword arguments for data to be stored: dataname=data, where data should be an array-like object

add_data(**kwargs)[source]

Adds one or several data sets to the DataStorage object.

Parameters

**kwargsdataname=data with data an array-like object. The data set will be accessible through <DataStorage>.dataname.

Return type

None

classmethod create_from_file(filename)

Read initdata and spectral data from file, and use those to create a new SpectrumData object.

Returns

new SpectrumData object, initialized with data read from file

Return type

SpectrumData

classmethod deserialize(io_data)

Take the given IOData and return an instance of the described class, initialized with the data stored in io_data.

Return type

Serializable

filewrite(filename)

Convenience method bound to the class. Simply accesses the write function.

Return type

None

serialize()

Convert the content of the current class instance into IOData format.

Return type

IOData


WaveFunction

class scqubits.core.storage.WaveFunction(basis_labels, amplitudes, energy=None)[source]

Container for wave function amplitudes defined for a specific basis. Optionally, a corresponding energy is saved as well.

Parameters
  • basis_labels (ndarray) – labels of basis states; for example, in position basis: values of position variable

  • amplitudes (ndarray) – wave function amplitudes for each basis label value

  • energy (Optional[float]) – energy of the wave function


WaveFunctionOnGrid

class scqubits.core.storage.WaveFunctionOnGrid(gridspec, amplitudes, energy=None)[source]

Container for wave function amplitudes defined on a coordinate grid (arbitrary dimensions). Optionally, a corresponding eigenenergy is saved as well.

Parameters
  • gridspec (GridSpec) – grid specifications for the stored wave function

  • amplitudes (ndarray) – wave function amplitudes on each grid point

  • energy (Optional[float]) – energy corresponding to the wave function