0

I have an image of a proton beam hitting a scintillator sheet. This image was filtered to a grey-scale 8-bit bmp file. I can use python/matlab to basically get a large list of data points, where each point consist of an (x,y) position and a (z) magnitude.

Beam spot

enter image description here

Zoomed in surface plot enter image description here

I want to model my z data with Gaussians, and then find the "Full Width at Half Max" of the curve. How can I fit multivariate Gaussians to my data? Is there such a package of Matlab/Python or any other way, code etc.?

Honza Zidek
  • 9,204
  • 4
  • 72
  • 118
Mike
  • 5
  • 1
  • 6
  • Hey, Mike. Interesting problem! There will be two values for Full Width at Half Max (FWHM) since we are looking at a two-dimensional Gaussian distribution, correct? – Takeshi H. Oct 09 '15 at 17:44
  • Hey, have you looked at this link [fit](http://www.mathworks.com/help/curvefit/fit.html)? Isn't this exactly what you need? – Бојан Матовски Oct 09 '15 at 17:53
  • @Takeshi H. I think you are correct. – Mike Oct 09 '15 at 19:12
  • @ Бојан Матовски I've never used that before but I will check it out. If you were doing this, what would you use for the "fitType"? Would I need to create my own function? – Mike Oct 10 '15 at 15:49
  • If you do a `ctrl+f` for "Gauss" on that page, you'll find that you can specify your own equation for the fit. So, in your case, you would specify the Gaussian function as the fit equation. Note that you would need to run this tool twice: once for each axis of your image. – Takeshi H. Oct 11 '15 at 00:03

1 Answers1

0

This seems a work perfectly suited for ROOT, and ROOT provides python bindings. https://root.cern.ch/pyroot http://www.rootpy.org/

If you are familiar with ROOT, you just need to create a TH2 histogram and fill with your points, where the intensity of your 8bit color image is the histogram count. Then you define a TF2 formula as a bidimensional gaussian and fit it with the FIT method (minuit algorithm).

some links: https://root.cern.ch/root/html534/guides/users-guide/FittingHistograms.html https://root.cern.ch/root/html/tutorials/fit/fit2.C.html

BiA
  • 364
  • 2
  • 6
  • 23