tidy3d.CustomChargePerturbation#

class CustomChargePerturbation[source]#

Bases: ChargePerturbation

Specifies parameter’s perturbation due to free carrier effects as a custom function of electron and hole densities defined as a two-dimensional array of perturbation values at sample electron and hole density points.

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().

  • electron_range (Optional[Tuple[NonNegativeFloat, NonNegativeFloat]] = None) – Range of electrons densities in which perturbation model is valid. For CustomChargePerturbation this field is computed automatically based on provided perturbation_values

  • hole_range (Optional[Tuple[NonNegativeFloat, NonNegativeFloat]] = None) – Range of holes densities in which perturbation model is valid. For CustomChargePerturbation this field is computed automatically based on provided perturbation_values

  • perturbation_values (ChargeDataArray) – 2D array (vs electron and hole densities) of sampled perturbation values.

  • interp_method (Literal['nearest', 'linear'] = linear) – Interpolation method to obtain perturbation values between sample points.

Notes

The linear interpolation is used to calculate perturbation values between sample points. For electron and hole density values outside of the provided sample region the perturbation value is extrapolated as a constant. The electron and hole density ranges, electron_range and hole_range, in which the perturbation model is assumed to be accurate is calculated automatically as the minimal and maximal density values provided in perturbation_values. Wherever is applied, Tidy3D will check that the parameter’s value does not go out of its physical bounds within electron_range x hole_range due to perturbations and raise a warning if this check fails. A warning is also issued if the perturbation model is evaluated outside of electron_range x hole_range.

Example

>>> from tidy3d import ChargeDataArray
>>> perturbation_data = ChargeDataArray(
...     [[0.001, 0.002, 0.004], [0.003, 0.002, 0.001]],
...     coords=dict(n=[2e15, 2e19], p=[1e16, 1e17, 1e18]),
... )
>>> charge_perturb = CustomChargePerturbation(
...     perturbation_values=perturbation_data,
... )

Attributes

is_complex

Whether perturbation is complex valued.

perturbation_range

Range of possible parameter perturbation values.

attrs

Methods

compute_eh_ranges(values)

Compute and set electron and hole density ranges based on provided perturbation_values.

sample(electron_density, hole_density)

Sample perturbation at electron and hole density points.

Inherited Common Usage

perturbation_values#
electron_range#
hole_range#
interp_method#
property perturbation_range#

Range of possible parameter perturbation values.

classmethod compute_eh_ranges(values)[source]#

Compute and set electron and hole density ranges based on provided perturbation_values.

sample(electron_density, hole_density)[source]#

Sample perturbation at electron and hole density points.

Parameters:

Note

Provided electron_density and hole_density must be of the same type and match shapes/coordinates, unless one of them is a scalar or both are 1d arrays, in which case values are broadcasted.

Returns:

property is_complex#

Whether perturbation is complex valued.

__hash__()#

Hash method.