51 if (py::len(
args) != 1)
52 throw TypeError(
u8"get_determinant() takes exactly one non-keyword argument ({0} given)", py::len(
args));
64 plask::optional<dcomplex> k0;
65 py::stl_input_iterator<std::string> begin(
kwargs), end;
66 for (
auto i = begin; i != end; ++i) {
68 if (what == WHAT_K0 || k0)
69 throw BadInput(self->
getId(),
u8"'lam' and 'k0' are mutually exclusive");
71 if (what)
throw TypeError(
u8"only one key may be an array");
72 what = WHAT_WAVELENGTH; array =
kwargs[*i];
74 k0.reset(2
e3*
PI / py::extract<dcomplex>(
kwargs[*i])());
75 }
else if (*i ==
"k0") {
76 if (what == WHAT_WAVELENGTH || k0)
77 throw BadInput(self->
getId(),
u8"'lam' and 'k0' are mutually exclusive");
79 if (what)
throw TypeError(
u8"only one key may be an array");
80 what = WHAT_K0; array =
kwargs[*i];
82 k0.reset(py::extract<dcomplex>(
kwargs[*i]));
83 }
else if (*i ==
"m") {
84 m = py::extract<int>(
kwargs[*i]);
86 throw TypeError(
u8"get_determinant() got unexpected keyword argument '{0}'", *i);
89 self->Solver::initCalculation();
92 if (k0) expansion->setK0(*k0);
97 if (!k0) expansion->setK0(self->
getK0());
103 "BesselCyl.get_determinant",
110 "BesselCyl.get_determinant",
200 u8"Optical Solver using Bessel expansion in cylindrical coordinates.\n\n"
201 u8"It calculates optical modes and optical field distribution using Bessel modal method\n"
202 u8"and reflection transfer in two-dimensional cylindrical space.")
206 RW_PROPERTY(domain, getDomain, setDomain,
u8"Computational domain ('finite' or 'infinite').");
208 u8"Expansion rule for coefficients matrix. Can be 'direct', 'combined1', 'combined2'\n"
209 u8"or 'old'. Inverse rule is proven to provide the best convergence and\n"
210 u8"should be used in almost every case.\n");
211 RW_PROPERTY(size, getSize, setSize,
u8"Orthogonal expansion size.");
213 u8"Method of selecting wavevectors for numerical Hankel transform in infinite\n"
216 u8"A list of wavevectors ranges. If no weights are given, the actual wavevectors\n"
217 u8"used in the computations are the averages of each two adjacent values specified\n"
218 u8"here and the integration weights are the sizes of each interval.\n");
219 solver.add_property(
"kweights", &BesselSolverCyl_getKweights, &BesselSolverCyl_setKweights,
220 u8"An optional list of relative wavevector weights. The numbers should be relative\n"
221 u8"to the inverse of the structure width.");
223 u8"Maximum wavevector used in the infinite domain relative to the wavelength.\n");
225 u8"Scale factor for wavevectors used in the infinite domain.\n");
227 u8"Wavelength of the light (nm).\n");
229 u8"Alias for :attr:`lam`");
231 u8"Normalized frequency of the light (1/µm).\n");
232 solver.add_property(
"m", &__Class__::getM, &__Class__::setM,
"Angular dependence parameter.");
233 solver.def(
"find_mode", &BesselSolverCyl_findMode,
234 u8"Compute the mode near the specified effective index.\n\n"
235 u8"Only one of the following arguments can be given through a keyword.\n"
236 u8"It is the starting point for search of the specified parameter.\n\n"
238 u8" lam (complex): Starting wavelength (nm).\n"
239 u8" m (int): HE/EH Mode angular number. If ``None``, use :attr:`m` attribute.\n",
240 (arg(
"lam"), arg(
"m")=py::object())
242 solver.def(
"set_mode", &BesselSolverCyl_setMode,
243 u8"Set the mode for specified parameters.\n\n"
244 u8"This method should be used if you have found a mode manually and want to insert\n"
245 u8"it into the solver in order to determine the fields. Calling this will raise an\n"
246 u8"exception if the determinant for the specified parameters is too large.\n\n"
247 u8"Arguments can be given through keywords only.\n\n"
249 u8" lam (complex): Wavelength (nm).\n"
250 u8" m (int): HE/EH Mode angular number.\n"
252 RW_FIELD(emission,
"Direction of the useful light emission.\n\n"
253 u8"Necessary for the over-threshold model to correctly compute the output power.\n"
254 u8"Currently the fields are normalized only if this parameter is set to\n"
255 u8"``top`` or ``bottom``. Otherwise, it is ``undefined`` (default) and the fields\n"
256 u8"are not normalized.");
258 u8"Compute discontinuity matrix determinant.\n\n"
259 u8"Arguments can be given through keywords only.\n\n"
261 u8" lam (complex): Wavelength (nm).\n"
262 u8" k0 (complex): Normalized frequency.\n"
263 u8" m (int): HE/EH Mode angular number.\n"
266 (py::arg(
"lam"),
"side",
"index"));
268 (py::arg(
"lam"),
"side",
"coeffs"),
269 u8"Compute reflection coefficient on planar incidence [%].\n\n"
271 u8" lam (float or array of floats): Incident light wavelength (nm).\n"
272 u8" side (`top` or `bottom`): Side of the structure where the incident light is\n"
274 u8" index: Eigenmode number.\n"
275 u8" coeffs: expansion coefficients of the incident vector.\n");
277 (py::arg(
"lam"),
"side",
"index"));
279 (py::arg(
"lam"),
"side",
"coeffs"),
280 u8"Compute transmission coefficient on planar incidence [%].\n\n"
282 u8" lam (float or array of floats): Incident light wavelength (nm).\n"
283 u8" side (`top` or `bottom`): Side of the structure where the incident light is\n"
285 u8" index: Eigenmode number.\n"
286 u8" coeffs: expansion coefficients of the incident vector.\n");
289 u8"Access to the reflected field.\n\n"
291 u8" side (`top` or `bottom`): Side of the structure where the incident light is\n"
293 u8" polarization: Specification of the incident light polarization.\n"
294 u8" It should be a string of the form 'E\\ *#*\\ ', where *#* is the axis name\n"
295 u8" of the non-vanishing electric field component.\n"
296 u8" idx: Eigenmode number.\n"
297 u8" coeffs: expansion coefficients of the incident vector.\n\n"
298 u8":rtype: Fourier2D.Scattering\n"
300 solver.def(
"get_raw_E", BesselSolverCyl_getFieldVectorE, (py::arg(
"num"),
"level"),
301 u8"Get Bessel expansion coefficients for the electric field.\n\n"
302 u8"This is a low-level function returning $E_s$ and $E_p$ Bessel\n"
303 u8"expansion coefficients. Please refer to the detailed solver description for their\n"
304 u8"interpretation.\n\n"
306 u8" num (int): Computed mode number.\n"
307 u8" level (float): Vertical lever at which the coefficients are computed.\n\n"
308 u8":rtype: numpy.ndarray\n"
310 solver.def(
"get_raw_H", BesselSolverCyl_getFieldVectorH, (py::arg(
"num"),
"level"),
311 u8"Get Bessel expansion coefficients for the magnetic field.\n\n"
312 u8"This is a low-level function returning $H_s$ and $H_p$ Bessel\n"
313 u8"expansion coefficients. Please refer to the detailed solver description for their\n"
314 u8"interpretation.\n\n"
316 u8" num (int): Computed mode number.\n"
317 u8" level (float): Vertical lever at which the coefficients are computed.\n\n"
318 u8":rtype: numpy.ndarray\n"
322 "Side Perfectly Matched Layers boundary conditions.\n\n"
328 u8"Get eigenmodes for a layer at specified level.\n\n"
329 u8"This is a low-level function to access diagonalized eigenmodes for a specific\n"
330 u8"layer. Please refer to the detailed solver description for the interpretation\n"
331 u8"of the returned values.\n\n"
333 u8" level (float): Vertical level at which the coefficients are computed.\n\n"
334 u8":rtype: :class:`~optical.modal.BesselCyl.Eigenmodes`\n",
335 py::with_custodian_and_ward_postcall<0, 1>()
351 py::scope
scope = solver;
355 py::class_<BesselSolverCyl::Mode>(
"Mode",
u8"Detailed information about the mode.", py::no_init)