Gaussian fits with sddsemitproc

Moderators: cyao, michael_borland

Post Reply
mjhogan
Posts: 4
Joined: 27 Feb 2009, 19:49

Gaussian fits with sddsemitproc

Post by mjhogan » 26 Jan 2011, 20:11

Hello,

I have a beam which has a mostly gaussian distribution but some tails. Although there is <10% of the beam in the tails, the sigmas (Sx, Sy) are correspondingly much larger than the values I get from a gaussian fit. To make a more realistic comparison with how I will actually measure the emittance using a quad scan, is there an intelligent way to use sddsemitproc with values from gaussian fits to a watch file?

I'll likely write something that steps the quad, dumps the watch file, fits the distributions, iterates then write the all the values to some input file 'quadScan.data' that I can feed into sddsemitproc. This just seems so much more complicated than the simple/quick combination of vary_element and sddsprocemit, so I was wondering if anyone else has already scripted this.

Update: I just realized (must have forgotten this) that the watch files generated by vary element have several pages of data (one for each step) so getting the fits should be much easier. I'll have a go and post if I'm successful.

Thanks,

Mark

mjhogan
Posts: 4
Joined: 27 Feb 2009, 19:49

Re: Gaussian fits with sddsemitproc

Post by mjhogan » 27 Jan 2011, 21:07

OK, that was easy enough. I'm sure Michael or some other talented scripter can do this more efficiently by piping the info around instead of writing files, but the following works easy enough and prints out the calculated emittance based on both the r.m.s. and gaussian fit values. It assumes you've run the quad scan (in my case varying quad QFF4) using vary_element. The script take the prefix of the .ele file as the input. In case anyone else is interested:

---
sddscollapse $1.fin $1.col

sddshist $1.out $1.xhis -data=x -bin=100
sddshist $1.out $1.yhis -data=y -bin=100

sddsgfit $1.xhis xhis.gfit -column=x,frequency
sddsgfit $1.yhis yhis.gfit -column=y,frequency

sddscollapse xhis.gfit xhis.col
sddscollapse yhis.gfit yhis.col

sddsprocess xhis.col -define=column,Sigmaxg,"gfitSigma"
sddsprocess yhis.col -define=column,Sigmayg,"gfitSigma"

sddsxref $1.col xhis.col -take=Sigmaxg -noWarning
sddsxref $1.col yhis.col -take=Sigmayg -noWarning

sddsemitproc $1.col rmsemitResults.sdds -nErrorSets=3
sddsprintout rmsemitResults.sdds -param

sddsemitproc $1.col gfitemitResults.sdds -sigmaData=Sigmaxg,Sigmayg -nErrorSets=3
sddsprintout gfitemitResults.sdds -param

sddsplot gfitemitResults.sdds -col=QFF4.K1,xSigmaData -grap=symbol -legend -col=QFF4.K1,xSigmaFit -grap=lin -legend
sddsplot gfitemitResults.sdds -col=QFF4.K1,ySigmaData -grap=symbol -legend -col=QFF4.K1,ySigmaFit -grap=lin -legend

Post Reply