API
Qarray, a GPU accelerated quantum dot array simulator, leveraging parallelised Rust and JAX XLA acceleration to compute charge stability diagrams of large both open and closed arrays in milliseconds.
- class qarray.ChargeSensedDotArray(Cdd: CddNonMaxwell, Cgd: CgdNonMaxwell, Cds: CdsNonMaxwell, Cgs: CgsNonMaxwell, algorithm: str | None = 'default', implementation: str | None = 'rust', threshold: float | str = 1.0, max_charge_carriers: int | None = None, polish: bool = True, batch_size: int | None = None, charge_carrier: str = 'h', T: float | int = 0.0, n_peak: int = 5, coulomb_peak_width: float = 0.1, noise_model: BaseNoiseModel | None = None, latching_model: LatchingBaseModel | None = None)
A class that represents a charge sensed dot array. The class has methods to compute the ground state of the dot array and the charge sensor output for both open and closed dot arrays.
The class has the following attributes:
Cdd: an (n_dot, n_dot) array of the capacitive coupling between dots
Cgd: an (n_dot, n_gate) array of the capacitive coupling between gates and dots
Cds: an (n_sensor, n_dot) array of the capacitive coupling between dots and sensors
Cgs: an (n_sensor, n_gate) array of the capacitive coupling between gates and dots
algorithm: the algorithm to use to compute the ground state
implementation: the implementation to use to compute the ground state
threshold: the threshold to use if the threshold algorithm is used
max_charge_carriers: the maximum number of charge carriers to use if the brute force algorithm is used
polish: a bool specifying whether to polish the result of the ground state computation by the default or thresholded algorithm
coulomb_peak_width: the width of the lorentzian peaks
noise_model: the noise model to use to add noise to the charge sensor output
- charge_sensor_closed(vg: VectorList | ndarray, n_charge) ndarray
Computes the charge sensor output for a closed dot array.
- Parameters:
vg – (…, n_gate) array of dot voltages to compute the charge sensor output for
n_charge – the number of charges to be confined in the dot array
- Returns:
(…, n_sensor) array of the charge sensor output
Noise is added according to the noise model passed to the ChargeSensedDotArray class.
- charge_sensor_open(vg: VectorList | ndarray) ndarray
Computes the charge sensor output for an open dot array.
- Parameters:
vg – (…, n_gate) array of dot voltages to compute the charge sensor output for
- Returns:
(…, n_sensor) array of the charge sensor output
Noise is added according to the noise model passed to the ChargeSensedDotArray class.
- check_threshold()
Checks if the threshold is below the optimal threshold for the system
- compute_optimal_virtual_gate_matrix()
Computes the optimal virtual gate matrix for the dot array and sets it as the virtual gate matrix in the gate voltage composer.
The virtual gate matrix is computed as the pseudo inverse of the dot to dot capacitance matrix times the dot to gate capacitance matrix.
returns np.ndarray: the virtual gate matrix
- compute_threshold_estimate()
Computes the threshold estimate for the dot array for use with the thresholded algorithm
- do1d_closed(gate: int | str, min: float, max: float, points: int, n_charge: int) ndarray
Performs a 1D sweep of the dot array with the gate in the closed configuration
- Parameters:
gate – the gate to sweep
min – the minimum value of the gate to sweep
max – the maximum value of the gate to sweep
points – the number of res to sweep the gate over
returns the ground state of the dot array which is a np.ndarray of shape (res, n_dot) in the closed configuration
- do1d_open(gate: int | str, min: float, max: float, points: int) ndarray
Performs a 1D sweep of the dot array with the gate in the open configuration
- Parameters:
gate – the gate to sweep
min – the minimum value of the gate to sweep
max – the maximum value of the gate to sweep
points – the number of res to sweep the gate over
returns the ground state of the dot array which is a np.ndarray of shape (res, n_dot) in the open configuration
- do2d_closed(x_gate: int | str, x_min: float, x_max: float, x_points: int, y_gate: int | str, y_min: float, y_max: float, y_points: int, n_charge: int) ndarray
Performs a 2D sweep of the dot array with the gates x_gate and y_gate in the open configuration
- Parameters:
x_gate – the gate to sweep in the x direction
x_min – the minimum value of the gate to sweep
x_max – the maximum value of the gate to sweep
x_points – the number of res to sweep the gate over
y_gate – the gate to sweep in the y direction
y_min – the minimum value of the gate to sweep
y_max – the maximum value of the gate to sweep
y_points – the number of res to sweep
returns the ground state of the dot array which is a np.ndarray of shape (x_res, y_res, n_dot) in the closed configuration
- do2d_open(x_gate: int | str, x_min: float, x_max: float, x_points: int, y_gate: int | str, y_min: float, y_max: float, y_points: int) ndarray
Performs a 2D sweep of the dot array with the gates x_gate and y_gate in the open configuration
- Parameters:
x_gate – the gate to sweep in the x direction
x_min – the minimum value of the gate to sweep
x_max – the maximum value of the gate to sweep
x_points – the number of res to sweep the gate over
y_gate – the gate to sweep in the y direction
y_min – the minimum value of the gate to sweep
y_max – the maximum value of the gate to sweep
y_points – the number of res to sweep
returns the ground state of the dot array which is a np.ndarray of shape (x_res, y_res, n_dot) in the open configuration
- ground_state_closed(vg: VectorList | ndarray, n_charge: int) ndarray
Computes the ground state for a closed dot array. :param vg: (…, n_gate) array of dot voltages to compute the ground state for :param n_charge: the number of charges to be confined in the dot array :return: (…, n_dot) array of the number of charges to compute the ground state for
- ground_state_open(vg: VectorList | ndarray) ndarray
Computes the ground state for an open dot array. :param vg: (…, n_gate) array of dot voltages to compute the ground state for :return: (…, n_dot) array of ground state charges
- gui(port=9001, run=True, print_compute_time=True, initial_dac_values=None, initial_virtual_gate_matrix=None)
A function to open the GUI for the ChargeSensedDotArray class
- optimal_Vg(n_charges: VectorList, rcond: float = 0.001) ndarray
Computes the optimal dot voltages for a given charge configuration, of shape (n_dot + n_sensor,). :param n_charges: the charge configuration :param rcond: the rcond parameter for the least squares solver :return: the optimal dot voltages of shape (n_gate,)
- class qarray.DotArray(Cdd: CddNonMaxwell | None = None, Cgd: CgdNonMaxwell | None = None, cdd: Cdd | None = None, cgd: PositiveValuedMatrix | NegativeValuedMatrix | None = None, cdd_inv: ndarray | None = None, algorithm: str | None = 'default', implementation: str | None = 'rust', threshold: float | str = 1.0, max_charge_carriers: int | None = None, charge_carrier: str = 'hole', T: float | int = 0.0, batch_size: int = 10000, polish: bool = True, latching_model: LatchingBaseModel | None = None, gate_voltage_composer: GateVoltageComposer | None = None)
A class to represent a quantum dot array. The class is initialized with the following parameters:
Cdd: CddNonMaxwell | None = None # an (n_dot, n_dot) the capacitive coupling between dots Cgd: CgdNonMaxwell | None = None # an (n_dot, n_gate) the capacitive coupling between gates and dots
cdd: Cdd | None = None # an (n_dot, n_dot) the capacitive coupling between dots cgd: PositiveValuedMatrix | NegativeValuedMatrix | None = None # an (n_dot, n_gate) the capacitive coupling between gates and dots
algorithm: str | None = ‘default’ # which algorithm to use implementation: str | None = ‘rust’
threshold: float | str = 1. # if the threshold algorithm is used the user needs to pass the threshold max_charge_carriers: int | None = None # if the brute force algorithm is used the user needs to pass the maximum number of charge carriers
charge_carrier: str = ‘hole’ # a string of either ‘electron’ or ‘hole’ to specify the charge carrie T: float | int = 0. # the temperature of the system for if there is thermal broadening
- compute_optimal_virtual_gate_matrix()
Computes the optimal virtual gate matrix for the dot array and sets it as the virtual gate matrix in the gate voltage composer.
The virtual gate matrix is computed as the pseudo inverse of the dot to dot capacitance matrix times the dot to gate capacitance matrix.
returns np.ndarray: the virtual gate matrix
- compute_threshold_estimate()
Computes the threshold estimate for the dot array for the thresholded algorithm
- do1d_closed(gate: int | str, min: float, max: float, res: int, n_charges: int) ndarray
Performs a 1D sweep of the dot array with the gate
- Parameters:
gate – the gate to sweep
min – the minimum value of the gate to sweep
max – the maximum value of the gate to sweep
res – the number of res to sweep the gate over
n_charges – the number of charges to be confined in the dot array
returns the ground state of the dot array which is a np.ndarray of shape (res, n_dot)
- do1d_open(gate: int | str, min: float, max: float, res: int) ndarray
Performs a 1D sweep of the dot array with the gate
- Parameters:
gate – the gate to sweep
min – the minimum value of the gate to sweep
max – the maximum value of the gate to sweep
res – the number of res to sweep the gate over
returns the ground state of the dot array which is a np.ndarray of shape (res, n_dot)
- do2d_closed(x_gate: int | str, x_min: float, x_max: float, x_res: int, y_gate: int | str, y_min: float, y_max: float, y_res: int, n_charges: int) ndarray
Performs a 2D sweep of the dot array with the gates x_gate and y_gate
- Parameters:
x_gate – the gate to sweep in the x direction
x_min – the minimum value of the gate to sweep
x_max – the maximum value of the gate to sweep
x_res – the number of res to sweep the gate over
y_gate – the gate to sweep in the y direction
y_min – the minimum value of the gate to sweep
y_max – the maximum value of the gate to sweep
y_res – the number of res to sweep the gate over
n_charges – the number of charges to be confined in the dot array
returns the ground state of the dot array which is a np.ndarray of shape (x_res, y_res, n_dot)
- do2d_open(x_gate: int | str, x_min: float, x_max: float, x_res: int, y_gate: int | str, y_min: float, y_max: float, y_res: int) ndarray
Performs a 2D sweep of the dot array with the gates x_gate and y_gate
- Parameters:
x_gate – the gate to sweep in the x direction
x_min – the minimum value of the gate to sweep
x_max – the maximum value of the gate to sweep
x_res – the number of res to sweep the gate over
y_gate – the gate to sweep in the y direction
y_min – the minimum value of the gate to sweep
y_max – the maximum value of the gate to sweep
y_res – the number of res to sweep the
returns the ground state of the dot array which is a np.ndarray of shape (x_res, y_res, n_dot)
- free_energy(n, vg)
Computes the free energy of the change configurations
- ground_state_closed(vg: VectorList | ndarray, n_charges: int) ndarray
Computes the ground state for a closed dot array. :param vg: (…, n_gate) array of dot voltages to compute the ground state for :param n_charges: the number of charges to be confined in the dot array :return: (…, n_dot) array of the number of charges to compute the ground state for
- ground_state_open(vg: VectorList | ndarray) ndarray
Computes the ground state for an open dot array. :param vg: (…, n_gate) array of dot voltages to compute the ground state for :return: (…, n_dot) array of ground state charges
- optimal_Vg(n_charges: VectorList, rcond: float = 0.001) ndarray
Computes the optimal dot voltages for a given charge configuration, of shape (n_charge,). :param n_charges: the charge configuration :param rcond: the rcond parameter for the least squares solver :return: the optimal dot voltages of shape (n_gate,)
- run_gui(port=9000, print_compute_time: bool = False, initial_dac_values=None)
Creates a GUI for the dot array
- Parameters:
port – the port to run the GUI on
print_compute_time – a bool specifying whether to print the compute time
initial_dac_values – the initial dac values to set the GUI to as a numpy array of length n_gate
- update_capacitance_matrices(Cdd: CddNonMaxwell, Cgd: CgdNonMaxwell)
Updates the capacitance matrices of the dot array
- Parameters:
Cdd – the new Cdd matrix
Cgd – the new Cgd matrix
- Returns:
None
- class qarray.GateVoltageComposer(n_gate: int, n_dot: int | None = None, n_sensor: int | None = 0, virtual_gate_origin: ndarray | None = None, virtual_gate_matrix: ndarray | None = None)
This class is used to compose dot voltages for the dot array.
- do1d(gate: str | int, min: float, max: float, res: int) ndarray
This function is used to compose a 1d dot voltage array. :param x_gate: :param x_min: :param x_max: :param x_res: :return:
- do2d(x_gate: str | int, x_min: float, x_max: float, x_res: int, y_gate: str | int, y_min: float, y_max: float, y_res: int) ndarray
This function is used to compose a 2d dot voltage array. :param x_gate: :param x_min: :param x_max: :param x_res: :param y_gate: :param y_min: :param y_max: :param y_res: :return:
- meshgrid(gates: List[str | int], arrays: List[ndarray]) ndarray
This function is used to compose a dot voltage array, given a list of gates and a list of arrays it will compose a dot voltage array, based on the meshgrid of the arrays. :param gates: a list of gates to be varied :param arrays: a list of arrays to be meshgridded :return: a dot voltage array
- meshgrid_virtual(dots: List[str | int], arrays: List[ndarray]) ndarray
This function is used to compose a virtual gate voltage array, given a list of gates and a list of arrays it will compose a dot voltage array, based on the meshgrid of the arrays.
- Parameters:
dots – a list of dots to be varied
arrays – a list of arrays to be meshgridded
- Returns:
a dot voltage array
- qarray.charge_state_changes(n: Tetrad | ndarray, dot='any') ndarray
If the user passes the np.ndarray n array of shape (Nx, Ny, N_dot) which is outputted from a do2d funciton then this function will return a boolean array of shape (Nx-1, Ny-1, N_dot) which will be true if the charge state of the dot changes between in either the x or y direction.
- Parameters:
n – the dot occupation rank 3 tensor of shape (res_y, res_x, n_dot)
- Returns:
the boolean array of whether the charge state changes (rank 2 tensor of shape (res_y - 1, res_x - 1))
- qarray.charge_state_dot_product(n: Tetrad | ndarray, values: Vector | ndarray) VectorList
Function which computes the dot product between the dot change state and the values in “values”, thereby assigning a scalar value to each charge state.
- Parameters:
n – the dot occupation vector of shape (…, n_dot)
values – the values to assign to each charge state of shape (n_dot)
- Returns:
the dot product between the dot change state and the values in “values” of shape (…)
- qarray.charge_state_to_scalar(n: Tetrad | ndarray) int
Function to convert the charge state to a unique index, using the binary representation.
Function to convert the charge state to a random index. This is useful for plotting the change state. So that the vector of charges in converted to a random integer value. As such nearby charge states will have similar colors.
For plotting we recommend taking, if the output of this function is z, then we reccomend plotting np.log2(z + 1) to get a better color map.
- Parameters:
n – the charge state of the dots of shape (n_dot)
- Returns:
the unique index
- qarray.compute_optimal_virtual_gate_matrix(cdd_inv: CddInv, cgd: Cgd_holes, rcond: float = 0.0001) ndarray
Function to compute the optimal virtual gate matrix.
- Parameters:
cdd_inv – the inverse of the dot to dot capacitance matrix
cgd – the dot to gate capacitance matrix
rcond – the rcond parameter for the pseudo inverse
- Returns:
the optimal virtual gate matrix
- qarray.optimal_Vg(cdd_inv: CddInv, cgd: Cgd_holes, n_charges: VectorList, rcond: float = 0.001)
calculate voltage that minimises charge state’s energy
- Parameters:
cdd_inv – the inverse of the dot to dot capacitance matrix
cgd – the dot to gate capacitance matrix
n_charges – the charge state of the dots of shape (n_dot)
- Returns:
- class qarray.noise_models.BaseNoiseModel
The base noise model class that all noise models should inherit from. This class defines the interface that all noise models should implement.
The interface consists of two methods:
sample_input_noise: This method should return the input noise for the charge sensor model. This noise perturbs the
potential of the dots in the charge sensor, before those potentials are used in the Lorenzian function to calculate the charge sensor output.
sample_output_noise: This method should return the output noise for the charge sensor model. This noise perturbs the output of the charge sensor model, after the Lorenzian function has been applied to the potentials of the dots in the charge sensor.
The BaseNoiseModel class also overloads the addition operator to allow for the addition of noise models. This allows you to add noise models together to create composite noise models.
- sample_input_noise(shape)
Sample input noise from the noise model. This noise perturbs the potential of the dots in the charge sensor, before those potentials are used in the Lorenzian function to calculate the charge sensor output.
- sample_output_noise(shape)
Sample output noise from the noise model. This noise perturbs the output of the charge sensor model, after the Lorenzian function has been applied to the potentials of the dots in the charge sensor.
- class qarray.noise_models.NoNoise
A noise model which adds no noise to the charge sensor output.
- class qarray.noise_models.TelegraphNoise(amplitude: float, p01: float, p10: float)
A telegraph noise model that can be added to a charge sensing model to simulate the effect of telegraph noise.
The noise model is a simple model that can be used to simulate the effect of telegraph noise on a charge sensing model. The model is based on a simple telegraph noise model where the noise can switch between two states with different probabilities. The model has three parameters:
amplitude: The amplitude of the noise. As the noise perturbs the potential of the dots in the charge sensor, this is in volts.
p01: The probability that the noise switches from 0 to 1 per pixel
p10: The probability that the noise switches from 1 to 0 per pixel
- sample_input_noise(shape)
Sample input noise from the telegraph noise model. This noise perturbs the potential of the dots in the charge sensor, before those potentials are used in the Lorentzian function to calculate the charge sensor output.
- class qarray.noise_models.WhiteNoise(amplitude: float)
A white noise model that can be added to a charge sensing model to simulate the effect of white noise. - amplitude: The amplitude of the noise. As the noise perturbs the charge sensor output, this is in volts.
- sample_output_noise(shape)
Sample output noise from the white noise model. This noise perturbs the charge sensor output.
- class qarray.latching_models.LatchingBaseModel
The base latching model class that all latching models should inherit from. This class defines the interface that all latching models should implement.
- class qarray.latching_models.LatchingModel(n_dots: int, p_leads: float | ndarray, p_inter: float | ndarray)
A latching model that adds latching to the dot occupation vector. This model adds latching to the dot occupation vector by changing the dot occupation vector at each time step with a probability p_leads for the leads and a probability p_inter for the inter-dot couplings.
The dot occupation vector is latched by comparing the dot occupation vector at the current time step with the dot occupation vector at the previous time step. If the dot occupation vector at the current time step differs from the dot occupation vector at the previous time step, the dot occupation vector at the current time step is changed with a probability p_leads for the leads and a probability p_inter for the inter-dot couplings. The dot occupation vector at the current time step is then compared with the dot occupation vector at the previous time step again, and the process is repeated until the dot occupation vector at the current time step is the same as the dot occupation vector at the previous time step.
Parameters: - n_dots (int): The number of dots in the dot occupation vector. - p_leads (float | np.ndarray): The probability of latching for the leads. If a float, the same probability is used for all leads. If an np.ndarray, the probability of latching for each lead is specified. - p_inter (float | np.ndarray): The probability of latching for the inter-dot couplings. If a float, the same probability is used for all inter-dot couplings. If an np.ndarray, the probability of latching for each inter-dot coupling is specified.
- add_latching(n: VectorList, measurement_shape) VectorList
Add latching to the dot occupation vector.
Parameters: - n (np.ndarray): The dot occupation vector of shape (…, n_dots). - measurement_shape (Tuple[int]): The shape of the measurement.
Returns: - n_latched (np.ndarray): The latched dot occupation vector of shape (…, n_dots).
- class qarray.latching_models.PSBLatchingModel(n_dots: int, p_psb: float | ndarray)
A latching model that adds latching to the dot occupation vector. This model adds latching to the dot occupation vector by changing the dot occupation vector at each time step with a probability p_leads for the leads and a probability p_inter for the inter-dot couplings.
The dot occupation vector is latched by comparing the dot occupation vector at the current time step with the dot occupation vector at the previous time step. If the dot occupation vector at the current time step differs from the dot occupation vector at the previous time step, the dot occupation vector at the current time step is changed with a probability p_leads for the leads and a probability p_inter for the inter-dot couplings. The dot occupation vector at the current time step is then compared with the dot occupation vector at the previous time step again, and the process is repeated until the dot occupation vector at the current time step is the same as the dot occupation vector at the previous time step.
Parameters:
n_dots (int): The number of dots in the dot occupation vector.
p_psb (float | np.ndarray): The probability of latching for the inter-dot couplings. If a float, the same probability is used for all inter-dot couplings. If an np.ndarray, the probability of latching for each inter-dot coupling is specified.
- add_latching(n: VectorList, measurement_shape) VectorList
Add latching to the dot occupation vector.
Parameters:
n (np.ndarray): The dot occupation vector of shape (…, n_dots).
measurement_shape (tuple): The shape of the measurement.
Returns:
n_latched (np.ndarray): The latched dot occupation vector of shape (…, n_dots).