Slabs

class modesolverpy.structure_base.Slabs(wavelength, y_step, x_step, x_max, x_min=0.0)[source]

Bases: modesolverpy.structure_base._AbstractStructure

Class to implement device refractive index profile cross-section designs.

Slabs is a collection of Slab objects. Each slab has a fixed height (usually less than the maximum height of the desired simulation window), and is as wide as the simulation window.

Slabs objects can be index using [name] to return the various Slab objects. The bottom slab is returned first and so on up to the top slab.

../_images/slabs.svg
Parameters:
  • wavelength (float) – The wavelength the structure operates at.
  • y_step (float) – The step in y.
  • x_step (float) – The step in x.
  • x_max (float) – The maximum x-value.
  • x_min (float) – The minimum x-value. Default is 0.
slabs

dict – The key is the name of the slab, and the value is the Slab object.

slab_count

int – The number of Slab objects added so far.

Attributes Summary

eps np.array – A grid of permittivies representing the permittivity profile of the structure.
eps_func function – a function that when passed a x and y values, returns the permittivity profile of the structure, interpolating if necessary.
n np.array – The refractive index profile matrix of the current slab.
n_func function – a function that when passed a x and y values, returns the refractive index profile of the structure, interpolating if necessary.
x np.array – The grid points in x.
x_ctr float – The centre distance in x.
x_pts int – The number of grid points in x.
xc np.array – The centre points of the x points.
xc_max float – The maximum value of xc.
xc_min float – The minimum value of xc.
xc_pts int – The number of points in xc.
y np.array – The grid points in y.
y_ctr float – The centre distance in y
y_pts int – The number of grid points in y.
yc np.array – The centre points of the y points.
yc_max float – The maximum value of yc.
yc_min float – The minimum value of yc.
yc_pts int – The number of points in yc.

Methods Summary

add_slab(height[, n_background, position]) Creates and adds a Slab object.
change_wavelength(wavelength) Changes the wavelength of the structure.
write_to_file([filename, plot]) Write the refractive index profile to file.

Attributes Documentation

eps

np.array – A grid of permittivies representing the permittivity profile of the structure.

eps_func

function – a function that when passed a x and y values, returns the permittivity profile of the structure, interpolating if necessary.

n

np.array – The refractive index profile matrix of the current slab.

n_func

function – a function that when passed a x and y values, returns the refractive index profile of the structure, interpolating if necessary.

x

np.array – The grid points in x.

x_ctr

float – The centre distance in x.

x_pts

int – The number of grid points in x.

xc

np.array – The centre points of the x points.

xc_max

float – The maximum value of xc.

xc_min

float – The minimum value of xc.

xc_pts

int – The number of points in xc.

y

np.array – The grid points in y.

y_ctr

float – The centre distance in y

y_pts

int – The number of grid points in y.

yc

np.array – The centre points of the y points.

yc_max

float – The maximum value of yc.

yc_min

float – The minimum value of yc.

yc_pts

int – The number of points in yc.

Methods Documentation

add_slab(height, n_background=1.0, position='top')[source]

Creates and adds a Slab object.

Parameters:
  • height (float) – Height of the slab.
  • n_background (float) – The nominal refractive index of the slab. Default is 1 (air).
Returns:

The name of the slab.

Return type:

str

change_wavelength(wavelength)[source]

Changes the wavelength of the structure.

This will affect the mode solver and potentially the refractive indices used (provided functions were provided as refractive indices).

Parameters:wavelength (float) – The new wavelength.
write_to_file(filename='material_index.dat', plot=True)

Write the refractive index profile to file.

Parameters:
  • filename (str) – The nominal filename the refractive index data should be saved to.
  • plot (bool) – True if plots should be generates, otherwise False. Default is True.