# PLaSK User Manual

#### Page Contents

- `plask.util.gradients`
  - Functions
  - Descriptions
    - Function Details
      - `simplify()`
      - `simplify_all()`

# `plask.util.gradients`

Gradients simplification.

This module contain functions to simplify gradient layers for optical calculations. Each such layer is replaced with two uniform layers providing the same transfer matrix. Using such simplified gradients for optical computations strongly improves the accuracy and speed of optical computations.

For details see: M. Wasiak, M. Dobrski…

## Functions

`simplify`(item, lam[, T, linear, dT]) | Return stack of two layers providing the same optical parameters as the gradient layer.
`simplify_all`(geometry, lam[, T, linear, dT]) | Replace all rectangular blocks with gradients with two-layer simplification in geometry tree.

## Descriptions

### Function Details

plask.util.gradients.simplify(item, lam, T=300.0, linear='nr', dT=100.0)

  Return stack of two layers providing the same optical parameters as the gradient layer.

  Parameters:

    - item (Rectangle or Cuboid) – object to simplify

    - lam (float) – reference wavelength

    - T (float) – temperature for the refractive indices

    - linear ('nr' or 'eps') – which parameter should be linear

    - dT (float) – temperature step for estimation of temperature dependence of refractive index

  Returns:

    an object replacing the original leaf

  Return type:

    GeometryObject

plask.util.gradients.simplify_all(geometry, lam, T=300.0, linear='nr', dT=100.0)

  Replace all rectangular blocks with gradients with two-layer simplification in geometry tree.

  Parameters:

    - geometry (GeometryObject) – object to simplify

    - lam (float) – reference wavelength

    - T (float) – temperature for the refractive indices

    - linear ('nr' or 'eps') – which parameter should be linear

    - dT (float) – temperature step for estimation of temperature dependence of refractive index

  Returns:

    geometry with simplified gradients

  Return type:

    GeometryObject