コード例 #1
0
    def __init__(self, wavelength, x_step, y_step, wg_height, wg_widths, wg_gaps, sub_height,
                 sub_width, clad_height, n_sub, n_wg, angle=0, n_clad=mat.Air().n()):
        sb.Slabs.__init__(self, wavelength, y_step, x_step, sub_width)

        try:
            iter(wg_gaps)
        except TypeError:
            wg_gaps = [wg_gaps]

        try:
            assert len(wg_widths) == len(wg_gaps)+1
        except TypeError:
            wg_widths = [wg_widths for _ in wg_gaps]

        wg_gaps_pad = copy.copy(wg_gaps)
        wg_gaps_pad.append(0.)

        self.add_slab(sub_height, n_sub)

        k = self.add_slab(wg_height, n_clad)
        air_width_l_r = 0.5*(sub_width - np.sum(wg_widths) - np.sum(wg_gaps))
        position = air_width_l_r

        for wg_width, wg_gap in zip(wg_widths, wg_gaps_pad):
            self.slabs[k].add_material(position, position + wg_width, n_wg, angle)

            position += wg_width + wg_gap

        self.add_slab(clad_height, n_clad)
コード例 #2
0
    def __init__(self,
                 wavelength,
                 x_step,
                 y_step,
                 wg_height,
                 wg_width,
                 sub_height,
                 sub_width,
                 clad_height,
                 n_sub,
                 n_wg,
                 angle=0,
                 n_clad=mat.Air().n(),
                 film_thickness='wg_height'):
        Slabs.__init__(self, wavelength, y_step, x_step, sub_width)

        self.n_sub = n_sub
        self.n_clad = n_clad
        self.n_wg = n_wg

        self.add_slab(sub_height, n_sub)
        if film_thickness != 'wg_height' and film_thickness != wg_height:
            assert film_thickness > 0.
            self.add_slab(film_thickness - wg_height, n_wg)
        k = self.add_slab(wg_height, n_clad)

        self.slabs[k].add_material(self.x_ctr - wg_width / 2.,
                                   self.x_ctr + wg_width / 2., n_wg, angle)

        self.add_slab(clad_height, n_clad)
コード例 #3
0
ファイル: _structure.py プロジェクト: joamatab/modesolverpy
    def __init__(
        self,
        wavelength: Union[float, float64],
        x_step: float,
        y_step: float,
        thickness: float,
        width: Union[float, float64],
        sub_thickness: float,
        sub_width: float,
        clad_thickness: List[float],
        n_sub: float64,
        n_wg: float64,
        n_slab: Optional[float] = None,
        angle: Union[float, int] = 0,
        n_clad: List[float64] = [mat.Air().n()],
        film_thickness: float = "thickness",
    ) -> None:
        if not isinstance(n_clad, Iterable):
            raise ValueError(f"n_clad not Iterable, got {n_clad}")
        if not isinstance(clad_thickness, Iterable):
            raise ValueError(
                f"clad_thickness not Iterable, got {clad_thickness}")

        sb.Slabs.__init__(self, wavelength, y_step, x_step, sub_width)

        self.n_sub = n_sub
        self.n_clad = n_clad
        self.n_wg = n_wg
        self.settings = {}
        self.thickness = thickness
        self.width = width
        self.slab_thickness = film_thickness - thickness

        self.add_slab(sub_thickness, n_sub)
        # if film_thickness != "thickness" and film_thickness != thickness:
        if film_thickness not in ("thickness", thickness):
            assert film_thickness > 0.0, "Film must have some thickness to it."
            assert (thickness <= film_thickness
                    ), "Waveguide can't be thicker than the film."
            self.add_slab(self.slab_thickness, n_slab or n_wg)
        k = self.add_slab(thickness, n_clad[0])

        self.slabs[k].add_material(self.x_ctr - width / 2.0,
                                   self.x_ctr + width / 2.0, n_wg, angle)

        for hc, nc in zip(clad_thickness, n_clad):
            self.add_slab(hc, nc)
コード例 #4
0
    def __init__(self, wavelength, x_step, y_step, wg_height, wg_width, sub_height, sub_width,
                 clad_height, n_sub, n_wg, angle=0, n_clad=mat.Air().n(),
                 film_thickness='wg_height'):
        sb.Slabs.__init__(self, wavelength, y_step, x_step, sub_width)

        self.n_sub = n_sub
        self.n_clad = n_clad
        self.n_wg = n_wg

        self.add_slab(sub_height, n_sub)
        if film_thickness != 'wg_height' and film_thickness != wg_height:
            assert film_thickness > 0., 'Film must have some thickness to it.'
            assert wg_height <= film_thickness, 'Waveguide can\'t be thicker than the film.'
            self.add_slab(film_thickness-wg_height, n_wg)
        k = self.add_slab(wg_height, n_clad)

        self.slabs[k].add_material(self.x_ctr-wg_width/2., self.x_ctr+wg_width/2.,
                                   n_wg, angle)

        self.add_slab(clad_height, n_clad)
コード例 #5
0
ファイル: gc-sweep-soi.py プロジェクト: yh2424/modesolverpy
periods = []
periods.append(dcs)

for wl in wls:
    ngc = []
    for ed, ft in [(ed1, ft1), (ed2, ft2)]:
        def struct_func(n_sub, n_wg, n_clad):
            return st.RidgeWaveguide(wl, x_step, y_step, ed, wg_width,
                                     sub_height, sub_width, clad_height,
                                     n_sub, n_wg, None, n_clad, ft)

        n_sub = mat.SiO2().n(wl)
        n_wg_xx = 3.46
        n_wg_yy = 3.46
        n_wg_zz = 3.46
        n_clad = mat.Air().n()

        struct_xx = struct_func(n_sub, n_wg_xx, n_clad)
        struct_yy = struct_func(n_sub, n_wg_yy, n_clad)
        struct_zz = struct_func(n_sub, n_wg_zz, n_clad)

        struct_ani = st.StructureAni(struct_xx, struct_yy, struct_zz)
        #struct_ani.write_to_file()

        solver = ms.ModeSolverFullyVectorial(4)
        solver.solve(struct_ani)
        #solver.write_modes_to_file()

        if polarisation == 'TE':
            ngc.append(np.round(np.real(solver.n_effs_te), 4)[0])
        elif polarisation == 'TM':
コード例 #6
0
ファイル: materials.py プロジェクト: joamatab/modesolverpy
def air(wl):
    return mat.Air().n(wl)
コード例 #7
0
ファイル: _structure.py プロジェクト: joamatab/modesolverpy
    def __init__(
        self,
        wavelength: float,
        x_step: float,
        y_step: float,
        thickness: float,
        widths: List[float],
        wg_gaps: List[float],
        sub_thickness: float,
        sub_width: float,
        clad_thickness: List[float],
        n_sub: float64,
        n_wg: float64,
        n_slab: Optional[float] = None,
        angle: float = 0,
        n_clad: List[float64] = [mat.Air().n()],
        film_thickness: Optional[float] = None,
    ) -> None:

        sb.Slabs.__init__(self, wavelength, y_step, x_step, sub_width)

        film_thickness = film_thickness or thickness

        self.n_sub = n_sub
        self.n_clad = n_clad
        self.n_wg = n_wg
        self.settings = {}
        self.thickness = thickness
        self.widths = widths
        self.wg_gaps = wg_gaps
        self.slab_thickness = film_thickness - thickness

        try:
            iter(wg_gaps)
        except TypeError:
            wg_gaps = [wg_gaps]

        try:
            assert len(widths) == len(wg_gaps) + 1
        except TypeError:
            widths = [widths for _ in wg_gaps]

        wg_gaps_pad = copy.copy(wg_gaps)
        wg_gaps_pad.append(0.0)

        self.add_slab(sub_thickness, n_sub)

        if film_thickness not in ("thickness", thickness):
            assert film_thickness > 0.0, "Film must have some thickness to it."
            assert (thickness <= film_thickness
                    ), "Waveguide can't be thicker than the film."
            self.add_slab(self.slab_thickness, n_slab or n_wg)

        k = self.add_slab(thickness, n_clad[0])
        air_width_l_r = 0.5 * (sub_width - np.sum(widths) - np.sum(wg_gaps))
        position = air_width_l_r

        for width, wg_gap in zip(widths, wg_gaps_pad):
            self.slabs[k].add_material(position, position + width, n_wg, angle)

            position += width + wg_gap

        for hc, nc in zip(clad_thickness, n_clad):
            self.add_slab(hc, nc)