squadds.calcs package#
Submodules#
squadds.calcs.qubit module#
- class squadds.calcs.qubit.QubitHamiltonian(analysis)[source]#
Bases:
ABC
- abstract E01(EJ, EC)[source]#
Calculate the energy difference between the ground state (|0>) and the first excited state (|1>) of a qubit.
- Parameters:
EJ (-) – Josephson energy of the qubit.
EC (-) – Charging energy of the qubit.
- Returns:
Energy difference between the ground state and the first excited state.
- Return type:
float
- abstract E01_and_anharmonicity(EJ, EC)[source]#
Calculate the energy of the first excited state (E01) and the anharmonicity of a qubit.
- Parameters:
EJ (-) – Josephson energy of the qubit.
EC (-) – Charging energy of the qubit.
- Returns:
Energy of the first excited state. - anharmonicity (float): Anharmonicity of the qubit.
- Return type:
E01 (float)
- abstract EC(cross_to_claw, cross_to_ground)[source]#
Performs error correction on the qubit.
- Parameters:
cross_to_claw (float) – The cross-talk probability from the qubit to the claw.
cross_to_ground (float) – The cross-talk probability from the qubit to the ground.
- Returns:
None
- abstract EJ(f_q, alpha)[source]#
Calculate the Josephson energy (EJ) of a qubit.
- Parameters:
f_q (float) – The qubit frequency in Hz.
alpha (float) – The anharmonicity parameter.
- Returns:
The Josephson energy (EJ) in Joules.
- Return type:
float
- abstract EJ_and_LJ(f_q, alpha)[source]#
Calculate the Josephson energy (EJ) and the Josephson inductance (LJ) for a given qubit frequency (f_q) and anharmonicity (alpha).
- Parameters:
f_q (float) – The qubit frequency in Hz.
alpha (float) – The anharmonicity of the qubit in Hz.
- Returns:
A tuple containing the Josephson energy (EJ) and the Josephson inductance (LJ).
- Return type:
tuple
- abstract calculate_target_quantities(f_res, alpha, g, w_q, N, Z_0=50)[source]#
Calculate the target quantities for a qubit.
- Parameters:
f_res (-) – The resonance frequency of the qubit.
alpha (-) – The anharmonicity of the qubit.
g (-) – The coupling strength between the qubit and the resonator.
w_q (-) – The frequency of the qubit.
N (-) – The number of photons in the resonator.
Z_0 (-) – The characteristic impedance of the resonator. Default is 50 Ohms.
- Returns:
None
- abstract g_alpha_freq(C, C_c, EJ, f_r, res_type, Z0=50)[source]#
Calculate the alpha and frequency of a qubit.
- Parameters:
C (-) – Capacitance of the qubit.
C_c (-) – Coupling capacitance.
EJ (-) – Josephson energy.
f_r (-) – Resonator frequency.
res_type (-) – Resonator type.
Z0 (-) – Characteristic impedance. Default is 50.
- Returns:
Qubit anharmonicity. - freq (float): Qubit frequency.
- Return type:
alpha (float)
- abstract g_and_alpha(C, C_c, f_q, EJ, f_r, res_type, Z0=50)[source]#
Calculate the coupling strength (g) and anharmonicity (alpha) of a qubit.
- Parameters:
C (-) – Capacitance of the qubit.
C_c (-) – Coupling capacitance.
f_q (-) – Frequency of the qubit.
EJ (-) – Josephson energy of the qubit.
f_r (-) – Resonator frequency.
res_type (-) – Type of resonator.
Z0 (-) – Characteristic impedance of the transmission line. Default is 50 Ohms.
- Returns:
Coupling strength of the qubit. - alpha (float): Anharmonicity of the qubit.
- Return type:
g (float)
- abstract g_from_cap_matrix(C, C_c, EJ, f_r, res_type, Z0=50)[source]#
Calculate the coupling strength ‘g’ of a qubit from the capacitance matrix.
- Parameters:
C (-) – The capacitance matrix.
C_c (-) – The coupling capacitance.
EJ (-) – The Josephson energy.
f_r (-) – The resonant frequency.
res_type (-) – The type of resonator.
Z0 (-) – The characteristic impedance. Default is 50 Ohms.
Returns: - g (float): The coupling strength of the qubit.
squadds.calcs.transmon_cross module#
#!TODO: Generalize the half-wave cavity method usage
- squadds.calcs.transmon_cross.Ec_from_Cs(Cs)[source]#
Calculate the charging energy (Ec) in GHz from the capacitance (Cs) in fF.
- class squadds.calcs.transmon_cross.TransmonCrossHamiltonian(analysis)[source]#
Bases:
QubitHamiltonian
Class representing the Hamiltonian for a transmon qubit in a cross-coupled configuration.
Initialize the TransmonCrossHamiltonian object.
- - analysis
The analysis object associated with the Hamiltonian.
- E01(EJ, EC, ng=0, ncut=30)[source]#
Calculate the energy of the first excited state (E01) of a transmon qubit.
- Parameters:
EJ (-) – Josephson energy of the transmon qubit.
EC (-) – Charging energy of the transmon qubit.
ng (-) – Offset charge on the transmon qubit. Default is 0.
ncut (-) – Truncation level for the transmon qubit’s Hilbert space. Default is 30.
- Returns:
Energy of the first excited state (E01) of the transmon qubit.
- Return type:
E01 (float)
- E01_and_anharmonicity(EJ, EC, ng=0, ncut=30)[source]#
Calculate the energy of the first excited state (E01) and the anharmonicity (alpha) of a transmon qubit.
- Parameters:
EJ (-) – Josephson energy of the transmon qubit.
EC (-) – Charging energy of the transmon qubit.
ng (-) – Offset charge on the transmon qubit. Defaults to 0.
ncut (-) – Truncation level for the transmon qubit’s Hilbert space. Defaults to 30.
- Returns:
Energy of the first excited state (E01) in GHz. - alpha (float): Anharmonicity (alpha) in MHz.
- Return type:
E01 (float)
- EC(cross_to_claw, cross_to_ground)[source]#
Calculate the charging energy (EC) of the transmon qubit.
- Parameters:
cross_to_claw (-) – Capacitance between the cross and the claw.
cross_to_ground (-) – Capacitance between the cross and the ground.
- Returns:
The charging energy of the transmon qubit.
- Return type:
EC
- EJ(w_q, alpha)[source]#
Calculate the Josephson energy (EJ) based on the given qubit frequency (w_q) and anharmonicity (alpha).
- Parameters:
w_q (-) – The qubit frequency.
alpha (-) – The anharmonicity of the qubit.
- Returns:
The Josephson energy of the qubit.
- Return type:
EJ
- EJ_and_LJ(w_q, alpha, *args, **kwargs)[source]#
Calculate the Josephson energy (EJ) and Josephson inductance (Lj) based on the given qubit frequency (w_q) and anharmonicity (alpha).
- Parameters:
w_q (-) – The qubit frequency.
alpha (-) – The anharmonicity of the qubit.
- Returns:
The Josephson energy of the qubit. - Lj: The Josephson inductance of the qubit.
- Return type:
EJ
- add_cavity_coupled_H_params(num_chunks='auto', Z_0=50)[source]#
Add cavity-coupled Hamiltonian parameters to the dataframe.
This method calculates the coupling strength ‘g_MHz’ between the transmon qubit and the cavity, based on the capacitance matrix, transmon parameters, cavity frequency, resonator type, and characteristic impedance.
- Parameters:
num_chunks (-) – The number of chunks to split the DataFrame into for parallel processing. Default is “auto” which sets the number of chunks to the number of logical CPUs.
Z_0 (-) – The characteristic impedance of the transmission line. Default is 50 ohms.
- Returns:
None
- add_cavity_coupled_H_params_chunk(chunk, Z_0=50)[source]#
Add cavity-coupled Hamiltonian parameters to the DataFrame chunk.
This method calculates the coupling strength ‘g_MHz’ between the transmon qubit and the cavity,
- Parameters:
chunk (-) – The DataFrame chunk to which the parameters will be added.
Z_0 (-) – The characteristic impedance of the transmission line. Default is 50 ohms.
- Returns:
The DataFrame chunk with the added parameters.
- Return type:
chunk
- add_qubit_H_params()[source]#
Add qubit Hamiltonian parameters to the DataFrame.
This method calculates and adds the qubit Hamiltonian parameters, such as EC, EJ, and EJEC, to the DataFrame.
- Parameters:
None
- Returns:
None
- add_qubit_H_params_chunk(df)[source]#
Add qubit Hamiltonian parameters to the DataFrame chunk.
This method calculates and adds the qubit Hamiltonian parameters, such as EC, EJ, and EJEC,
- Parameters:
df (-) – The DataFrame chunk to which the parameters will be added.
- Returns:
The DataFrame chunk with the added parameters
- Return type:
df
- calculate_target_quantities(f_res, alpha, g, w_q, res_type, Z_0=50)[source]#
Calculate the target quantities (C_q, C_c, EJ, EC, EJ_EC_ratio) based on the given parameters.
- Parameters:
f_res (-) – The resonator frequency.
alpha (-) – The anharmonicity of the qubit.
g (-) – The coupling strength between the qubit and the resonator.
w_q (-) – The qubit frequency.
res_type (-) – The type of resonator.
Z_0 (-) – The characteristic impedance of the resonator.
- Returns:
The total capacitance of the qubit. - C_c: The coupling capacitance between the qubit and the resonator. - EJ: The Josephson energy of the qubit. - EC: The charging energy of the qubit. - EJ_EC_ratio: The ratio of EJ to EC.
- Return type:
C_q
- chi(EJ, EC, g, f_r)[source]#
Calculate the full cavity frequency shift between |0> and |1> states of a qubit using g, f_r, f_q, and alpha. It uses the result derived using 2nd-order perturbation theory (equation 9 in SQuaDDS paper). :param - EJ: Josephson energy of the transmon qubit. :type - EJ: float :param - EC: Charging energy of the transmon qubit. :type - EC: float :param - g: The coupling strength between the qubit and the cavity. :type - g: float :param - f_r: The resonant frequency of the cavity. :type - f_r: float :param - f_q: The frequency spacing between the first two qubit levels. :type - f_q: float
- Returns:
The full dispersive shift of the cavity
- Return type:
chi (float)
- g_alpha_freq(C, C_c, EJ, f_r, res_type, Z0=50)[source]#
Calculate the coupling strength, anharmonicity, and transition frequency of a transmon qubit.
- Parameters:
C (-) – Total capacitance of the transmon qubit.
C_c (-) – Coupling capacitance between the transmon qubit and the resonator.
EJ (-) – Josephson energy of the transmon qubit.
f_r (-) – Resonator frequency.
res_type (-) – Type of resonator. Must be either ‘half’ or ‘quarter’.
Z0 (-) – Characteristic impedance of the transmission line. Defaults to 50.
- Returns:
A tuple containing the coupling strength (g), anharmonicity (alpha), and transition frequency (freq).
- Return type:
(g, alpha, freq) (tuple)
- g_and_alpha(C, C_c, f_q, EJ, f_r, res_type, Z0=50)[source]#
Calculate the coupling strength (g) and anharmonicity (alpha) based on the given parameters.
- Parameters:
C (-) – The capacitance between the qubit and the ground.
C_c (-) – The coupling capacitance between the qubit and the resonator.
f_q (-) – The qubit frequency.
EJ (-) – The Josephson energy of the qubit.
f_r (-) – The resonator frequency.
res_type (-) – The type of resonator.
Z0 (-) – The characteristic impedance of the resonator.
- Returns:
The coupling strength between the qubit and the resonator. - alpha: The anharmonicity of the qubit.
- Return type:
g
- g_from_cap_matrix(C, C_c, EJ, f_r, res_type, Z0=50)[source]#
Calculate the coupling strength ‘g’ between a transmon qubit and a resonator based on the capacitance matrix.
- Parameters:
C (-) – Capacitance between the qubit and the resonator (in femtofarads, fF).
C_c (-) – Coupling capacitance of the resonator (in femtofarads, fF).
EJ (-) – Josephson energy of the qubit (in GHz).
f_r (-) – Resonator frequency (in GHz).
res_type (-) – Type of resonator. Can be ‘half’ or ‘quarter’.
Z0 (-) – Characteristic impedance of the transmission line (in ohms). Default is 50 ohms.
- Returns:
Coupling strength ‘g’ between the qubit and the resonator (in MHz).
- Return type:
g (float)
- get_freq_alpha_fixed_LJ(fig4_df, LJ_target)[source]#
Calculate the frequencies and anharmonicities of transmons with a fixed LJ value.
- Parameters:
fig4_df (-) – DataFrame containing the values of EC for different transmons.
LJ_target (-) – Target value of LJ in nH.
- Returns:
List of frequencies of the transmons. - alpha: List of anharmonicities of the transmons.
- Return type:
freq
- parallel_process_dataframe(df, num_chunks, Z_0=50)[source]#
Process the DataFrame in parallel.
This method splits the DataFrame into chunks and processes each chunk in parallel.
- Parameters:
df (-) – The DataFrame to be processed.
num_chunks (-) – The number of chunks to split the DataFrame into.
Z_0 (-) – The characteristic impedance of the transmission line. Default is 50
- Returns:
The DataFrame with the added parameters.
- Return type:
df