tidy3d.web.api.container.BatchData#
- class BatchData[source]#
Bases:
Tidy3dBaseModel,MappingHolds a collection of
SimulationDatareturned byBatch.- Parameters:
task_paths (dict[str, str]) – Mapping of task_name to path to corresponding data for each task in batch.
task_ids (dict[str, str]) – Mapping of task_name to task_id for each task in batch.
verbose (bool = True) – Whether to print info messages and progressbars.
cached_tasks (Optional[dict[str, bool]] = None) – Whether the data of a task came from the cache.
lazy (bool = False) – Whether to load the actual data (lazy=False) or return a proxy that loads the data when accessed (lazy=True).
is_downloaded (Optional[bool] = False) – Whether the simulation data was downloaded before.
task_tree (Optional[BatchTaskTree] = None) – Optional nested mapping from container positions to flat batch task names.
Notes
When the batch is completed, the output is not a
SimulationDatabut rather aBatchData. For flat batches created fromdict[str, simulation], this behaves like the historical flat task-name mapping. For nested batches, indexing and iteration follow the original top-level container shape while flat task access remains available throughload_sim_data()andtask_items(). Converting nested results withdict(batch_results.items())eagerly touches all top-level entries and can load all results.See also
Batch:Interface for submitting several
Simulationobjects to sever.SimulationData:Stores data from a collection of
Monitorobjects in aSimulation.- Notebooks
Attributes
Methods
load([path_dir, replace_existing])Load
Batchfrom file, download results, and load them.load_sim_data(task_name)Load a simulation data object from file by task name.
Iterate over flat
(task_name, sim_data)pairs.Return an iterator over flat batch task names.
Iterate over flat simulation data values.
- task_paths#
- task_ids#
- verbose#
- cached_tasks#
- lazy#
- is_downloaded#
- task_tree#
- load_sim_data(task_name)[source]#
Load a simulation data object from file by task name.
When
config.batch_data_cache.enabledisTrueand the total size of all task files stays under the configured threshold, the loaded object is cached in memory for subsequent accesses.
- classmethod load(path_dir='.', replace_existing=False)[source]#
Load
Batchfrom file, download results, and load them.- Parameters:
path_dir (PathLike = './') – Base directory where data will be downloaded, by default current working directory. A batch.hdf5 file must be present in the directory.
replace_existing (bool = False) – Downloads the data even if path exists (overwriting the existing).
- Returns:
Returns a
BatchDatamapping. When initialized from a nested container,__getitem__also supports the original top-level dict keys and sequence indices.- Return type: