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:
  • 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.

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:
  • electron_density (Union[ArrayLike[float], SpatialDataArray]) – Electron density sample point(s).

  • hole_density (Union[ArrayLike[float], SpatialDataArray]) – Hole density sample point(s).

Note

Cannot provide a SpatialDataArray for one argument and a regular array (list, tuple, numpy.nd_array) for the other. Additionally, if both arguments are regular arrays they must be one-dimensional arrays.

Returns:

Sampled perturbation value(s).

Return type:

Union[ArrayLike[float], ArrayLike[Complex], SpatialDataArray]

property is_complex#

Whether perturbation is complex valued.

__hash__()#

Hash method.