tidy3d.SimulationMap#
- class SimulationMap[source]#
Bases:
ValueMap,Mapping[str,Simulation|HeatChargeSimulation|HeatSimulation|EMESimulation|ModeSolver|ModeSimulation|VolumeMesher]An immutable dictionary-like container for simulations.
- Parameters:
keys_tuple (tuple[str, ...]) – A tuple of unique string identifiers for each simulation.
values_tuple (tuple[Union[
Simulation,HeatChargeSimulation,HeatSimulation,EMESimulation,ModeSolver,ModeSimulation,VolumeMesher], …]) – A tuple of Simulation objects, each corresponding to a key at the same index.
Notes
This class maps unique string keys to corresponding Simulation objects. By inheriting from collections.abc.Mapping, it provides standard dictionary behaviors like item access (sims[“sim_A”]), iteration (for name in sims), and length checking (len(sims)).
It automatically validates that the keys and values tuples have matching lengths upon instantiation.
- values#
A tuple of Simulation objects, each corresponding to a key at the same index.
- Type:
tuple[SimulationType, …]
Example
>>> from tidy3d import ( ... Simulation, ... SimulationMap, ... Structure, ... Box, ... Medium, ... UniformCurrentSource, ... GaussianPulse, ... FieldMonitor, ... GridSpec, ... BoundarySpec, ... PML, ... ) >>> # Simple minimal simulation >>> sim1 = Simulation( ... size=(4, 3, 3), ... grid_spec=GridSpec.auto(min_steps_per_wvl=25), ... structures=[ ... Structure( ... geometry=Box(size=(1, 1, 1), center=(0, 0, 0)), ... medium=Medium(permittivity=2.0), ... ), ... ], ... sources=[ ... UniformCurrentSource( ... size=(0, 0, 0), ... center=(0, 0.5, 0), ... polarization="Hx", ... source_time=GaussianPulse(freq0=2e14, fwidth=4e13), ... current_amplitude_definition="total", ... ) ... ], ... monitors=[ ... FieldMonitor( ... size=(1, 1, 0), ... center=(0, 0, 0), ... freqs=[2e14], ... name='field' ... ), ... ], ... run_time=1e-12, ... boundary_spec=BoundarySpec.all_sides(boundary=PML()), ... ) >>> sim2 = sim1.updated_copy(run_time=2e-12) >>> >>> # Instantiate the map >>> simulation_map = SimulationMap( ... keys=("sim_1", "sim_2"), ... values=(sim1, sim2), ... ) >>> >>> # Access a simulation like a dictionary >>> # print(simulation_map["sim_1"])
Attributes
Inherited Common Usage
- keys_tuple#
- values_tuple#