Quanlse/Calibration/SingleQubit.py
def fitRamsey(t1: float, popList: list, tList: list, detuning: float) -> [float, list]:
    r"""
    Find T2 from Ramsey's result. This function takes a estimated T1 value, a list of population, a list
    of idling time and the amplitude of the detuning. The fitting function takes form:
    :math:`y = - 0.5 \cdot \cos(a \cdot x) \exp(-b \cdot x) + 0.5`

    :param t1: estimated T1.
    :param popList: a list of population from the Ramsey experiment
    :param tList: a list of idling time from the Ramsey experiment
    :param detuning: detuning amplitude
    :return: estimated t2, a list of population on the fitted curve
    """

    # define fitting function
    def fitRam(x, a, b):
        return - np.cos(a * x) * np.exp(- b * x) * 0.5 + 0.5

    # fit curve and obtain t2
    paraFit, _ = curve_fit(fitRam, tList, popList, [detuning, 0.])
    t2 = 1 / (paraFit[1] - 1 / (2 * t1))
    return t2, list(- np.cos(paraFit[0] * array(tList)) * np.exp(- paraFit[1] * array(tList)) * 0.5 + 0.5)
r"""
    Find T2 from Ramsey's result. This function takes a estimated T1 value, a list of population, a list
    of idling time and the amplitude of the detuning. The fitting function takes form:
    :math:`y = - 0.5 \cdot \cos(a \cdot x) \exp(-b \cdot x) + 0.5`

    :param t1: estimated T1.
    :param popList: a list of population from the Ramsey experiment
    :param tList: a list of idling time from the Ramsey experiment
    :param detuning: detuning amplitude
    :return: estimated t2, a list of population on the fitted curve
    
r"""
Find T2 from Ramsey's result. This function takes a estimated T1 value, a list of population, a list
of idling time and the amplitude of the detuning. The fitting function takes form.
r " " " Find T2 from Ramsey ' s result . This function takes a estimated T1 value a list of population a list of idling time and the amplitude of the detuning . The fitting function takes form .
def fitRamsey(t1: float, popList: list, tList: list, detuning: float) -> [float, list]:
    def fitRam(x, a, b):
        return - np.cos(a * x) * np.exp(- b * x) * 0.5 + 0.5
    paraFit, _ = curve_fit(fitRam, tList, popList, [detuning, 0.])
    t2 = 1 / (paraFit[1] - 1 / (2 * t1))
    return t2, list(- np.cos(paraFit[0] * array(tList)) * np.exp(- paraFit[1] * array(tList)) * 0.5 + 0.5)
def fitRamsey ( t1 : float , popList : list , tList : list , detuning : float ) -> [ float , list ] : def fitRam ( x , a , b ) : return - np . cos ( a * x ) * np . exp ( - b * x ) * 0.5 + 0.5 paraFit , _ = curve_fit ( fitRam , tList , popList , [ detuning , 0. ] ) t2 = 1 / ( paraFit [ 1 ] - 1 / ( 2 * t1 ) ) return t2 , list ( - np . cos ( paraFit [ 0 ] * array ( tList ) ) * np . exp ( - paraFit [ 1 ] * array ( tList ) ) * 0.5 + 0.5 )
r"""
Find T2 from Ramsey's result.
r " " " Find T2 from Ramsey ' s result .
r"""
    Find T2 from Ramsey's result. This function takes a estimated T1 value, a list of population, a list
    of idling time and the amplitude of the detuning. The fitting function takes form:
    :math:`y = - 0.5 \cdot \cos(a \cdot x) \exp(-b \cdot x) + 0.5`

    :param t1: estimated T1.
    :param popList: a list of population from the Ramsey experiment
    :param tList: a list of idling time from the Ramsey experiment
    :param detuning: detuning amplitude
    :return: estimated t2, a list of population on the fitted curve
    """ # define fitting function # fit curve and obtain t2
estimated t2, a list of population on the fitted curve
estimated t2 a list of population on the fitted curve
t1
float
None
popList
list
a list of population from the Ramsey experiment
a list of population from the Ramsey experiment
tList
list
a list of idling time from the Ramsey experiment
a list of idling time from the Ramsey experiment
detuning
float
None
math
`y = - 0.5 \cdot \cos(a \cdot x) \exp(-b \cdot x) + 0.5`
` y = - 0 . 5 \ cdot \ cos ( a \ cdot x ) \ exp ( - b \ cdot x ) + 0 . 5 `