Skip to content

units

Units handling.

Ec_to_inv_pF(Ec)

GHz -> 1/picoFarad

Source code in jaxquantum/utils/units.py
81
82
83
84
85
86
87
88
def Ec_to_inv_pF(Ec):
    """
    GHz -> 1/picoFarad
    """
    joule = GHz_to_joule(Ec)
    Gjoule = joule / 1e9
    inv_nFarad = Gjoule / ((constants.e) ** 2 / (2))
    return inv_nFarad * 1e-3

inductance_to_inductive_energy(L)

Convert inductance to inductive energy E_L.

Parameters:

Name Type Description Default
L float

Inductance in nH.

required

Returns:

Name Type Description
float

Inductive energy in GHz.

Source code in jaxquantum/utils/units.py
57
58
59
60
61
62
63
64
65
66
67
68
69
def inductance_to_inductive_energy(L):
    """Convert inductance to inductive energy E_L.

    Args:
        L (float): Inductance in nH.

    Returns:
        float: Inductive energy in GHz.
    """

    inv_L = 1e9 / L
    El_joules = inv_L * (FLUX_QUANTUM**2) / (2 * np.pi) ** 2
    return joule_to_GHz(El_joules)

inductive_energy_to_inductance(El)

Convert inductive energy E_L to inductance.

Parameters:

Name Type Description Default
El float

inductive energy in GHz.

required

Returns:

Name Type Description
float

Inductance in nH.

Source code in jaxquantum/utils/units.py
44
45
46
47
48
49
50
51
52
53
54
55
def inductive_energy_to_inductance(El):
    """Convert inductive energy E_L to inductance.

    Args:
        El (float): inductive energy in GHz.

    Returns:
        float: Inductance in nH.
    """

    inv_L = GHz_to_joule(El) * (2 * np.pi) ** 2 / (FLUX_QUANTUM**2)
    return 1e9 / inv_L

inv_pF_to_Ec(inv_pfarad)

1/picoFarad -> GHz

Source code in jaxquantum/utils/units.py
72
73
74
75
76
77
78
def inv_pF_to_Ec(inv_pfarad):
    """
    1/picoFarad -> GHz
    """
    inv_nFarad = inv_pfarad * 1e3
    Gjoule = (constants.e) ** 2 / (2) * inv_nFarad
    return joule_to_GHz(Gjoule * 1e9)

n_thermal(frequency, temperature)

Calculate the average thermal photon number for a given frequency and temperature.

Parameters:

Name Type Description Default
frequency float

Frequency in GHz.

required
temperature float

Temperature in Kelvin.

required

Returns:

Name Type Description
float float

Average thermal photon number.

Source code in jaxquantum/utils/units.py
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
def n_thermal(frequency: float, temperature: float) -> float:
    """Calculate the average thermal photon number for a given frequency and temperature.

    Args:
        frequency (float): Frequency in GHz.
        temperature (float): Temperature in Kelvin.

    Returns:
        float: Average thermal photon number.
    """
    k_B = constants.k  # Boltzmann constant in J/K
    h = constants.h  # Planck constant in J·s

    exponent = h * (frequency * 1e9) / (k_B * temperature)
    n_avg = 1 / (np.exp(exponent) - 1)
    return n_avg