Esempio n. 1
0
def example_wolter3():
    print(
        ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>   example_wolter3"
    )

    p = 50.
    beam1 = Beam.initialize_as_person()
    beam1.set_point(p, 0., p)
    #beam1.set_rectangular_spot(5 / 2 * 1e-5, -5 / 2 * 1e-5, 5 / 2 * 1e-5, -5 / 2 * 1e-5)

    op_ax = Beam(1)
    op_ax.set_point(p, 0., p)

    beam = op_ax.merge(beam1)
    beam.set_divergences_collimated()

    beam.plot_xz()

    distance_between_the_foci = 10.

    wolter3 = CompoundOpticalElement.initialize_as_wolter_3(
        20., 5., distance_between_the_foci)

    print(wolter3.oe[0].ccc_object.get_coefficients())
    print(wolter3.oe[1].ccc_object.get_coefficients())

    #beam = wolter3.trace_wolter3(beam, z0)
    beam = wolter3.trace_compound(beam)

    beam.plot_xz()

    beam.retrace(0.1)
    beam.plot_xz()

    plt.show()
Esempio n. 2
0
def example_wolter2_good_rays():
    print(
        ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>   example_wolter2_good_rays"
    )

    p = 100.  ##### if p=100 the trace_good_ray goes crazy
    beam1 = Beam.initialize_as_person(10000)
    # beam1 = Beam(100000)
    # beam1.set_circular_spot(1.)
    # beam1.set_rectangular_spot(5 / 2 * 1e-5, -5 / 2 * 1e-5, 5 / 2 * 1e-5, -5 / 2 * 1e-5)
    beam1.x *= 100.
    beam1.z *= 100.
    beam1.set_point(p, 0., p)

    op_ax = Beam(1)
    op_ax.set_point(p, 0., p)

    beam = op_ax.merge(beam1)
    beam.set_divergences_collimated()
    beam.plot_xz(0)

    p = 20000.
    q = 30.
    z0 = 5.
    focal = 2 * z0 + q

    wolter2 = CompoundOpticalElement.initialiaze_as_wolter_2(p1=p, q1=q, z0=z0)

    beam = wolter2.trace_good_rays(beam)

    beam.plot_good_xz()

    beam.retrace(10.)
    beam.plot_good_xz()
    plt.title("test_wolter2_good_rays")

    print(beam.flag)

    if do_plot:
        plt.show()
Esempio n. 3
0
def example_optimezed_wolter1_good_rays():
    print(
        ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>   example_optimezed_wolter1_good_rays"
    )

    p = 100.
    beam1 = Beam.initialize_as_person()
    beam1.x *= 50.
    beam1.z *= 50.
    beam1.set_point(p, 0., p)
    op_ax = Beam(1)
    op_ax.set_point(p, 0., p)
    beam = op_ax.merge(beam1)
    beam.set_divergences_collimated()
    beam.plot_xz()

    p = 1e12
    R = 100.
    theta = 1e-3 * np.pi / 180

    wolter1 = CompoundOpticalElement.initialiaze_as_wolter_1_with_two_parameters(
        p1=p, R=R, theta=theta)

    beam = wolter1.trace_good_rays(beam)
    beam.plot_good_xz()

    indices = np.where(beam.flag >= 0)

    assert_almost_equal(beam.x[indices], 0., 8)
    assert_almost_equal(beam.z[indices], 0., 8)

    beam.retrace(100.)
    beam.plot_good_xz()
    plt.title("optimezed_wolter1_good_rays")

    if do_plot:
        plt.show()
Esempio n. 4
0
if main == "__main__":

    print(
        ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>   example_wolter3"
    )

    p = 50.
    q = 5.
    beam1 = Beam.initialize_as_person()
    beam1.set_point(p, 0., p)
    #beam1.set_rectangular_spot(5 / 2 * 1e-5, -5 / 2 * 1e-5, 5 / 2 * 1e-5, -5 / 2 * 1e-5)

    op_ax = Beam(1)
    op_ax.set_point(p, 0., p)

    beam = op_ax.merge(beam1)
    beam.set_divergences_collimated()

    beam.plot_xz()

    distance_between_the_foci = 10.

    wolter3 = CompoundOpticalElement.initialize_as_wolter_3(
        p, q, distance_between_the_foci)

    print(wolter3.oe[0].ccc_object.get_coefficients())
    print(wolter3.oe[1].ccc_object.get_coefficients())

    #beam = wolter3.trace_wolter3(beam, z0)
    beam = wolter3.trace_compound(beam)
Esempio n. 5
0
    def apply_specular_reflections(self, beam, name_file, print_footprint):

        # This is the core of the tracing algoritm

        # This first part compute the travelling time before the two mirror and the image plane
        # and so divide the beam in three:
        # beam1: are the rays that wil first hit oe1
        # beam2: are the rays that will first hit oe2
        # beam3: are the rays that doesn't hit any mirror

        origin = self.time_comparison(beam, elements=[1, 2, 3])
        indices = np.where(origin == 1)
        beam1 = beam.part_of_beam(indices)
        indices = np.where(origin == 2)
        beam2 = beam.part_of_beam(indices)
        indices = np.where(origin == 3)
        beam3 = beam.part_of_beam(indices)

        origin0 = origin.copy()

        if beam3.N != 0:
            [beam3, t] = self.oe[2].intersection_with_optical_element(beam3)

        beam1_list = [beam1.duplicate(), Beam(), Beam()]
        beam2_list = [beam2.duplicate(), Beam(), Beam()]
        beam3_list = [beam3.duplicate(), Beam(), Beam()]

        # This second part compute calculate the travel time of the ray, after the first reflection,
        # to reach the others elements, and put the rays in those beam
        # beam1_list: are the rays that hit oe1
        # beam2_list: are the rays that hit oe2
        # beam3_list: are the rays that reach the image plane

        origin1 = [1, 2]
        origin2 = [1, 2]

        for i in range(0, 2):

            if beam1_list[i].N != 0:
                [beam1_list[i],
                 t] = self.oe[0].intersection_with_optical_element(
                     beam1_list[i])
                self.oe[0].output_direction_from_optical_element(beam1_list[i])

                origin = self.time_comparison(beam1_list[i], [2, 3])
                origin1[i] = origin
                indices = np.where(origin == 2)
                beam2_list[i + 1] = beam1_list[i].part_of_beam(indices)
                indices = np.where(origin == 3)
                beam03 = beam1_list[i].part_of_beam(indices)
            else:
                beam2_list[i + 1] = Beam(0)
                beam03 = Beam(0)

            if beam2_list[i].N != 0:
                [beam2_list[i],
                 t] = self.oe[1].intersection_with_optical_element(
                     beam2_list[i])
                self.oe[1].output_direction_from_optical_element(beam2_list[i])

                origin = self.time_comparison(beam2_list[i], [1, 3])
                origin2[i] = origin
                indices = np.where(origin == 1)
                beam1_list[i + 1] = beam2_list[i].part_of_beam(indices)
                indices = np.where(origin == 3)
                beam003 = beam2_list[i].part_of_beam(indices)
            else:
                beam1_list[i + 1] = Beam(0)
                beam003 = Beam(0)

            beam3_list[i + 1] = beam03.merge(beam003)

        print("Resuming")
        print(beam1_list[0].N, beam1_list[1].N, beam1_list[2].N)
        print(beam2_list[0].N, beam2_list[1].N, beam2_list[2].N)
        print(beam3_list[0].N, beam3_list[1].N, beam3_list[2].N)

        self.print_file_montel(beam_1=beam1_list,
                               beam_2=beam2_list,
                               beam_3=beam3_list,
                               origin0=origin0,
                               origin1=origin1,
                               origin2=origin2,
                               name_file=name_file,
                               print_footprint=print_footprint)

        return beam1_list, beam2_list, beam3_list
Esempio n. 6
0
    beam.set_gaussian_divergence(5 * 1e-5, 0.00025)
    beam.set_rectangular_spot(xmax=200 * 1e-6,
                              xmin=-200 * 1e-6,
                              zmax=10 * 1e-6,
                              zmin=-10 * 1e-6)
    #beam.set_divergences_collimated()

    beam.plot_xz(0)
    plt.title('wolter microscope')
    beam.plot_xpzp(0)

    op_axis = Beam(1)
    op_axis.set_point(0., 0., 0.)
    op_axis.set_divergences_collimated()

    beam = op_axis.merge(beam)

    beam = wolter_jap.trace_compound(beam)

    #b2 = beam.y
    #b3 = beam.z

    #beam.y = b3
    #beam.z = b2

    #beam.x *= 1e6
    #beam.z *= 1e6

    #beam.plot_xz(0)
    #beam.histogram()