9. Python Interface API

This chapter provides a technical auto-generated summary of the NumBAT Python API.

The API consists of several core modules:

  • numbat, for creating the top-level NumBAT application;

  • materials, for defining waveguide materials and their properties;

  • objects, for constructing waveguides from materials;

  • mode_calcs, for the core calculation of electromagnetic and acoustic modes;

  • integration, for performing calculations relating to SBS gain;

  • plotting, for creating output plots of modes and gain functions.

9.1. numbat module

The numpy module contains the NumBATApp through which the bulk of the NumBAT API is accessed.

Creating a NumBATApp object is normally the first main step in a NumBAT script.

9.2. materials module

The materials module provides functions for specifying all relevant optical and elastic properties of waveguide materials.

The primary class is materials.Material however users will rarely use this class directly. Instead, we generally specify material properties by writing new .json files stored in the folder backend/materials_data. Materials are then loaded to build waveguide structures using the function materials.make_material().

9.3. objects module

The objects module provides functions for defining and constructing waveguides. The diagrams in Chapter 2 can be used to identify which parameters (slab_a_x, slab_c_y, material_d etc) correspond to each region.

9.4. mode_calcs module

The mode_calcs module is responsible for the core engine to construct and solve the optical and elastic finite-element problems.

9.5. integration module

The integration module is responsible for calculating gain and loss information from existing mode data.

9.6. plotting module

The plotting module is responsible for generating all standard graphs.