tidy3d.CustomChargePerturbation#
- class CustomChargePerturbation[source]#
Bases:
ChargePerturbationSpecifies 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,
attrsare mutable. For example, the following is allowed for setting anattrobj.attrs['foo'] = bar. Also note that Tidy3D` will raise aTypeErrorifattrscontain objects that can not be serialized. One can check ifattrsare serializable by callingobj.json().electron_range (Optional[Tuple[NonNegativeFloat, NonNegativeFloat]] = None) – Range of electrons densities in which perturbation model is valid. For
CustomChargePerturbationthis field is computed automatically based on providedperturbation_valueshole_range (Optional[Tuple[NonNegativeFloat, NonNegativeFloat]] = None) – Range of holes densities in which perturbation model is valid. For
CustomChargePerturbationthis field is computed automatically based on providedperturbation_valuesperturbation_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_rangeandhole_range, in which the perturbation model is assumed to be accurate is calculated automatically as the minimal and maximal density values provided inperturbation_values. Wherever is applied, Tidy3D will check that the parameter’s value does not go out of its physical bounds withinelectron_rangexhole_rangedue to perturbations and raise a warning if this check fails. A warning is also issued if the perturbation model is evaluated outside ofelectron_rangexhole_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
Whether perturbation is complex valued.
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,TriangularGridDataset,TetrahedralGridDataset,
] Electron density sample point(s).
hole_density (Union[) –
- ArrayLike[float],
SpatialDataArray,TriangularGridDataset,TetrahedralGridDataset,
] Hole density sample point(s).
Note
Provided
electron_densityandhole_densitymust 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:
Union[ – ArrayLike[float], ArrayLike[complex],
SpatialDataArray,TriangularGridDataset,TetrahedralGridDataset,] – Sampled perturbation value(s).
- property is_complex#
Whether perturbation is complex valued.
- __hash__()#
Hash method.