Skip to content

Tidy3DAutogradConfig

Tidy3DAutogradConfig(**data: 'Any') -> 'None'

Configuration for Tidy3D-specific autograd finite-difference behavior.

Args

  • gradient_method: Literal[‘geometry’, ‘permittivity’, ‘auto’] = auto
  • exclude_domain_spanning_structures: bool = True
  • relative_diff_step: Union[float, dict[str, float]] = 0.01
  • absolute_diff_step: Union[float, dict[str, float]] = 1e-06
  • diff_step_growth_factor: float = 2.0
  • max_diff_attempts: int = 8
  • min_jacobian_norm: float = 1e-12
  • consistency_similarity_threshold: float = 0.9
  • consistency_magnitude_tolerance: float = 0.2

gradient_method="auto" prefers geometry Jacobian routing for each (parameter, structure) pair when that Jacobian entry has signal, and falls back to permittivity routing otherwise. If geometry finite differences report an issue for one parameter row, auto mode falls back to permittivity for that whole parameter row. gradient_method="geometry" maps Tidy3D geometry derivatives through finite-difference geometry Jacobians. "permittivity" maps medium permittivity derivatives through finite-difference epsilon sensitivities.

MethodDescription
absolute_diff_step_forReturn absolute finite-difference step for one flattened parameter.
model_post_initThis function is meant to behave like a BaseModel method to initialize private attributes.
relative_diff_step_forReturn relative finite-difference step for one flattened parameter.
validate_step_keysReject typo keys that do not match traced parameter names.

absolute_diff_step_for(self, param_name: 'str') -> 'float'

Return absolute finite-difference step for one flattened parameter.

model_post_init(self: 'BaseModel', context: 'Any', /) -> 'None'

This function is meant to behave like a BaseModel method to initialize private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Args

  • self: The BaseModel instance.
  • context: The context.

relative_diff_step_for(self, param_name: 'str') -> 'float'

Return relative finite-difference step for one flattened parameter.

validate_step_keys(self, param_names: 'Sequence[str]') -> 'None'

Reject typo keys that do not match traced parameter names.

AttributeDescription
DEFAULT_ABSOLUTE_DIFF_STEPConvert a string or number to a floating-point number, if possible.
DEFAULT_RELATIVE_DIFF_STEPConvert a string or number to a floating-point number, if possible.
model_configdict() -> new empty dictionary

Convert a string or number to a floating-point number, if possible.

Convert a string or number to a floating-point number, if possible.

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object’s (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)