コード例 #1
0
ファイル: param_sweep.py プロジェクト: seeqc/scqubits
def dispersive_chi_01(sweep, param_index, qubit_subsys=None, osc_subsys=None):
    """
    For a given HilbertSpaceSweep, calculate the dispersive shift difference chi_01 for one value of the
    external parameter.

    Parameters
    ----------
    sweep: ParameterSweep
    param_index: int
    qubit_subsys: QuantumSystem
    osc_subsys: Oscillator

    Returns
    -------
    float
        dispersive shift chi_01
    """
    qubitsys_index = sweep.hilbertspace.get_subsys_index(qubit_subsys)
    oscsys_index = sweep.hilbertspace.get_subsys_index(osc_subsys)
    omega = osc_subsys.omega

    chi_values = np.empty(2, dtype=np.float_)
    # chi_j = E_1j - E_0j - omega
    for j in range(2):
        bare_0j = make_bare_labels(sweep.hilbertspace, qubitsys_index, j, oscsys_index, 0)
        bare_1j = make_bare_labels(sweep.hilbertspace, qubitsys_index, j, oscsys_index, 1)
        energy_0j = sweep.lookup_energy_bare_index(bare_0j, param_index)
        energy_1j = sweep.lookup_energy_bare_index(bare_1j, param_index)

        if energy_0j and energy_1j:
            chi_values[j] = energy_1j - energy_0j - omega
        else:
            chi_values[j] = np.NaN
    return chi_values[1] - chi_values[0]
コード例 #2
0
ファイル: param_sweep.py プロジェクト: seeqc/scqubits
def dispersive_chis(sweep, param_index, qubit_subsys=None, osc_subsys=None):
    """
    For a given HilbertSpaceSweep, calculate dispersive shift data for one value of the external parameter.

    Parameters
    ----------
    sweep: ParameterSweep
    param_index: int
    qubit_subsys: QuantumSystem
    osc_subsys: Oscillator

    Returns
    -------
    ndarray
        dispersive shifts chi_0, chi_1, ...
    """
    qubitsys_index = sweep.hilbertspace.get_subsys_index(qubit_subsys)
    oscsys_index = sweep.hilbertspace.get_subsys_index(osc_subsys)
    qubit_dim = qubit_subsys.truncated_dim
    omega = osc_subsys.omega

    chi_values = np.empty(qubit_dim, dtype=np.float_)
    # chi_j = E_1j - E_0j - omega
    for j in range(qubit_dim):
        bare_0j = make_bare_labels(sweep.hilbertspace, qubitsys_index, j, oscsys_index, 0)
        bare_1j = make_bare_labels(sweep.hilbertspace, qubitsys_index, j, oscsys_index, 1)
        energy_0j = sweep.lookup_energy_bare_index(bare_0j, param_index)
        energy_1j = sweep.lookup_energy_bare_index(bare_1j, param_index)

        if energy_0j and energy_1j:
            chi_values[j] = energy_1j - energy_0j - omega
        else:
            chi_values[j] = np.NaN
    return chi_values
コード例 #3
0
def dispersive_chi(
    sweep: "ParameterSweep",
    param_index: int,
    qubit_subsys: "QubitBaseClass",
    osc_subsys: "Oscillator",
    chi_indices: Tuple[int, int] = None,
) -> Union[float, ndarray]:
    r"""For a given ParameterSweep, calculate dispersive shift data for a single value of the external parameter. The
    dispersive shift relates to a qubit subsystem coupled to an oscillator subsystem. :math:`\chi_j` is the shift of
    qubit level :math:`j` due to the addition of a photon in the oscillator. It is calculated here from the exact
    spectrum by means of :math:`\chi_j = E_{n=1,j} - E_{n=0,j} - \hbar\omega_\text{osc}`.

    Parameters
    ----------
    sweep: ParameterSweep
    param_index:
        index of the parameter value for which chis should be calculated
    qubit_subsys:
    osc_subsys:
    chi_indices:
        If specified, calculate chi_i - chi_j; otherwise return table of all chis in subspace of qubit_subsys

    Returns
    -------
        chi_i - chi_j   or   chi_0, chi_1, ...
    """
    qubitsys_index = sweep.get_subsys_index(qubit_subsys)
    oscsys_index = sweep.get_subsys_index(osc_subsys)
    if isinstance(chi_indices, tuple):
        chi_count = 2
        chi_range: Union[Tuple[int, int], List[int]] = chi_indices
    else:
        chi_count = qubit_subsys.truncated_dim
        chi_range = list(range(chi_count))

    chi_values = np.empty(chi_count, dtype=np.float_)
    omega = osc_subsys.E_osc
    # chi_j = E_1j - E_0j - omega
    for j in chi_range:
        bare_0j = utils.make_bare_labels(
            sweep.subsystem_count, (qubitsys_index, j), (oscsys_index, 0)
        )
        bare_1j = utils.make_bare_labels(
            sweep.subsystem_count, (qubitsys_index, j), (oscsys_index, 1)
        )
        energy_0j = sweep.lookup.energy_bare_index(bare_0j, param_index)
        energy_1j = sweep.lookup.energy_bare_index(bare_1j, param_index)
        if energy_0j and energy_1j:
            chi_values[j] = energy_1j - energy_0j - omega
        else:
            chi_values[j] = np.NaN

    if chi_indices is not None:
        return chi_values[1] - chi_values[0]
    return chi_values
コード例 #4
0
def dispersive_chi(sweep,
                   param_index,
                   qubit_subsys,
                   osc_subsys,
                   chi_indices=None):
    r"""For a given ParameterSweep, calculate dispersive shift data for a single value of the external parameter. The
    dispersive shift relates to a qubit subsystem coupled to an oscillator subsystem. :math:`\chi_j` is the shift of
    qubit level :math:`j` due to the addition of a photon in the oscillator. It is calculated here from the exact
    spectrum by means of :math:`\chi_j = E_{n=1,j} - E_{n=0,j} - \hbar\omega_\text{osc}`.

    Parameters
    ----------
    sweep: ParameterSweep
    param_index: int
        index of the parameter value for which chis should be calculated
    qubit_subsys: QuantumSystem
    osc_subsys: Oscillator
    chi_indices: tuple(int, int), optional
        If specified, calculate chi_i - chi_j; otherwise return table of all chis in subspace of qubit_subsys

    Returns
    -------
    float or ndarray
        chi_i - chi_j   or   chi_0, chi_1, ...
    """
    qubitsys_index = sweep.hilbertspace.get_subsys_index(qubit_subsys)
    oscsys_index = sweep.hilbertspace.get_subsys_index(osc_subsys)
    if chi_indices is not None:
        chi_count = 2
        chi_range = chi_indices
    else:
        chi_count = qubit_subsys.truncated_dim
        chi_range = range(chi_count)

    chi_values = np.empty(chi_count, dtype=np.float_)
    omega = osc_subsys.E_osc
    # chi_j = E_1j - E_0j - omega
    for j in chi_range:
        bare_0j = make_bare_labels(sweep.hilbertspace, (qubitsys_index, j),
                                   (oscsys_index, 0))
        bare_1j = make_bare_labels(sweep.hilbertspace, (qubitsys_index, j),
                                   (oscsys_index, 1))
        energy_0j = sweep.lookup.energy_bare_index(bare_0j, param_index)
        energy_1j = sweep.lookup.energy_bare_index(bare_1j, param_index)
        if energy_0j and energy_1j:
            chi_values[j] = energy_1j - energy_0j - omega
        else:
            chi_values[j] = np.NaN

    if chi_indices is not None:
        return chi_values[1] - chi_values[0]
    return chi_values