22
33import json
44import os
5- from typing import Optional
65
76from tidy3d .components .base import Tidy3dBaseModel
87from tidy3d .plugins .smatrix .component_modelers .modal import ModalComponentModeler
@@ -250,8 +249,6 @@ def compose_modeler_data_from_batch_data(
250249def create_batch (
251250 modeler : ComponentModelerType ,
252251 path_dir : str = DEFAULT_DATA_DIR ,
253- parent_batch_id : Optional [str ] = None ,
254- group_id : Optional [str ] = None ,
255252 file_name : str = "batch.hdf5" ,
256253 ** kwargs ,
257254) -> Batch :
@@ -279,33 +276,16 @@ def create_batch(
279276 """
280277 filepath = os .path .join (path_dir , file_name )
281278
282- if parent_batch_id is not None :
283- parent_task_dict = {}
284- for key in modeler .sim_dict .keys ():
285- parent_task_dict [key ] = (parent_batch_id ,)
286- else :
287- parent_task_dict = None
288-
289- if group_id is not None :
290- group_id_dict = {}
291- for key in modeler .sim_dict .keys ():
292- group_id_dict [key ] = (group_id ,)
293- else :
294- group_id_dict = None
295-
296279 batch = Batch (
297280 simulations = modeler .sim_dict ,
298- parent_tasks = parent_task_dict ,
299- group_ids = group_id_dict ,
300281 ** kwargs ,
301282 )
302283 batch .to_file (filepath )
303284 return batch
304285
305286
306287def run (
307- modeler : ComponentModelerType ,
308- path_dir : str = DEFAULT_DATA_DIR ,
288+ modeler : ComponentModelerType , path_dir : str = DEFAULT_DATA_DIR , ** kwargs
309289) -> ComponentModelerDataType :
310290 """Execute the full simulation workflow for a given component modeler.
311291
@@ -320,14 +300,16 @@ def run(
320300 The component modeler defining the simulations to be run.
321301 path_dir : str, optional
322302 The directory where the batch file will be saved. Defaults to ".".
303+ **kwargs
304+ Extra keyword arguments propagated to the Batch creation.
323305
324306 Returns
325307 -------
326308 ComponentModelerDataType
327309 An object containing the processed simulation data, ready for
328310 S-parameter extraction and analysis.
329311 """
330- batch = create_batch (modeler = modeler , path_dir = path_dir )
312+ batch = create_batch (modeler = modeler , path_dir = path_dir , ** kwargs )
331313 batch_data = batch .run ()
332314 modeler_data = compose_modeler_data_from_batch_data (modeler = modeler , batch_data = batch_data )
333315 return modeler_data
0 commit comments