![]() |
![]() |
![]() |
![]() |
![]() |
In next example, we introduce a few new features.
from rodis import * # rodis data set_lambda(1.0) set_N(10) set_alpha(0.1) set_delta(0.1) set_psi(0.9) # make device Alas = Material(2.9 - 0.1j) air = Material(1.0) start = Slab( Alas(1.2) ) bigrod = Slab( air(0.15) + Alas(0.9) + air(0.15)) smallrod = Slab( 2*(air(0.15) + Alas(0.3) + air(0.15))) end = Slab( air(1.2) ) cratch = Stack( start(1.) + bigrod(0.3) + smallrod(0.3) + end(1.)) # calculate cratch.calc() print cratch.field().R_TM(1) print abs(cratch.field().R_TE(2)) print cratch.field().T_TE(3).real print cratch.field().T_TM(4).imag |

We add two variables which describe the angle of incidence of the field:
alpha and delta. As can be seen in the script, both can be set
using set_alpha(alpha) and set_delta(delta).
The use of delta comes with a change in defining the polarisation.
We don't have to set TM or TE anymore, instead, we have to define psi
as angle of polarisation. (set_psi())
Remark that the refractive index of the material Alas is complex.
The negative imaginary part makes the material lossy.
A positive imaginary part would provide the material of gain.
Complex numbers are written in Python like a + bj.
The output illustrates how to ask the real, imaginary part
and absolute value of a Complex.
Instead of writing air(.15)+ Alas(.3)+ air(.3)+alas(.3)+air(0.15)
to make a slab,
you can write 2*(air(.15)+alas(0.3)+air(0.15)).
Rodis wil stick materials with a same index togheter.