#NEWLINE# def refine_log_quadratic( x , y , Rval_thresh = None ) : #NEWLINE# #INDENT# '\n    Attempts to refine the peaks by fitting a quadratic to the log of\n    the y-data.  This is a linear approximation of fitting a Gaussian.\n\n    Parameters\n    ----------\n    x : array\n        Independent variable\n\n    y : array\n        Dependent variable\n\n    Rval_thresh : float, optional\n        Threshold for R^2 value of fit,  If the computed R^2 is worse than\n        this threshold PeakRejection will be raised\n\n    Returns\n    -------\n    center : float\n        Refined estimate for center\n\n    height : float\n        Refined estimate for height\n\n    Raises\n    ------\n    PeakRejection\n       Raised to indicate that no suitable peak was found in the\n       interval\n\n    ' #NEWLINE# ( beta , R2 ) = fit_quad_to_peak ( x , np . log ( y ) ) #NEWLINE# if ( ( Rval_thresh is not None ) and ( R2 < Rval_thresh ) ) : #NEWLINE# #INDENT# raise PeakRejection ( ) #NEWLINE# #UNINDENT# return ( beta [ 1 ] , np . exp ( beta [ 2 ] ) )