tidy3d.plugins.design.MethodZip#
- class MethodZip[source]#
Bases:
MethodSampleSelect parameters in lock-step from their grid values.
- Parameters:
name (Optional[str] = None) – Optional name for the sweep method.
filter_func (Optional[Callable[..., bool]] = None) – Optional callback called as
filter_func(**sample)for each sampled parameter combination. ReturnTrueto keep the sample orFalseto skip it.at (Each parameter must produce the same number of grid values. The values)
sample (each index are combined into one)
Cartesian (rather than taking the)
values. (product of the parameter)
Example
>>> import tidy3d.plugins.design as tdd >>> method = tdd.MethodZip() >>> parameters = ( ... tdd.ParameterFloat(name="period", span=(0.3, 0.4), values=(0.3, 0.35, 0.4)), ... tdd.ParameterFloat(name="gap", span=(0.12, 0.18), values=(0.12, 0.15, 0.18)), ... ) >>> method.sample(parameters) [{'period': 0.3, 'gap': 0.12}, {'period': 0.35, 'gap': 0.15}, {'period': 0.4, 'gap': 0.18}]
Values can also be generated from
num_pointsandallowed_values.>>> parameters = ( ... tdd.ParameterFloat(name="width", span=(0.4, 0.6), num_points=3), ... tdd.ParameterAny(name="material", allowed_values=("Si", "SiN", "Ge")), ... ) >>> method.sample(parameters) [{'width': 0.4, 'material': 'Si'}, {'width': 0.5, 'material': 'SiN'}, {'width': 0.6, 'material': 'Ge'}]
Attributes
filter_funcnameMethods
sample(parameters)Define samples by pairing each parameter's grid values by index.