API Reference

The following section outlines the API of fdtd.py.

Materials

class fdtd.Material(name, eps_r=1, mu_r=1, sigma_e=0, sigma_m=0, color='#000000')[source]

Implement a material.

Parameters
  • name (str) – The name of the material.

  • eps_r (float) – Relative permissivity.

  • mu_r (float) – Relative permeability.

  • sigma_e (float) – Electric condutivity.

  • sigma_m (float) – Magnetic condutivity.

  • color (str) – RGB color.

classmethod from_name(name)[source]

Initialize material from a name.

Parameters

name (str) – Name of material.

Returns

Return type

Material

Raises

MaterialNotFound – If material is not found.

Notes

Material[name] is equivalent to Material.from_name(name).

classmethod load(file_name)[source]

Load materials from a .json file.

Parameters

file_name (str) – Filename in the root directory.

Objects

Brick

class fdtd.Brick(x_min, y_min, z_min, x_max, y_max, z_max, material, name=None)[source]

Implement a brick object.

attach_to_grid()[source]

Attach the material of an object to the grid.

attach_to_grid_zero_thinkness()[source]

Attach the coeficients directly to the property grid.

plot_3d(ax, alpha=0.5)[source]

Plot a brick and attach to an axis.

Sphere

class fdtd.Sphere(x_center, y_center, z_center, radius, material, name=None)[source]

Implement a brick object.

attach_to_grid()[source]

Attach the material of an object to the grid.

plot_3d(ax, alpha=0.5)[source]

Plot a brick and attach to an axis.

Sources

Voltage Source

class fdtd.VoltageSource(x_min, y_min, z_min, x_max, y_max, z_max, resistance=50, waveform_type='unit_step', name=None, direction=<Direction.Z: 2>)[source]

Implement a voltage source.

attach_to_grid()[source]

Attach object to grid.

plot_3d(ax, alpha=0.5)[source]

Plot a brick and attach to an axis.

update_E()[source]

Update field.