I have the resulting interference field (the intensity at each point in the field is known) from several radiation sources. How can I find the wavelengths of the sources? The coordinates of the sources are also known. The wavelength can be from 1 to 256. The field size is 256 by 256.
The full code can be found here.
x = [(i % width) + separation / 2 for i in range(width ** 2)]
r = [0. for _ in range(width ** 2)]
for i in range(width):
for j in range(width):
r[j * width + i] = \
sqrt((i - x[j * width + i]) ** 2 + (j - x[j * width + i]) ** 2)
...
for chunk in range(len(values)):
img = Image.new(mode="L", size=(width, width), color=255)
xi = empty([width, width], float)
for i in range(width):
for j in range(width):
wavelength = values[chunk][i][j] + 1
k = 2 * pi / wavelength
xi[i, j] = sum(list(map(lambda z: xi0 * sin(k * z), r)))
img.putpixel((i, j), value=int(xi[i, j]))
print(i * width + j)