Hi Tom,
Yeah, I know that example is somewhat confusing, and we should probably add another. Or maybe `gaussian2d` needs better documentation: it assumes that x and y will hold the x and y values for every pixel in the image. This then handles the case that it is not a regularly gridded image, or you have already transformed the pixels to some other set of values like diffraction q_x, q_y values or something like that where the pixel indices are not how you want to model the data.
For regularly gridded data (as straight from a camera), using `np.meshgrid` is almost certainly what you want, using something like:
import numpy as np
from lmfit.lineshapes import gaussian2d
import matplotlib.pyplot as plt
nx = 200
ny = 250
x, y = np.meshgrid(np.arange(nx), np.arange(ny))
z = gaussian2d(y, x, amplitude=30, centerx=88, centery=121, sigmax=9.5, sigmay=12.0)
print(x.shape, y.shape, z.shape)
plt.imshow(z)
plt.show()
Hope that gets you going down the right path….
--Matt
Tom
--
You received this message because you are subscribed to the Google Groups "lmfit-py" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
lmfit-py+u...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/lmfit-py/a69b6cc8-e9b0-4aab-8c85-301f6b7578a9n%40googlegroups.com.