tidy3d.DistributedGeneration#

class DistributedGeneration[source]#

Bases: Tidy3dBaseModel

Class that allows to add a distributed generation model.

Parameters:
  • attrs (dict = {}) – Dictionary storing arbitrary metadata for a Tidy3D object. This dictionary can be freely used by the user for storing data without affecting the operation of Tidy3D as it is not used internally. Note that, unlike regular Tidy3D fields, attrs are mutable. For example, the following is allowed for setting an attr obj.attrs['foo'] = bar. Also note that Tidy3D will raise a TypeError if attrs contain objects that can not be serialized. One can check if attrs are serializable by calling obj.json().

  • rate (SpatialDataArray) – [units = 1/(cm^3 s^1)]. Spatially varying generation rate.

Notes

The generation rate will be interpolated to the simulation mesh during the setup phase. In places where the generation rate is not defined, it will be filled with zeros.

Example

>>> import tidy3d as td
>>> import numpy as np
>>> x = [1,2]
>>> y = [2,3,4]
>>> z = [3,4,5,6]
>>> coords = dict(x=x, y=y, z=z)
>>> fd = td.SpatialDataArray(np.random.random((2,3,4)), coords=coords)
>>> dist_g = td.DistributedGeneration(rate=fd)

Attributes

Methods

check_spatialdataarray_dimensions(values)

Check that the SpatialDataArray is at least 2D:

from_rate_um3(gen_um3)

Creates a DistributedGeneration from a SpatialDataArray in um^-3 s^-1.

Inherited Common Usage

rate#
classmethod from_rate_um3(gen_um3)[source]#

Creates a DistributedGeneration from a SpatialDataArray in um^-3 s^-1.

classmethod check_spatialdataarray_dimensions(values)[source]#

Check that the SpatialDataArray is at least 2D:

__hash__()#

Hash method.