ModeWavelengthProvider Class

class plask.flow.ModeWavelengthProvider(data)

Provider of the wavelength (nm).

This class is used for wavelength provider in binary solvers. You can also create a custom provider for your Python solver.

Parameters:

data – provided value or callable returning it on request. The callable must accept the same arguments as the provider __call__ method (see below). It must also be able to give its length (i.e. have the __len__ method defined) that gives the number of different provided values.

To obtain the value from the provider simply call it. The call signature is as follows:

solver.outModeWavelength(n=0)
Parameters:

n (int) – Value number.

Returns:

Value of the wavelength (nm).

You may obtain the number of different values this provider can return by testing its length.

Example

Connect the provider to a receiver in some other solver:

>>> other_solver.inModeWavelength = solver.outModeWavelength

Obtain the provided value:

>>> solver.outModeWavelength(0)
1000

Test the number of provided values:

>>> len(solver.outModeWavelength)
3

See also

Receiver of wavelength: plask.flow.ModeWavelengthReceiver

Methods

__call__(...)

Get value from the provider.

set_changed()

Inform all connected receivers that the provided value has changed.

Descriptions

Method Details

ModeWavelengthProvider.__call__()
ModeWavelengthProvider.__call__(n)

Get value from the provider.

Parameters:

n (int) – Value number.

ModeWavelengthProvider.set_changed()

Inform all connected receivers that the provided value has changed.

The receivers will have its changed attribute set to True and solvers will call the provider again if they need its value (otherwise they might take it from the cache.