Example #1
0
    def test_ideal_lens_with_trace_optical_element(self):
        print(
            ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>  test_ideal_lens_with_trace_optical_element"
        )

        beam = Beam()
        beam.set_flat_divergence(0.05, 0.005)

        p = 1.
        q = 5.

        lens = Optical_element.initialiaze_as_ideal_lens(p, q)
        beam = lens.trace_optical_element(beam)

        beam.plot_xz()
        if do_plot:
            plt.show()

        assert_almost_equal(np.abs(beam.x).mean(), 0.0, 4)
        assert_almost_equal(np.abs(beam.z).mean(), 0.0, 4)
Example #2
0
    def test_ideal_lens_collimated_beam(self):
        print(
            ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>  test_ideal_lens_collimated_beam"
        )

        beam = Beam()
        beam.set_circular_spot(20 * 1e-9)
        beam.set_divergences_collimated()
        beam.plot_xz()

        p = 1.
        q = 5.

        lens = Optical_element.initialiaze_as_ideal_lens(p, q, q, q)
        beam = lens.trace_optical_element(beam)

        beam.plot_xz()
        if do_plot:
            plt.show()

        assert_almost_equal(np.abs(beam.x).mean(), 0.0, 4)
        assert_almost_equal(np.abs(beam.z).mean(), 0.0, 4)
Example #3
0
        oe0.write("start.00")

    beam.genSource(oe0)

    if iwrite:
        oe0.write("end.00")
        beam.write("begin.dat")
    return beam


if main == "__ideal_lenses__":

    beam = beam()

    ideal_lens_1 = Optical_element.initialiaze_as_ideal_lens(p=0.4,
                                                             q=0.3,
                                                             fx=0.4,
                                                             fz=0.4)
    ideal_lens_2_04 = Optical_element.initialiaze_as_ideal_lens(p=0.3,
                                                                q=0.4,
                                                                fx=0.4,
                                                                fz=0.4)
    ideal_lens_2_1471 = Optical_element.initialiaze_as_ideal_lens(p=0.3,
                                                                  q=1.471,
                                                                  fx=1.471,
                                                                  fz=1.471)

    beam = ideal_lens_1.trace_optical_element(beam)

    beam_04 = beam.duplicate()
    beam_1471 = beam.duplicate()