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
  • param_name (str) – name of parameter being varies

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

  • energy_table (ndarray) – energy eigenvalues stored for each param_vals point

  • system_params (dict) – info about system parameters

  • state_table (ndarray or list, optional) – eigenstate data stored for each param_vals point, either as pure ndarray or list of qutip.qobj

  • matrixelem_table (ndarray, optional) – 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.

classmethod create_from_file(filename)

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

Parameters

filename (str) –

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.

Parameters

io_data (scqubits.io_utils.file_io_base.IOData) –

Returns

Return type

Serializable

filewrite(filename)

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

Parameters

filename (str) –

get_initdata()

Returns dict appropriate for creating/initializing a new Serializable object.

Returns

Return type

dict

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 (int or 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, optional) – whether to subtract the ground state energy, default: False

  • label_list (list(str), optional) – list of labels associated with the individual curves to be plotted

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

Returns

Return type

Figure, Axes

serialize()

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

Returns

Return type

scqubits.io_utils.file_io_base.IOData

subtract_ground()[source]

Subtract ground state energies from spectrum

DataStore

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

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

Parameters
  • param_name (str) – name of parameter being varies

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

  • system_params (dict) – info about system parameters

  • **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.

classmethod create_from_file(filename)

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

Parameters

filename (str) –

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.

Parameters

io_data (scqubits.io_utils.file_io_base.IOData) –

Returns

Return type

Serializable

filewrite(filename)

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

Parameters

filename (str) –

get_initdata()

Returns dict appropriate for creating/initializing a new Serializable object.

Returns

Return type

dict

serialize()

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

Returns

Return type

scqubits.io_utils.file_io_base.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 (float, optional) – 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 object) – grid specifications for the stored wave function

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

  • energy (float, optional) – energy corresponding to the wave function