예제 #1
0
def get_statistics(X, y):
    """
    ================
    INPUT: array of X data (temperature), array of Y data (heat flow), int
    OUTPUT: float, float, float, float, tuple
    ================

    Returns four key release characteristics:
    1. Enthalpy
    2. Peak heat flow
    3. Temperature at peak
    4. Rough standard deviation of peak
    5. Onset and end points

    """

    peak_X, peak_y = pdetect.get_peak_X_y(X, y)

    enthalpy = get_enthalpy(X, y)

    peak_heat_flow = np.min(peak_y) # find the minimum y

    peak_temp = peak_X[np.argmin(peak_y)] # find the x for which y is minimized

    heat_flow_std = np.std(peak_y)

    onset, end = pdetect.get_points_coordinates(X, y)

    return enthalpy, peak_heat_flow, peak_temp, heat_flow_std, (onset, end)
예제 #2
0
def fit_line(X, y):
    """
    ================
    INPUT: array of X data (temperature), array of Y data (heat flow)
    OUTPUT: array of X data (temperature), array of Y data (best-fit-line heat
    flow)
    ================

    Returns two arrays, of the x's and y's of the best-fit-line.

    """
    peak_X, peak_y = pdetect.get_peak_X_y(X, y)
    onset_point, end_point = pdetect.get_points(X, y)
    (x_0, y_0), (x_1, y_1) = pdetect.get_points_coordinates(X, y)

    line_X, line_y = construct_line(x_0,
                                    y_0,
                                    x_1,
                                    y_1,
                                    peak_X
                                   )
    return line_X, line_y
예제 #3
0
def get_enthalpy(X, y):
    """
    ================
    INPUT: array of X data (temperature), array of Y data (heat flow)
    OUTPUT: float
    ================

    Returns the enthalpy of the reaction.

    In order, this function:
    1. Gets the interval of the peak
    2. Fits a line between its end points
    3. Takes the difference between the line and the peak
    4. Finds the integral of the difference

    """
    peak_X, peak_y = pdetect.get_peak_X_y(X, y)
    onset_point, end_point = pdetect.get_points(X, y)

    line_X, line_y = fit_line(X, y)
    differences = line_y - peak_y

    return simps(differences, x = peak_X)