コード例 #1
0
    def init_surfaces(self):
        ap = oa.RectangularAperture([self.side_length, self.side_length])
        #        s1 = os.Surface(x=self.x, xn=-self.xn, xt=self.xt, n=self.n, material=self.material, aperture=ap)
        s1 = os.Surface(x=np.array([0, 0, 0, 1]),
                        xn=-self.xn,
                        xt=self.xt,
                        n=self.n,
                        material=self.material,
                        aperture=ap)
        s1.set_rotation_internal(0, self.apex_angle / 2)
        s1_pos = np.array(
            [0, 0, -np.sin(self.apex_angle / 2) * self.side_length / 2, 1])
        s1.set_position(s1_pos)

        #        s2 = os.Surface(x=self.x, xn=self.xn, xt=self.xt, n=1.0, material=air, aperture=ap)
        s2 = os.Surface(x=np.array([0, 0, 0, 1]),
                        xn=self.xn,
                        xt=self.xt,
                        n=1.0,
                        material=air,
                        aperture=ap)
        s2.set_rotation_internal(0, -self.apex_angle / 2)
        s2_pos = np.array(
            [0, 0, np.sin(self.apex_angle / 2) * self.side_length / 2, 1])
        s2.set_position(s2_pos)
        self.surfaces = [s1, s2]
コード例 #2
0
    def __init__(self, x=np.array([0, 0, 0, 1]), xn=np.array([0, 0, -1, 0]), xt=np.array([0, 1, 0, 0]),
                 n=1.0, material=air, aperture=oa.OpticalAperture(12.7e-3), grating_period=None, m=0):
        """ Basic surface. Implements functions for finding intersection with ray and coordinate transforms.
        
        Inputs:
        x: Origin position
        xn: Surface orientation (normal)
        xt: Surface orientation (tangent)
        n: Refractive index after passing surface (None if last surface in element)
        material: Material after passing surface
        aperture: size of the surface
        """
        self.x = x
        self.xn = xn / np.sqrt(np.dot(xn, xn))
        self.xt = xt / np.sqrt(np.dot(xt, xt))
        self.n = n
        self.material = material
        self.xpMint = np.identity(4)
        self.xpM = np.identity(4)
        self.xM = np.identity(4)
        self.xMT = np.identity(4)
        self.xpMext = np.identity(4)
        self.generate_transform_matrix()
        self.aperture = aperture
        self.surface_edge = None
        self.grating_period = grating_period
        self.m = m                              # Grating diffraction order

        self.logger = logging.getLogger("Surface.")
        self.logger.setLevel(logging.DEBUG)

        xt2 = np.hstack((np.cross(self.xt[0:3], self.xn[0:3]), 0))
        self.xpM = np.transpose(np.vstack((xt2, self.xt, self.xn, np.array([0, 0, 0, 1]))))        
        
        self.generate_surface_edge()
コード例 #3
0
 def init_surfaces(self):
     ap = oa.InifiniteAperture()
     self.surfaces = [
         os.Surface(x=np.array([0, 0, 0, 1]),
                    xn=-self.xn,
                    xt=self.xt,
                    n=self.n,
                    material=self.material,
                    aperture=ap)
     ]
コード例 #4
0
 def __init__(self):
     self.elements = list()
     self.ray_source_list = list()
     self.material_library = om.MaterialLibrary()
     self.optical_axis_xpM = [np.identity(4)]
     self.optical_axis_xM = [np.identity(4)]
     self.optical_axis_xMT = [np.identity(4)]
     self.optical_axis_theta = 0.0
     self.optical_axis_phi = 0.0
     self.logger = logging.getLogger("System.")
     self.logger.setLevel(logging.INFO)
     self.surround_aperture = oa.InsideSphereAperture(1.0)
コード例 #5
0
ファイル: opt_sys_test.py プロジェクト: filiplindau/Raytracer
 def __init__(self):
     self.elements = list()
     self.ray_source_list = list()
     self.material_library = om.MaterialLibrary()
     self.optical_axis_xpM = [np.identity(4)]
     self.optical_axis_xM = [np.identity(4)]
     self.optical_axis_xMT = [np.identity(4)]
     self.optical_axis_theta = [
         0.0
     ]  # Theta angle compared to previous element
     self.optical_axis_phi = [0.0]  # Phi angle compared to previous element
     self.optical_axis_pos = [np.array([0.0, 0.0, 0.0])]
     self.logger = logging.getLogger("System.")
     self.logger.setLevel(logging.INFO)
     self.surround_aperture = oa.InsideSphereAperture(1.0)
コード例 #6
0
 def init_surfaces(self):
     ap = oa.CircularAperture(self.size)
     s1 = os.Surface(x=np.array([0, 0, 0, 1]),
                     xn=-self.xn,
                     xt=self.xt,
                     n=self.n,
                     material=self.material,
                     aperture=ap)
     s2 = os.Surface(x=np.array([0, 0, self.thickness, 1]),
                     xn=self.xn,
                     xt=self.xt,
                     n=self.n,
                     material=air,
                     aperture=ap)
     self.surfaces = [s1, s2]
コード例 #7
0
 def init_surfaces(self):
     ap = oa.CircularAperture(self.size)
     #        s1 = os.SphericalSurface(x=self.x, xn=-self.xn, xt=self.xt, n=self.n, r=self.r1,
     #        material=self.material, aperture=ap)
     s1 = os.SphericalSurface(x=np.array([0, 0, 0, 1]),
                              xn=-self.xn,
                              xt=self.xt,
                              n=self.n,
                              r=self.r1,
                              material=self.material,
                              aperture=ap)
     #        s2 = os.Surface(x=self.x, xn=self.xn, xt=self.xt, n=1.0, material=air, aperture=ap)
     s2 = os.Surface(x=np.array([0, 0, self.thickness, 1]),
                     xn=self.xn,
                     xt=self.xt,
                     n=1.0,
                     material=air,
                     aperture=ap)
     #        s2.setPosition(self.x+np.array([0,0,self.thickness,0]))
     self.surfaces = [s1, s2]
コード例 #8
0
    def init_surfaces(self):
        ap = oa.CircularAperture(size=self.size)
        s1 = os.Surface(x=np.array([0, 0, 0, 1]),
                        xn=-self.xn,
                        xt=self.xt,
                        n=self.n,
                        material=self.material,
                        aperture=ap)
        s1.set_rotation_internal(0, 0)

        #        s2 = os.Surface(x=self.x, xn=self.xn, xt=self.xt, n=1.0, material=air, aperture=ap)
        s2 = os.Surface(
            x=np.array([0, 0, self.thickness, 1]),
            xn=self.xn,
            xt=self.xt,
            n=1.0,
            material=air,
            aperture=ap,
        )
        s2.set_rotation_internal(0, 0)
        self.surfaces = [s1]
コード例 #9
0
    def init_surfaces(self):
        self.logger.info("{0} Init grating surfaces".format(self))
        ap = oa.RectangularAperture([self.side_length, self.side_length])
        #        s1 = os.Surface(x=self.x, xn=-self.xn, xt=self.xt, n=self.n, material=self.material, aperture=ap)
        s1 = os.Surface(x=np.array([0, 0, 0, 1]),
                        xn=-self.xn,
                        xt=self.xt,
                        n=self.n,
                        material=self.material,
                        aperture=ap)
        s1.set_rotation_internal(0, 0)

        #        s2 = os.Surface(x=self.x, xn=self.xn, xt=self.xt, n=1.0, material=air, aperture=ap)
        s2 = os.Surface(x=np.array([0, 0, self.thickness, 1]),
                        xn=self.xn,
                        xt=self.xt,
                        n=1.0,
                        material=air,
                        aperture=ap,
                        grating_period=self.grating_period,
                        m=self.m)
        s2.set_rotation_internal(0, 0)
        self.surfaces = [s1, s2]
コード例 #10
0
 def __init__(self, x=np.array([0, 0, 0, 1]), xn=np.array([0, 0, -1, 0]), xt=np.array([0, 1, 0, 0]), n=1.0, r=1.0, material=air, aperture=oa.OpticalAperture(12.7e-3)):
     self.r = r
     Surface.__init__(self, x=x, xn=xn, xt=xt, n=n, material=material, aperture=aperture)