Beispiel #1
0
def test_rmsspotsize():
    """
    TODO
    """
    raybundle = RayBundle(x0=np.array([[1, 0, 0, 1, 2],
                                       [0, 1, 0, 1, 2],
                                       [0, 0, 1, 1, 2]]),
                          k0=np.zeros((3, 5)), Efield0=np.zeros((3, 5)))
    rayanalysis = RayBundleAnalysis(raybundle)
    rmssize = rayanalysis.get_rms_spot_size(np.array([0, 0, 0]))
    assert np.isclose(rmssize, math.sqrt(18.0/4.0))
Beispiel #2
0
def test_centroid():
    """
    TODO
    """
    raybundle = RayBundle(x0=np.array([[1, 0, 0, 1, 2],
                                       [0, 1, 0, 1, 2],
                                       [0, 0, 1, 1, 2]]),
                          k0=np.zeros((3, 5)), Efield0=np.zeros((3, 5)))
    rayanalysis = RayBundleAnalysis(raybundle)
    centroid = rayanalysis.get_centroid_position()
    assert np.allclose(centroid, 4./5.)
Beispiel #3
0
def test_direction_centroid():
    """
    TODO
    """
    k0 = np.zeros((3, 5))
    k0[2, :] = 1
    E0 = np.zeros((3, 5))
    E0[1, :] = 1.
    raybundle = RayBundle(x0=np.array([[1, 0, 0, 1, 2],
                                       [0, 1, 0, 1, 2],
                                       [0, 0, 1, 1, 2]]),
                          k0=k0, Efield0=E0)
    rayanalysis = RayBundleAnalysis(raybundle)
    centroiddir = rayanalysis.get_centroid_direction()
    assert np.allclose(centroiddir, np.array([0, 0, 1]))
Beispiel #4
0
def test_rms_angularsize():
    """
    TODO
    """
    k0 = np.zeros((3, 5))
    k0[2, :] = 1
    E0 = np.zeros((3, 5))
    E0[1, :] = 1.
    raybundle = RayBundle(x0=np.array([[1, 0, 0, 1, 2],
                                       [0, 1, 0, 1, 2],
                                       [0, 0, 1, 1, 2]]),
                          k0=k0, Efield0=E0)
    rayanalysis = RayBundleAnalysis(raybundle)
    angularsize = rayanalysis.get_rms_angluar_size(
        np.array([math.sin(1.*math.pi/180.0), 0, math.cos(1.*math.pi/180.0)]))
    assert np.isclose(angularsize, (1.*math.pi/180.0))
Beispiel #5
0
def test_arc_length():
    """
    TODO
    """
    k0 = np.zeros((3, 2))
    E0 = np.zeros((3, 2))
    raybundle = RayBundle(x0=np.array([[0, 0], [0, 0], [0, 0]]),
                          k0=k0, Efield0=E0)
    x1 = np.array([[1, 0], [0, 0], [0, 0]])
    x2 = np.array([[1, 1], [1, 1], [0, 0]])
    x3 = np.array([[0, 2], [1, 2], [0, 0]])
    x4 = np.array([[0, 3], [0, 3], [0, 0]])
    valid = np.ones_like([1, 1])
    raybundle.append(x1, k0, E0, valid)
    raybundle.append(x2, k0, E0, valid)
    raybundle.append(x3, k0, E0, valid)
    raybundle.append(x4, k0, E0, valid)
    arclen = RayBundleAnalysis(raybundle).get_arc_length()
    assert np.allclose(arclen, np.array([4., 3*np.sqrt(2)]))
Beispiel #6
0
        ax.set_facecolor('white')


# glass combinations from recipe:
# SK16 / BK7 / F5
# or
# LAK8 / BK7 / N-F2

# gcat = material_glasscat.GlassCatalog(db_path)
# print gcat.find_pages_with_long_name("BK7")


# Step 1: set up system of glass plates
########################################

rba = RayBundleAnalysis(None)

(s, seq) = build_rotationally_symmetric_optical_system(
        [(0,     0,     10.,    "N-SK16",         "lens1front", {}),
         (0,     0,     5,     None,             "lens1rear", {}),
         (0,     0,     5,     "N-BK7 (SCHOTT)", "elem2front", {}),
         (0,     0,     5,     "F5",             "elem2cement", {}),
         (0,     0,     5,     None,             "elem2rear", {}),
         (0,     0,     5,     None,             "stop", {"stop": True}),
         (0,     0,     5,     "F5",             "elem3front", {}),
         (0,     0,     5,     "N-BK7 (SCHOTT)", "elem3cement", {}),
         (0,     0,     5,     None,             "elem3rear", {}),
         (0,     0,     5,     "N-SK16",         "lens4front", {}),
         (0,     0,     5,     None,             "lens4rear", {}),
         (0,     0,     150.,     None,          "image", {})
         ], material_db_path=db_path, name="os")