Пример #1
0
from led_object import ledObject
import matplotlib.pyplot as plt
import numpy as np
import math

if __name__ == "__main__":
    sample_size = 1000000
    distance = [1.27, 2.54, 3.5, 5.08]
    pinh_rad = 0.15
    light_theta = 7.5
    diff_theta = 7.5
    phcount = np.zeros((4, 4))
    phlog = np.zeros((4, 4))

    led = ledObject(sample_size)
    for i in range(0, 4):
        led.calcLEDRotationMatrixes(distance[i])
        led.simDiffusorEffect(light_theta, diff_theta)
        for k in range(0, 4):
            phcount[i, k], cap_angle = led.simPinholeEffect(
                distance[k], pinh_rad)
            phlog[i, k] = math.log(phcount[i, k])
            print(
                "{}cm LED-diff | {}cm diff-pinhole __ # photons {}/{}".format(
                    distance[i], distance[k], phcount[i, k], sample_size))

    fig1 = plt.figure(1)
    plt.plot(distance, phcount[0, :], label='0.5in LED-diffuser')
    plt.plot(distance, phcount[1, :], label='1in LED-diffuser')
    plt.plot(distance, phcount[2, :], label='1.5in LED-diffuser')
    plt.plot(distance, phcount[3, :], label='2in LED-diffuser')
Пример #2
0
from led_object import ledObject
import matplotlib.pyplot as plt

if __name__ == "__main__":
    sample_size = 1000000
    distance_to_diffusorCenter = [1.27, 2.54, 3.5, 5.08]
    dist_to_pinh = 1.27
    pinh_rad = 0.15
    light_theta = 7.5
    diff_theta = 7.5

    led2Inch = ledObject(sample_size)
    led2Inch.calcLEDRotationMatrixes(distance_to_diffusorCenter[3])
    led2Inch.simDiffusorEffect(light_theta, diff_theta)
    # phcount, cap_angle = led2Inch.simPinholeEffect(1.27, pinh_rad)
    # print("2inch from diffusor, half inch from pinhole - Got {}/{} through pinhole!".format(phcount, sample_size))

    fig1 = plt.figure(1)
    #n2, bins2, patches2 = plt.hist(cap_angle, 100, density=True, color='b', histtype='step',label='2in LED-diffuser, 0.5in diffuser-pinhole')
    #n, bins, patches = plt.hist(ledHalfInch.diff_polar_angle, 100, density=True, facecolor='g', label='0.5 inch from LED to diffusor')

    phcount, cap_angle2 = led2Inch.simPinholeEffect(2.54, pinh_rad)
    capx1 = led2Inch.cap_ph_xpos
    capz1 = led2Inch.cap_ph_zpos
    print(
        "2inch from diffusor, 1 inch from pinhole - Got {}/{} through pinhole!"
        .format(phcount, sample_size))
    n2, bins2, patches2 = plt.hist(
        cap_angle2,
        100,
        density=True,
Пример #3
0
from led_object import ledObject
import matplotlib.pyplot as plt

if __name__ == "__main__":
    sample_size = 1000000
    distance_to_diffusorCenter = [1.27, 2.54, 3.5, 5.08]
    light_theta = 7.5
    diff_theta = 7.5

    ledHalfInch = ledObject(sample_size)
    ledHalfInch.calcLEDRotationMatrixes(distance_to_diffusorCenter[0])
    ledHalfInch.simDiffusorEffect(light_theta, diff_theta)

    led1Inch = ledObject(sample_size)
    led1Inch.calcLEDRotationMatrixes(distance_to_diffusorCenter[1])
    led1Inch.simDiffusorEffect(light_theta, diff_theta)

    led1halfInch = ledObject(sample_size)
    led1halfInch.calcLEDRotationMatrixes(distance_to_diffusorCenter[2])
    led1halfInch.simDiffusorEffect(light_theta, diff_theta)

    led2Inch = ledObject(sample_size)
    led2Inch.calcLEDRotationMatrixes(distance_to_diffusorCenter[3])
    led2Inch.simDiffusorEffect(light_theta, diff_theta)

    fig1 = plt.figure(1)
    n, bins, patches = plt.hist(ledHalfInch.diff_polar_angle,
                                100,
                                density=True,
                                facecolor='g',
                                histtype='step',
Пример #4
0
from led_object import ledObject
import matplotlib.pyplot as plt

if __name__ == "__main__":
    sample_size = 10000
    distance_to_diffusorCenter = [1.27, 2.54, 3.5, 5.08]
    light_theta = 7.5
    diff_theta = 7.5
    led_z_pos = 0.66

    led2Inch = ledObject(sample_size, 0.66)
    led2Inch.calcLEDRotationMatrixes(distance_to_diffusorCenter[1])
    led2Inch.simDiffusorEffect(light_theta, diff_theta)

    print(led2Inch.auxrri[3, :])
    fig1 = plt.figure(1)
    #plt.scatter(led2Inch.rf[:,0], led2Inch.rf[:,2], label="after diffuser")
    plt.scatter(led2Inch.rri[:, 0], led2Inch.rri[:, 2], label="at diffuser")
    plt.scatter(led2Inch.ri[:, 0], led2Inch.ri[:, 2], label="start")
    plt.scatter(led2Inch.auxrri[:, 0],
                led2Inch.auxrri[:, 2],
                label="led positioned")
    # n2, bins2, patches2 = plt.hist(led2Inch.diff_polar_angle, 100, density=True, facecolor='r', histtype='step', label="2 inch from LED to diffusor")
    plt.legend()
    # #plt.title("Final polar angle distribution")
    # plt.xlabel('degrees')
    # plt.ylabel('rel # photons')
    #
    plt.show()

    #led2Inch.plotPhotonVectors()