Пример #1
0
def test_paraxial_location():
    # image_location, real_ = paraxial_location(opsys, opaxis):
    lens1 = library.Edmund.get("45179")  # f=200 r= 25
    optical_axis = Ray(pos=(0, 0, -10000), dir=(0, 0, 1), wavelength=0.55)
    ccd = CCD(size=(10, 10))
    s = System(
        complist=[
            (lens1, (0, 0, 100), (0, np.pi, 0)),
            (ccd, (0, 0, 320.053), (0, 0, 0)),
        ],
        n=1,
    )
    PB = parallel_beam_c(
        origin=(0, 0, 50),
        direction=(0, 0, 0),
        size=(15, 15),
        num_rays=(15, 15),
        wavelength=0.55,
    )
    s.ray_add(PB)
    s.propagate()

    image_location, real_ = calc.paraxial_location(s, optical_axis)
    np.testing.assert_almost_equal(image_location, [-5.59109334e-16, 0, 3.07249900e02])
    assert real_ == False
Пример #2
0
def test_find_ppp():
    # find_ppp(opsys, opaxis)
    lens1 = library.Edmund.get("45179")  # f=200 r= 25
    optical_axis = Ray(pos=(0, 0, -10000), dir=(0, 0, 1), wavelength=0.55)
    ccd = CCD(size=(10, 10))
    s = System(
        complist=[
            (lens1, (0, 0, 100), (0, np.pi, 0)),
            (ccd, (0, 0, 320.053), (0, 0, 0)),
        ],
        n=1,
    )
    PB = parallel_beam_c(
        origin=(0, 0, 50),
        direction=(0, 0, 0),
        size=(15, 15),
        num_rays=(15, 15),
        wavelength=0.55,
    )
    s.ray_add(PB)
    s.propagate()

    result = calc.find_ppp(s, optical_axis)
    np.testing.assert_almost_equal(result, [0.0, 0.0, 104.5670357])