Discretization Classes¶
Grid1d¶
-
class
scqubits.Grid1d(min_val, max_val, pt_count)[source]¶ Data structure and methods for setting up discretized 1d coordinate grid, generating corresponding derivative matrices.
- Parameters
min_val (float) – minimum value of the discretized variable
max_val (float) – maximum value of the discretized variable
pt_count (int) – number of grid points
-
broadcast(event, **kwargs)¶ Request a broadcast from CENTRAL_DISPATCH reporting event.
- Parameters
event (str) – event name from EVENTS
**kwargs –
-
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
-
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) –
-
first_derivative_matrix(prefactor=1.0, periodic=False)[source]¶ Generate sparse matrix for first derivative of the form \(\partial_{x_i}\). Uses \(f'(x) \approx [f(x+h) - f(x-h)]/2h\).
- Parameters
prefactor (float or complex, optional) – prefactor of the derivative matrix (default value: 1.0)
periodic (bool, optional) – set to True if variable is a periodic variable
- Returns
- Return type
sparse matrix in dia format
-
get_initdata()[source]¶ Returns dict appropriate for creating/initializing a new Grid1d object.
- Returns
- Return type
dict
-
receive(event, sender, **kwargs)¶ Receive a message from CENTRAL_DISPATCH and initiate action on it.
- Parameters
event (str) – event name from EVENTS
sender (DispatchClient) – original sender reporting the event
**kwargs –
-
second_derivative_matrix(prefactor=1.0, periodic=False)[source]¶ Generate sparse matrix for second derivative of the form \(\partial^2_{x_i}\). Uses \(f''(x) \approx [f(x+h) - 2f(x) + f(x-h)]/h^2\).
- Parameters
prefactor (float, optional) – optional prefactor of the derivative matrix (default value = 1.0)
periodic (bool, optional) – set to True if variable is a periodic variable (default value = False)
- Returns
- Return type
sparse matrix in dia format
-
serialize()¶ Convert the content of the current class instance into IOData format.
- Returns
- Return type
scqubits.io_utils.file_io_base.IOData
GridSpec¶
-
class
scqubits.core.discretization.GridSpec(minmaxpts_array)[source]¶ Class for specifying a general discretized coordinate grid (arbitrary dimensions).
- Parameters
minmaxpts_array (ndarray) – array of with entries [minvalue, maxvalue, number of points]
-
broadcast(event, **kwargs)¶ Request a broadcast from CENTRAL_DISPATCH reporting event.
- Parameters
event (str) – event name from EVENTS
**kwargs –
-
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
-
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
-
receive(event, sender, **kwargs)¶ Receive a message from CENTRAL_DISPATCH and initiate action on it.
- Parameters
event (str) – event name from EVENTS
sender (DispatchClient) – original sender reporting the event
**kwargs –
-
serialize()¶ Convert the content of the current class instance into IOData format.
- Returns
- Return type
scqubits.io_utils.file_io_base.IOData