replace data path in Fit
wolf1988
i m almost done with writnig my first own larger procedure. In one Function there is still samething, which doesnt work how it should:
Function fitSpotX() // find and return x-component of maximum
// read cursor positions
Variable Ax=xcsr(A)
Variable Ay=vcsr(A)
Variable Bx=xcsr(B)
Variable By=vcsr(B)
//Fit area between cursors
CurveFit/Q Gauss2D, :rawData:ONEOUTOFAHUNDRET [Ax,Bx][Ay,By] /D
Print "Maximum is at x0=" , K2,"y0=",K4
//return x-coordinate of maximum
return K2
End
// read cursor positions
Variable Ax=xcsr(A)
Variable Ay=vcsr(A)
Variable Bx=xcsr(B)
Variable By=vcsr(B)
//Fit area between cursors
CurveFit/Q Gauss2D, :rawData:ONEOUTOFAHUNDRET [Ax,Bx][Ay,By] /D
Print "Maximum is at x0=" , K2,"y0=",K4
//return x-coordinate of maximum
return K2
End
So the data path needs to be generalized. It shall be always the uppermost Graph, so i tried a little with WinName(0,1)
Till now i couldnt find a solution, can anybody help?
Thanks!
If cursor A is assumed to be on the source wave for the fit in the top graph:
If the wave to be fit is assumed to be the first wave in the top graph:
Then use waveToFit as the source wave in your CurveFit command.
August 7, 2014 at 10:02 pm - Permalink
works perfectly like this:
// read cursor positions
Variable Ax=xcsr(A)
Variable Ay=vcsr(A)
Variable Bx=xcsr(B)
Variable By=vcsr(B)
//Fit area between cursors
Wave waveToFit = CsrWaveRef(A) //Fit will be from graph with cursor
CurveFit/Q Gauss2D waveToFit [Ax,Bx][Ay,By]
Print "The center of this spot is at X=" , K2,"Y=",K4
//return x-coordinate of maximum
return K2
End
August 8, 2014 at 12:13 am - Permalink