#!/usr/bin/python # # Graph the light intensity from a two dimensional array of isotropic # LEDs in a plane parallel to the two dimensional array of LEDs: # # ./isotropic.array.py > output # # To plot using gnuplot(1): # # set title "Relative Light Intensity, (to one isotropic LED)" # set xlabel "X, LED #" # set ylabel "Y, LED #" # set zlabel "Light Intensity" rotate by 90 # set grid x # set grid y # set grid z # show grid # splot [x=0:15][y=0:10][z=0:150] "output" using 1:2:3 with lines # # To find the intensity of light in the center: # # cut -f3 output | sort -n | tail -1 # # For an isotropic light source a perpendicular distance, d, from a # point, p, in a plane, the light intensity measured at a distance, l, # from p in the plane would be proportional to the hypotenuse, h, # squared, i.e.: # # h^2 = d^2 + l^2 # I is proportional to 1 / h^2 # I is proportional to 1 / (d^2 + l^2), by substitution # # If l = 0, (i.e., the reference value directly under the # isotropic light source): # # I(0) = 1 / d^2 # I(l) / I(0) = (1 / (d^2 + l^2)) / (1 / d^2) # = d^2 / (d^2 + l^2) # = 1 / (1 + (l^2 / d^2)) # # Note that this value is the RELATIVE intensity of light at a # distance l from the perpendicular under the light source in the # plane, (i.e., relative to directly under the isotropic light # source.) If l = 0, this value is unity. # # So, the value of the intensity of an isotropic light source, at a # perpendicular distance, d, from a plane decreases at 1 / d^2. The # RELATIVE intensity of light at a distance l in the plane to that # value is 1 / (1 + (l^2 / d^2)), which is useful for calculating the # variation in the intensity of light projected on the plane from an # array of identical isotropic light sources. # # x = number of LEDs on the x axis of the two dimensional array. # # y = number of LEDs on the y axis of the two dimensional array. # # d = distance between LED array and parallel plane, inches. # # s = distance between LEDs, inches, (60 LEDs per meter for SMD 5050, # which are approximated as an isotropic radiator.) # import math # x = 15 y = 10 d = 5.0 s = 39.37 / 60.0 # for i in range (x): for j in range (y): sum = 0 for ii in range (x): for jj in range (y): sum = sum + 1.0 / (1.0 + ((s * math.sqrt ((ii - i) ** 2 + (jj - j) ** 2)) / d) ** 2) print ("%d\t%d\t%f" % (i, j, sum)) print ("")