示例#1
0
def example_montel_paraboloid():
    print(
        ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>  example_montel_paraboloid")

    beam = Beam(25000)
    beam.set_circular_spot(1e-3)
    beam.set_flat_divergence(0.01, 0.01)
    beam.set_flat_divergence(1e-6, 1e-6)

    beam.flag *= 0

    p = 5.
    q = 15.
    theta = 88. * np.pi / 180

    xmax = 0.
    xmin = -0.4
    ymax = 0.4
    ymin = -0.4
    zmax = 0.4
    zmin = 0.

    bound1 = BoundaryRectangle(xmax, xmin, ymax, ymin, zmax, zmin)
    bound2 = BoundaryRectangle(xmax, xmin, ymax, ymin, zmax, zmin)

    montel = CompoundOpticalElement.initialize_as_montel_parabolic(
        p=p,
        q=q,
        theta=theta,
        bound1=bound1,
        bound2=bound2,
        distance_of_the_screen=q)
    beam03 = montel.trace_montel(beam)

    print(beam03[2].N / 25000)

    plt.figure()
    plt.plot(beam03[0].x, beam03[0].z, 'ro')
    plt.plot(beam03[1].x, beam03[1].z, 'bo')
    plt.plot(beam03[2].x, beam03[2].z, 'go')
    plt.xlabel('x axis')
    plt.ylabel('z axis')
    plt.axis('equal')

    beam03[2].plot_xz(0)

    print("No reflection = %d\nOne reflection = %d\nTwo reflection = %d" %
          (beam03[0].N, beam03[1].N, beam03[2].N))
    print("dx = %f" % (max(beam03[2].x) - min(beam03[2].x)))

    plt.show()
示例#2
0
def beam_source1():

    beam = Beam(25000)
    beam.set_circular_spot(r=1e-4)
    #beam.set_rectangular_spot(xmax=1e-4, xmin=-1e-4, zmax=1e-4, zmin=1e-4)
    #beam.set_gaussian_spot(dx=1e-4, dz=1e-4)
    #beam.set_flat_divergence(dx=25e-6, dz=25e-6)
    #beam.set_gaussian_divergence(25e-6, 25e-6)
    beam.set_divergences_collimated()
    xmax = 0.
    xmin = -100.
    ymax = 0.3
    ymin = -0.4
    zmax = 100.
    zmin = 0.

    bound = BoundaryRectangle(xmax=xmax, xmin=xmin, ymax=ymax, ymin=ymin, zmax=zmax, zmin=zmin)

    return beam, bound
示例#3
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)
示例#4
0
from monwes.Beam import Beam
from monwes.Shape import BoundaryRectangle
import numpy as np
import matplotlib.pyplot as plt
from monwes.CompoundOpticalElement import CompoundOpticalElement

do_plot = True
main = "__main__"


if main == "__main__":

    print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>  example_montel_paraboloid")

    beam = Beam(25000)
    beam.set_circular_spot(1e-3)
    beam.set_flat_divergence(0.01, 0.01)
    beam.set_flat_divergence(1e-6, 1e-6)

    beam.plot_xz(0)

    beam.flag *= 0

    p = 5.
    q = 15.
    theta = 88.*np.pi/180

    xmax = 0.
    xmin = -0.4
    ymax =  0.4
    ymin = -0.4