#pragma rtGlobals=3 // Use modern global access method and strict wave access. Function/S DoubleSFG_PeakFuncInfo(InfoDesired) Variable InfoDesired String info="" Switch (InfoDEsired) case PeakFuncInfo_ParamNames: info = "w;w1;w2;A1;A2;G1;G2" // w = wavenumber or "x", w1 = peak center, A1 = peak's amplitude, break; //G1 = the peak's phase. 2 refres to the second peak. case PeakFuncInfo_PeakFName: info = "DoubleSFG_Peak" break; case PeakFuncInfo_GaussConvFName: info = "SimpleLorentzianGuess" break; case PeakFuncInfo_ParameterFunc: info = "DoubleSFG_PeakParams" break; case PeakFuncInfo_DerivedParamNames: info = "Location;Height;Area;FWHM;Wavenumber;Amplitude;Phase" break; default: break; endSwitch return info end Function SimpleLorentzianGuess(w) //Initial guess? Wave w Redimension/N=3 w // width of Lorenzian needs to be modified from the estimated Gaussian width w[2] = w[1]*w[2]*sqrt(pi) return 0 end Function DoubleSFG_Peak(w, yw, xw, A1, A2, G1, G2, w1, w2) // w = wavenumber or "x", w1 = peak center, A1 = peak's amplitude, //G1 = the peak's phase. Wave w Wave yw, xw, A1, A2, G1, G2, w1, w2 Variable/C sqrtJ = cmplx(0,1) yw = ((abs(A1/((xw-w1)+G1*sqrtJ) + A2/(x-w2)+G2*sqrtJ)))^2 end Function DoubleSFG_PeakParams(wW, wA, wP, outWave) //wW=Wavenuber, wA=Amplitude, wP=Phase initial guesses. Wave wW, wA, wP, outWave //Location outWave[0][0] = wW[0] outWave[0][1] = NaN Variable amp = wA[2] //Amplitude outWave[1][0] = amp outWave[1][1] = NaN //Phase outWave[2][0] = wP[2] outWave[2][1] = NaN end