Beispiel #1
0
    def initialize_as_kirkpatrick_baez_parabolic(cls, p, q, separation, theta, bound1=None, bound2=None, infinity_location='p'):


        p1 = p - 0.5 * separation
        q1 = p - p1
        q2 = q - 0.5 * separation
        p2 = q - q2
        f1p = p1
        f1q = p + q - p1
        f2q = q2
        f2p = p + q - q2


        oe1 = Optical_element.initialize_as_surface_conic_paraboloid_from_focal_distances(p= f1p, q= f1q, theta= theta, alpha=0., cylindrical=1, infinity_location=infinity_location)
        #oe1.bound = bound1
        oe1.set_bound(bound1)
        oe1.p = p1
        oe1.q = q1

        oe2 = Optical_element.initialize_as_surface_conic_paraboloid_from_focal_distances(p= f2p, q= f2q, theta= theta, alpha=90.*np.pi/180, cylindrical=1, infinity_location=infinity_location)
        #oe2.bound = bound2
        oe2.set_bound(bound2)
        oe2.p = p2
        oe2.q = q2

        print(oe1.ccc_object.get_coefficients())
        print(oe2.ccc_object.get_coefficients())

        return CompoundOpticalElement(oe_list=[oe1,oe2],oe_name="Kirkpatrick Baez")
Beispiel #2
0
    def initialize_as_montel_parabolic(cls,
                                       p,
                                       q,
                                       theta_z,
                                       theta_x=None,
                                       bound1=None,
                                       bound2=None,
                                       distance_of_the_screen=None,
                                       angle_of_mismatch=0.,
                                       infinity_location='q'):

        beta = np.pi / 2 + angle_of_mismatch  #### angle beetween the two mirror, if angle_of_mismatch is <0 the two mirror are closer
        if theta_x == None:
            theta_x = theta_z

        oe1 = Optical_element.initialize_as_surface_conic_paraboloid_from_focal_distances(
            p=p,
            q=q,
            theta=theta_z,
            alpha=0. * np.pi / 180,
            infinity_location=infinity_location,
            cylindrical=1.)
        oe2 = Optical_element.initialize_as_surface_conic_paraboloid_from_focal_distances(
            p=p,
            q=q,
            theta=theta_x,
            alpha=0. * np.pi / 180,
            infinity_location=infinity_location,
            cylindrical=1.)
        oe1.set_bound(bound1)

        oe2.rotation_surface_conic(beta, 'y')
        oe2.set_bound(bound2)

        if distance_of_the_screen == None:
            distance_of_the_screen = q
        ccc = np.array(
            [0., 0., 0., 0., 0., 0., 0., 1., 0., -distance_of_the_screen])
        screen = Optical_element.initialize_as_surface_conic_from_coefficients(
            ccc)
        screen.set_parameters(p, distance_of_the_screen, 0., 0.,
                              "Surface conical mirror")

        return CompoundOpticalElement(oe_list=[oe1, oe2, screen],
                                      oe_name="Montel parabolic")
Beispiel #3
0
    def initialiaze_as_wolter_1(cls,p1,q1,z0):
        theta1 = 0.
        alpha1 = 0.
        print(q1)
        print(2*z0)
        print("dof=%f" %(2*z0-q1))

        oe1 = Optical_element.initialize_as_surface_conic_paraboloid_from_focal_distances(p1, 0., theta1, alpha1, "p", 2*z0-q1)
        oe2 = Optical_element.initialize_my_hyperboloid(p=0., q=q1, theta=90 * np.pi / 180, alpha=0, wolter=1, z0=z0,distance_of_focalization=2*z0-q1)

        return CompoundOpticalElement(oe_list=[oe1,oe2],oe_name="Wolter 1")
Beispiel #4
0
    def initialiaze_as_wolter_2(cls,p1,q1,z0):
        #q1 = - q1
        focal = q1+2*z0
        print("focal=%f" %(focal))
        theta1 = 0.
        alpha1 = 0.

        oe1 = Optical_element.initialize_as_surface_conic_paraboloid_from_focal_distances(p1,0.,theta1,alpha1,"p", focal)
        oe2 = Optical_element.initialize_my_hyperboloid(p=0. ,q=-(focal-2*z0), theta=90*np.pi/180, alpha=0, wolter=2, z0=z0, distance_of_focalization=focal)


        return CompoundOpticalElement(oe_list=[oe1,oe2],oe_name="Wolter 2")
Beispiel #5
0
    def initialiaze_as_wolter_1_with_two_parameters(cls, p1, R, theta):

        cp1 = -2 * R / np.tan(theta)
        cp2 = 2 * R * np.tan(theta)
        cp = max(cp1, cp2)
        f = cp / 4
        print("focal=%f" % (f))

        oe1 = Optical_element.initialize_as_surface_conic_paraboloid_from_focal_distances(
            p=p1, q=f, theta=0., alpha=0., infinity_location="p")

        s1 = R / np.tan(2 * theta)
        s2 = R / np.tan(4 * theta)
        c = (s1 - s2) / 2
        z0 = f + c

        b1 = np.sqrt(0.5 * c**2 + 0.5 * R**2 + 0.5 * R**4 / cp**2 -
                     R**2 * z0 / cp + 0.5 * z0**2 - 0.5 / cp**2 * np.sqrt(
                         (-c**2 * cp**2 - cp**2 * R**2 - R**4 +
                          2 * cp * R**2 * z0 - cp**2 * z0**2)**2 - 4 * cp**2 *
                         (c**2 * R**4 - 2 * c**2 * cp * R**2 * z0 +
                          c**2 * cp**2 * z0**2)))
        b2 = np.sqrt(0.5 * c**2 + 0.5 * R**2 + 0.5 * R**4 / cp**2 -
                     R**2 * z0 / cp + 0.5 * z0**2 + 0.5 / cp**2 * np.sqrt(
                         (-c**2 * cp**2 - cp**2 * R**2 - R**4 +
                          2 * cp * R**2 * z0 - cp**2 * z0**2)**2 - 4 * cp**2 *
                         (c**2 * R**4 - 2 * c**2 * cp * R**2 * z0 +
                          c**2 * cp**2 * z0**2)))
        b = min(b1, b2)
        a = np.sqrt(c**2 - b**2)

        ccc = np.array([
            -1 / a**2, -1 / a**2, 1 / b**2, 0., 0., 0., 0., 0., -2 * z0 / b**2,
            z0**2 / b**2 - 1
        ])
        oe2 = Optical_element.initialize_as_surface_conic_from_coefficients(
            ccc)
        oe2.set_parameters(p=0.,
                           q=z0 + c,
                           theta=90 * np.pi / 180,
                           alpha=0.,
                           type="My hyperbolic mirror")
        #oe2.type = "My hyperbolic mirror"
        #oe2.p = 0.
        #oe2.q = z0 + c
        #oe2.theta = 90 * np.pi / 180
        #oe2.alpha = 0.

        return CompoundOpticalElement(oe_list=[oe1, oe2], oe_name="Wolter 1")
Beispiel #6
0
    def initialize_as_wolter_3(cls, p, q, distance_between_the_foci):
        f=-q

        oe1 = Optical_element.initialize_as_surface_conic_paraboloid_from_focal_distances(p=p, q=f, theta=0., alpha=0., infinity_location="p")

        #c = z0+np.abs(f)
        c = distance_between_the_foci/2
        z0 = np.abs(c)-np.abs(f)
        b = c+100
        a = np.sqrt((b**2-c**2))
        ccc = np.array([1/a**2, 1/a**2, 1/b**2, 0., 0., 0., 0., 0., -2*z0/b**2, z0**2/b**2-1])

        oe2 = Optical_element.initialize_as_surface_conic_from_coefficients(ccc)
        oe2.set_parameters(p=0., q=z0+z0+np.abs(q), theta=90*np.pi/180)


        return CompoundOpticalElement(oe_list=[oe1,oe2],oe_name="Wolter 3")
Beispiel #7
0
    def test_paraboloid_mirror(self):

        print(">>>>>>>>>>>>>>> test_paraboloid_mirror")
        #beam1=Beam(5000)
        #beam1.set_point(0,0,0)
        #beam1.set_flat_divergence(5e-3,5e-2)

        shadow_beam = run_shadow_source()

        beam1=Beam()
        beam1.initialize_from_arrays(
            shadow_beam.getshonecol(1),
            shadow_beam.getshonecol(2),
            shadow_beam.getshonecol(3),
            shadow_beam.getshonecol(4),
            shadow_beam.getshonecol(5),
            shadow_beam.getshonecol(6),
            shadow_beam.getshonecol(10),
        )

        p=10.
        q=20.
        theta=72*np.pi/180
        alpha=0*np.pi/180
        spherical_mirror=Optical_element.initialize_as_surface_conic_paraboloid_from_focal_distances(p,q,theta,alpha)
        beam1=spherical_mirror.trace_optical_element(beam1)

        if do_plot:
            beam1.plot_xz()
            beam1.plot_xpzp()
            plt.title("Paraboloid mirror  with p=10, q=20, theta=72")
            print(spherical_mirror.ccc_object.get_coefficients())
            plt.show()

        shadow_beam = run_shadow_parabolic_mirror(shadow_beam)


        assert_almost_equal(beam1.x, shadow_beam.getshonecol(1), 7)
        assert_almost_equal(beam1.y, shadow_beam.getshonecol(2), 7)
        assert_almost_equal(beam1.z, shadow_beam.getshonecol(3), 7)
Beispiel #8
0
    def initialiaze_as_wolter_12(cls, p1, q1, focal_parabola, Rmin):

        focal = focal_parabola
        d = q1 - focal_parabola
        z0 = focal_parabola + d / 2
        print("focal=%f" % (focal))
        theta1 = 0.
        alpha1 = 0.

        oe1 = Optical_element.initialize_as_surface_conic_paraboloid_from_focal_distances(
            p1, 0., theta1, alpha1, "p", focal)
        ccc = oe1.ccc_object.get_coefficients()
        cp = -ccc[8]
        print("R=%f, d=%f, cp=%f, z0=%f" % (Rmin, d, cp, z0))
        #b1 = np.sqrt(0.125*d**2+Rmin+2*Rmin**4/cp**2-2*Rmin**2*z0/cp+0.5*z0**2-0.125/cp**2*np.sqrt((-cp**2*d**2-8*cp**2*Rmin-16*Rmin**4+16*cp*Rmin**2*z0-4*cp*z0**2)**2-16*cp**2*(4*d**2*Rmin**4-4*cp*d**2*Rmin**2*z0+cp**2*d**2*z0**2)))
        #b2 = np.sqrt(0.125*d**2+Rmin+2*Rmin**4/cp**2-2*Rmin**2*z0/cp+0.5*z0**2+0.125/cp**2*np.sqrt((-cp**2*d**2-8*cp**2*Rmin-16*Rmin**4+16*cp*Rmin**2*z0-4*cp*z0**2)**2-16*cp**2*(4*d**2*Rmin**4-4*cp*d**2*Rmin**2*z0+cp**2*d**2*z0**2)))
        p1 = -cp**2 * d**2 - 8 * cp**2 * Rmin - 16 * Rmin**4 + 16 * cp * Rmin**2 * z0 - 4 * cp**2 * z0**2
        p1 = p1**2
        p2 = 16 * cp**2 * (4 * d**2 * Rmin**4 - 4 * cp * d**2 * Rmin**2 * z0 +
                           cp**2 * d**2 * z0**2)
        sp = 0.125 / cp**2 * np.sqrt(p1 - p2)
        sp0 = 0.125 * d**2 + Rmin + 2 * Rmin**4 / cp**2 - 2 * Rmin**2 * z0 / cp + 0.5 * z0**2
        b = np.sqrt(sp0 - sp)
        a = np.sqrt(d**2 / 4 - b**2)

        print("a=%f, b=%f" % (a, b))

        #oe2 = Optical_element.initialize_my_hyperboloid(p=0. ,q=-(focal-2*z0), theta=90*np.pi/180, alpha=0, wolter=1.1, z0=z0, distance_of_focalization=focal)

        cc = np.array([
            -1 / a**2, -1 / a**2, 1 / b**2, 0., 0., 0., 0., 0., -2 * z0 / b**2,
            (z0 / b)**2 - 1
        ])
        oe2 = Optical_element.initialize_as_surface_conic_from_coefficients(cc)
        oe2.type = "My hyperbolic mirror"
        oe2.set_parameters(p=0., q=q1, theta=90. * np.pi / 180, alpha=0.)

        return CompoundOpticalElement(oe_list=[oe1, oe2], oe_name="Wolter 1.2")
Beispiel #9
0
    beam_2_04 = comp_oe2_04.trace_compound(beam_2_04)
    beam_2_14 = comp_oe2_14.trace_compound(beam_2_14)

    beam_2_04.plot_xz()
    plt.title('Final plot of a KirkPatrickBaez system with parameter = 0.4')
    beam_2_14.plot_xz()
    plt.title('Final plot of a KirkPatrickBaez system with parameter = 1.471')

    plt.show()

if main == "__paraboloid__":

    beam = beam()

    oe1 = Optical_element.initialize_as_surface_conic_paraboloid_from_focal_distances(
        p=0.3, q=0.4, theta=theta, infinity_location='q')

    beam = oe1.trace_optical_element(beam)

    beam_2_04 = beam.duplicate()
    beam_2_14 = beam.duplicate()

    oe2_04 = Optical_element.initialize_as_surface_conic_paraboloid_from_focal_distances(
        p=0.3, q=0.4, theta=theta, infinity_location='p')
    oe2_14 = Optical_element.initialize_as_surface_conic_paraboloid_from_focal_distances(
        p=0.3, q=1.471, theta=theta, infinity_location='p')

    beam_2_04 = oe2_04.trace_optical_element(beam_2_04)
    beam_2_14 = oe2_14.trace_optical_element(beam_2_14)

    beam_2_04.plot_xz()
Beispiel #10
0
zmax = 0.01
zmin = 0.0
bound = BoundaryRectangle(xmax=xmax,
                          xmin=xmin,
                          ymax=ymax,
                          ymin=ymin,
                          zmax=zmax,
                          zmin=zmin)
montel = CompoundOpticalElement.initialize_as_montel_parabolic(
    p=0.351,
    q=1.,
    theta=theta,
    bound1=bound,
    bound2=bound,
    infinity_location='p')
par = Optical_element.initialize_as_surface_conic_paraboloid_from_focal_distances(
    0.351, 1., theta, 0.0, 'p', None, 1)

#velocity = Vector(beam.vx, beam.vy, beam.vz)
#velocity.rotation(-gamma, 'z')
#velocity.rotation(-alpha, 'x')
#beam.vx = velocity.x
#beam.vy = velocity.y
#beam.vz = velocity.z
#
#
#print(beam.vx, beam.vy, beam.vz)
#
#
#position = Vector(beam.x, beam.y, beam.z)
#position.rotation(-gamma, 'z')
#position.rotation(-alpha, 'x')