Fitting peak in two-dimensional domain

I have some diffraction data from single crystal samples on Engin-X. The data naturally consist of spots centred around certain wavelength values, and around certain 2-theta diffraction angles. I can easily fit the position and width of the spot by converting to d-spacing, summing, and using an ordinary gaussian fit with the fitting tool, just like I would do for powder data. However, as well as the change in d-spacing, I’m also interested in recovering the diffraction angle (and spread of angles for a wide peak) from each measured run, which I guess means having a function that varies both with d-spacing and with spectrum number within the run.

Is there a general method to do fitting of this kind of data? I see several references to this kind of problem in the Mantid documentation, but only for other techniques like inelastic neutron and muons. I suspect there is more than one way to tackle this problem, but what would be the ‘best’ official way? Should I be looking at how multiple-dimensional event workspaces work? Any advice gratefully received.

Thanks, Joe

I think what you’ve hit on is something which we don’t have an official method of tackling.

@RichardWaiteSTFC had a few quick suggestions:

  1. Export the data in the Workspace2D to an array and use e.g. lmfit - there isn’t a nice instrument agnostic way of doing this, and you would have to also extract tth and phi angles and keep track of them
  2. Transform to Q and make a cut Q perpendicular to Qhkl in the scattering plane though a straight line in Q is an approximation to the curved trajectory of tth scan in Q-space. Also getting the right Q perpendicular might be a bit trickier when the peak is out of the scattering plane.

I will see if any other devs have an idea of how close our code comes to this use case.

We do have a BivariateGaussian fitting function, from what I understand you want x to be d spacing and y to be the angle.