Quanlse/Calibration/Readout.py
def fitLorentzian(x: ndarray, y: ndarray) -> Union[ndarray, Iterable, int, float]:
    """
    Fit the curve using Lorentzian function.

    :param x: a list of x data.
    :param y: a list of y data.
    :return: the result of curve fitting.
    """

    yMax = max(y)
    yMaxIdx = find_peaks(y, height=yMax)[0][0]
    yHalf = 0.5 * yMax

    yHalfIdx = argmin(abs(y - yHalf))

    freqCenter = x[yMaxIdx]
    width = 2 * (x[yMaxIdx] - x[yHalfIdx])

    param, cov = curve_fit(lorentzian, x, y, p0=[freqCenter, yMax, width, 0.])

    return param, cov

    Fit the curve using Lorentzian function.

    :param x: a list of x data.
    :param y: a list of y data.
    :return: the result of curve fitting.
    
Fit the curve using Lorentzian function.
Fit the curve using Lorentzian function .
def fitLorentzian(x: ndarray, y: ndarray) -> Union[ndarray, Iterable, int, float]:
    yMax = max(y)
    yMaxIdx = find_peaks(y, height=yMax)[0][0]
    yHalf = 0.5 * yMax
    yHalfIdx = argmin(abs(y - yHalf))
    freqCenter = x[yMaxIdx]
    width = 2 * (x[yMaxIdx] - x[yHalfIdx])
    param, cov = curve_fit(lorentzian, x, y, p0=[freqCenter, yMax, width, 0.])
    return param, cov
def fitLorentzian ( x : ndarray , y : ndarray ) -> Union [ ndarray , Iterable , int , float ] : yMax = max ( y ) yMaxIdx = find_peaks ( y , height = yMax ) [ 0 ] [ 0 ] yHalf = 0.5 * yMax yHalfIdx = argmin ( abs ( y - yHalf ) ) freqCenter = x [ yMaxIdx ] width = 2 * ( x [ yMaxIdx ] - x [ yHalfIdx ] ) param , cov = curve_fit ( lorentzian , x , y , p0 = [ freqCenter , yMax , width , 0. ] ) return param , cov
Fit the curve using Lorentzian function.
Fit the curve using Lorentzian function .
"""
    Fit the curve using Lorentzian function.

    :param x: a list of x data.
    :param y: a list of y data.
    :return: the result of curve fitting.
    """
the result of curve fitting.
the result of curve fitting .
x
ndarray
a list of x data.
a list of x data .
y
ndarray
a list of y data.
a list of y data .