1

I have surface data Z over an [X,Y] mesh. In general Z = 0, but there will be peaks which stick up above this flat background, and these peaks will have roughly elliptical cross sections. These are diffraction intensity peaks, if anyone is curious. I would like to measure the elliptical cross section at about half the peak's maximum value.

So typically with diffraction, if it's a peak y = f(x), we want to look at the Full Width at Half Max (FWHM), which can be done by finding the peak's maximum, then intersecting the peak at that value and measuring the width. No problem.

Here I want to perform the analogous operation, but at higher dimension. If the peak had a circular cross section, then I could just do the FWHM = diameter of cross section. However, these peaks are elliptical, so I want to slice the peak at its half max and then fit an ellipse to the cross section. That way I can get the major and minor axes, inclination angle, and goodness of fit, all of which contain relevant information that a simple FWHM number would not provide.

I can hack together a way to do this, but it's slow and messy, so it feels like there must be a better way to do this. So my question really just comes down to, has anyone done this kind of problem before, and if so, are there any modules that I could use to perform the calculation quickly and with a simple, clean code?

halfer
  • 19,824
  • 17
  • 99
  • 186
Richard.B
  • 11
  • 1
  • A couple things I forgot to mention, the Z data over the [X,Y] mesh can be converted to another format if that's required. Also, the way I'm currently doing it is 1) finding the max value over the domain where the peak is expected, 2) going through each meshgrid point and keeping only values which lie within some small interval of the half max, then 3) making an image where the white pixels are those meshgrid points and the background is black, and 4) fitting an ellipse to that. This kinda works but feels super suboptimal. – Richard.B Aug 08 '22 at 16:27
  • You might find better help in https://math.stackexchange.com or by providing your starting code, – Benoît P Aug 08 '22 at 16:27
  • I mean, is it slow? If you can get an answer, and if you can simulate a situation of known parameters and recover the parameters using your solution, then you have at least a starting algorithm. – K.Cl Aug 09 '22 at 00:34
  • Fitting the peak is not an option? Maybe bounding ellipses would do? like [here](https://stackoverflow.com/a/1768440/803359) or [here](https://stackoverflow.com/a/70061311/803359) – mikuszefski Aug 09 '22 at 05:35
  • Interested in your "slow and messy" approach - if you have an existing function, would be good to see it and then the hive mind could think of alternatives/improvements. – J Richard Snape Aug 16 '22 at 11:11

0 Answers0