Set the Derivatives with Respect to C to Zero to Find

Total Page:16

File Type:pdf, Size:1020Kb

Set the Derivatives with Respect to C to Zero to Find

Introduction This document considers a convolution method of peak fitting followed by a convolution method of data smoothing #Smoothing. Peak fitting Peak fitting

I have data d(t) to which a peak c h(t;t0,w) is to be fitted by minimizing

2 2 c � (d( t) ch( t; t0 , w)) dt - Set the derivatives with respect to c to zero to find c 2 =0 = 2(d( t) - ch( t ; t0 , w)) h( t ; t 0 , w) dt c - Or ゥ 2 c蝌 h( t; t0 , w) dt= d( t) h( t ; t 0 , w) dt -� With no restrictions on h, the right side of is [Convolution Prime.doc] dh ( t0) = dfD( f) H( - f; t 0 , w) exp( - j 2p ft 0 ) -

There is potentially a different c for each value of t0. The values of c as a function of x0 for transformable functions are given by

D( f) H(- f; t0 , w) exp( - j 2p ft 0 ) - c( t0 ) = 2 h( t; t0 , w) dt - Gaussian form The transform of h is needed In the event that h(t) is a Gaussian the following is from D:\public_html\class2K\Fourier\Fast Fourier Transform.htm http://www.phys.ufl.edu/~coldwell/class2K/Fourier http://www.phys.ufl.edu/~coldwell/class2K/Fourier/Fast%20Fourier%20Transform.htm Begin with 2 骣 骣t- t h( t) =exp琪 -琪 0 琪 w 桫 桫 0 2 骣 骣t- t H( f) = dtexp琪 -琪 0 exp( j 2p ft) 琪 w - 桫 桫 0 Complete the square in the integral 骣-1 2 2 2 H( f) = dtexp琪 2 ( t - 2 t0 t + t 0 - j 2p w 0 ft ) - 桫w0 骣-1 =dtexp t2 - 2 t jp w 2 f + t + t 2 琪 2 ( ( 0 0) 0 ) - 桫w0

骣-1 2 2 =dtexp琪 轾 t - jp w2 f + t + t 2 - j p w 2 f + t 2 (臌 ( 0 0) 0( 0 0 ) ) - 桫w0 2 4 2 2 2 骣 pw0 f- 2 j p w 0 ft 0 骣1 2 =exp琪 -dt exp 轾 t - jp w f + t 2琪 2 (臌 ( 0 0 ) ) 桫 w0 - 桫 w

2 2 2 2 = exp(-pw f + 2 j p ft0 ) w dt exp( t ) - 2 2 2 =w0pexp( - p w 0 f) exp( 2 j p ft 0 ) To reverse this Begin with 2 2 2 H( f) = w0pexp( - p w 0 f) exp( 2 j p ft 0 )

h t w dfexp w f2 j 2 f t t ( ) =0p( -( p 0) - p ( - 0 )) - Complete the square in the integral 2 2 骣 骣(t- t) 骣( t - t ) h( t) = wp dfexp琪 -琪 p w f + j 0 - 琪 0 0琪 0 w w - 桫 桫0 桫 0

let f’ = w0f+j(t-t0)/w 2 1 骣 骣(t- t ) h( t) =exp琪 -琪 0 df exp( - f 2 ) 琪 w p 桫 桫 0 - Evaluate the integral to find 2 骣 骣(t- t ) h( t) =exp琪 -琪 0 琪 w 桫 桫 0 There is no frequency in h. This is due to the fact that H peaks at f = 0.

A trial d(t) Suppose 2 骣 骣t- t d( t) = a exp琪 -琪 1 琪 w 桫 桫 1 Then 2 2 2 D( f) = w1pexp( - p w 1 f) exp( 2 j p ft 1 ) And 2 2 2 2 DH ( f) � D( f) H(= f) - w1 w 0pexp( + p( w 1 - w 0) f) exp( 2 j p f( t 1 t 0 )) define 2 2 weff � w0 w 1 teff � t1 t 0

2 d t= w wp dfexp - p w f - j 2 p f t - t h( ) 0 1 ( ( eff) ( eff )) - Complete the square in the integral 2 2 骣 骣t- t 骣 t - t 琪 琪( eff) 琪( eff ) dh( t) = w0 w 1p dfexp - p w eff f + j - 琪 琪w 琪 w - 桫 桫eff 桫 eff

(t- teff ) f� p weff f j weff 骣 2 w w 骣(t- teff ) 0 1 琪 琪 2 dh ( t) =exp - df exp( - f ) w琪 琪 w eff桫 桫 eff - 骣 2 w w p 骣(t- teff ) 0 1 琪 琪 dh ( t) =exp - w琪 琪 w eff桫 桫 eff

The integral of h2(t) is 2 骣 骣t- t 琪 ( 0 ) I2 =exp -琪 dt h 琪 琪w / 2 - 桫 桫 0 (t- t ) let x = 0 w0 / 2 w p I=0 exp - x2 dt = w h2 ( ) 0 2 - 2 So that becomes 骣 2 w 2 骣(t- teff ) c( t) =1 exp琪 -琪 w琪 琪 w eff桫 桫 eff

For w0 = w1 weff = 2 w0 and this is 1 for c(t1). As a function of t, this is a Gaussian with a wider width than h, weff verses w0. If there are peaks in d(t) at t1, t2, and so on, this will peak up at each of these. In this rather simple form c is a maximum at t = 0 if teff = 0, implying that t1 = t0. This is also a maximum for any t such that t = tpeak+t0. This provides a method for adjusting t0 in the assumed form to get a better fit. Suppose w is a slowly varying function of t

In this case h(t;t0,w) will have a transform of the form H f; t , w t w t exp2 w t2 f 2 exp 2 j ft ( 0( 0)) =( 0) p( - p( 0) ) ( p 0 ) Leading to 骣 2 w t w 2 骣 t- t - t ( 0) 1 琪 琪( ( 1 0 )) c( t) =exp琪 - w2 t+ w 2琪 琪 w 2 t + w 2 ( 0) 1桫 桫 ( 0) 1

The location of the peak is defined by t0. The actual location is t1.

If w were independent of t, t0 could be taken to be zero and the plot of c would be a smoothed widened plot of d(t). Chi-square again

For a single peak at t0. 2 2 c � (d( t) - c( t0) h( t t 0; w( t 0 ))) dt -

The width w(t0) is found by setting the partial with respect to w to zero 2 c �h( t t0 ; w) = -2(d( t) - c( t0) h( t - t 0 ; w)) dt 抖w- w ゥ �h( t � t; w) h( t t ; w) 0=d( t) 0 dt - c( t) h( t - t ; w) 0 dt 蝌 抖 0 0 -� w w As a practical matter this is simply minimization of the RobFit form. Smoothing 2 骣d( t) - c( t ) c 2 0 h t; t , w dt 琪 ( 0 ) - 桫 e (t) Note the subtle difference between and . In this section the data is fitted to a constant weighted by the Gaussian, rather than to a Gaussian itself. 2 c (d( t) - c( t0 )) � 22 h( t ; t0 , w) dt c( t0 ) - e (t)

ゥ h( t; t , w) h( t ; t , w) c t0 dt= d t 0 dt ( 0 ) 蝌 2( ) 2 -� e(t) e ( t) For a constant error term of 1, the numerator in is the same as that in , but the denominator is different. In the sample case #A trial d(t) where d is a Gaussian of width w1 and h is a Gaussian of width w0, the only change is the removal of the 2 resulting from integrating h rather than h2. Thus equation becomes 骣 2 w 骣(t- teff ) c( t) =1 exp琪 -琪 w琪 琪 w eff桫 桫 eff

Using t0 = 0 and a large w0 relative to w1 2 骣 骣 骣 2 w1琪 (t- t1) w 1 骣( t - t 1 ) c( t) =exp -琪 ∐ exp琪 -琪 2 2琪 琪 2 2 琪 w+ w琪 w + w w0桫 w 0 1 0桫 桫 1 0 桫 The total area introduced into c is 2 ゥ w 骣 骣(t- t ) A= c( t) dt =1 exp琪 -琪 1 dt = w p 蝌 w琪 w 1 -� 0桫 桫 0

This is also the area of the peak at t1. Suppose d(t) is a delta function at t1. Then ゥ c( t0) 蝌 h( t; t 0 , w) dt=d ( t - t 1) h( t ; t 0 , w) dt = h( t 1 ; t 0 , w) -�

h( t1; t 0 , w) c( t0 ) =

h( t; t0 , w) dt -

Equation for an h symmetric in t and t0 does indeed integrate to 1.

The extra area in c(t) in the above picture is equal to the area in the peak in the data at t1. The error term The function (t) was used by RobFit to eliminate peaks from the background. The points inside the fwhm of the peak at t1 will be much further from c(t) than their normal (t) would allow. IF(NVC.GT.0)CALL POLY(XDP,P,NVC,CONS,FDP) -- equivalent to knowing c(t) – NVC > 0 means that this is beyond the first pass. 2 Y=(F(I)-FDP)**2*WX(I) -- ((d(t)-c(t))/ (t)) ALPFP1=1+ALP*Y WT=ALPFP1*A C *** NOTE THAT WX IS 1/ER**2 IN THE ORIGINAL DATA IF(F(I).GT.FDP.OR.BKGF(1:1).EQ.'A')WT=B/ALPFP1 C *** FOLLOWING LINE IS FOR PUSHING THE BKG UP INTO THE COMPTON EDGE C IF(F(I).GT.FDP.AND.Y.LT.25D0)WT=1 C *** FOLLOWING LINE IS TO GET BKG TO BEGIN WITH THE DATA IF(I.LT.NBEGCH)WT=1 WX(I)=WX(I)*WT The weight is decreased or the error increased by a constant times the number of standard deviations d(t) is away from the data.

Standard deviation in C h t; t , w -1 ( 0 ) The single element error matrix is Acc = 1/ 2 dt . The value of chi- - e (t) square is defined by . This should equal the number of data points, thus the error in c(t0) is 骣 Max琪1,c 2 / h( t) dt 桫 - s 2 = C( t0 ) h( t; t0 , w) 2 dt - e (t) This may be needed to decide how to change (t) – note that in the RobFit method the error in poly was not used. It can be useful for increasing and decreasing the number of points in the background. FFT’s The transform of h for a Gaussian is analytical. The transform of 1/ e 2 (t) can be made by the FFT going between –T and T where T is ~ twice the largest data point. The –T values are all unknown so 1/ e 2 (t) = 0 This transform is nearly equal to the continuous transform, but has convergence problems, for example a constant 1/(t) results in a transform given by 1 T / 2 (exp( jp fT ) - 1) E( f) =exp( j 2p ft) dt = d0 e0 j2 p f The slow convergence is not a real problem owing to the fact that this is multiplied by the exponentially decaying h before the back transform is made. A peak cluster

When the weighted fit encounters a peak cluster, the points in the middle will be all error. This indicates an advantage to “fitting” the data since the data fit utilizes the accurate values to the right and left of the cluster and ignores the high error points in the middle, while the convolution method for the middle points sees only the high error values.

The current macbkg code The code in macbkg uses poly to interpolate the fit for every point before modifying the weights.

Recommended publications