<commit_before>import modesolverpy.mode_solver as ms
import modesolverpy.structure as st
import numpy as np

# All units are relative.  [um] were chosen in this case.

x_step = 0.008
y_step = 0.008
wg_height = 0.4
wg_width = 0.5
wg_gaps = .5
sub_height = 0.8
sub_width = 2.
clad_height = 0.5
n_sub = 1.4
n_wg = 3.
n_clad = 1.
film_thickness = 0.5
wavelength = 1.55

wg_widths = [0.5, 0.5]
side_base_length = 0
# angle = np.radians(75)
angle = 75

assert not (angle and side_base_length), "Please enter either an angle, or the length of each triangular side of the waveguide."

# Simply uncomment the desired structure.
structure = st.RidgeWaveguide(x_step,
                              y_step,
                              wg_height,
                              wg_width,
                              sub_height,
                              sub_width,
                              clad_height,
                              n_sub,
                              n_wg,
                              angle,
                              side_base_length,
                              n_clad,
                              film_thickness)

#structure = st.WgArray(x_step,
#                        y_step,
#                        wg_height,
#                        wg_widths,
#                        wg_gaps,
#                        sub_height,
#                        sub_width,
#                        clad_height,
#                        n_sub,
#                        n_wg,
#                        angle,
#                        side_base_length,
#                        n_clad)

structure.write_to_file('example_structure_1.dat')

mode_solver = ms.ModeSolverSemiVectorial(2)
mode_solver.solve(structure, wavelength)
mode_solver.write_modes_to_file('example_modes_1.dat')<commit_msg>Fixed example to work with angle.<commit_after>import modesolverpy.mode_solver as ms
import modesolverpy.structure as st
import numpy as np

# All units are relative.  [um] were chosen in this case.
x_step = 0.02
y_step = 0.02
wg_height = 0.4
wg_width = 0.5
sub_height = 0.5
sub_width = 2.
clad_height = 0.5
n_sub = 1.4
n_wg = 3.
n_clad = 1.
film_thickness = 0.5
wavelength = 1.55
angle = 75.

# Simply uncomment the desired structure.
structure = st.RidgeWaveguide(x_step,
                              y_step,
                              wg_height,
                              wg_width,
                              sub_height,
                              sub_width,
                              clad_height,
                              n_sub,
                              n_wg,
                              angle,
                              n_clad,
                              film_thickness)

structure.write_to_file('example_structure_1.dat')

mode_solver = ms.ModeSolverSemiVectorial(2)
mode_solver.solve(structure, wavelength)
mode_solver.write_modes_to_file('example_modes_1.dat')
{'fraction_non_alphanumeric': 0.06776745786033712, 'fraction_numerical': 0.023391812865497075, 'mean_word_length': 1.271875, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6677417', 'n_tokens_mistral': 928, 'n_tokens_neox': 841, 'n_words': 192}