Skip to content

Commit 3fba55a

Browse files
Changes for now
1 parent 56a45b1 commit 3fba55a

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

tidy3d/plugins/smatrix/component_modelers/base.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,6 @@ def batch(self) -> Batch:
186186
callback_url=self.callback_url,
187187
verbose=self.verbose,
188188
solver_version=self.solver_version,
189-
simulation_type="microwave",
190189
)
191190

192191
@cached_property

tidy3d/plugins/smatrix/component_modelers/terminal.py

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from __future__ import annotations
44

5+
import os
56
from typing import Optional, Union
67

78
import numpy as np
@@ -26,7 +27,7 @@
2627
from tidy3d.plugins.smatrix.ports.coaxial_lumped import CoaxialLumpedPort
2728
from tidy3d.plugins.smatrix.ports.rectangular_lumped import LumpedPort
2829
from tidy3d.plugins.smatrix.ports.wave import WavePort
29-
from tidy3d.web.api.container import BatchData
30+
from tidy3d.web.api.container import Batch, BatchData
3031

3132
from .base import AbstractComponentModeler, TerminalPortType
3233

@@ -657,3 +658,25 @@ def get_antenna_metrics_data(
657658
return AntennaMetricsData.from_directivity_data(
658659
combined_directivity_data, power_incident, power_reflected
659660
)
661+
662+
@cached_property
663+
def batch(self) -> Batch:
664+
""":class:`.Batch` associated with this component modeler."""
665+
666+
if self.batch_cached is not None:
667+
return self.batch_cached
668+
669+
# first try loading the batch from file, if it exists
670+
batch_path = self._batch_path
671+
672+
if os.path.exists(batch_path):
673+
return Batch.from_file(fname=batch_path)
674+
675+
return Batch(
676+
simulations=self.sim_dict,
677+
folder_name=self.folder_name,
678+
callback_url=self.callback_url,
679+
verbose=self.verbose,
680+
solver_version=self.solver_version,
681+
simulation_type="microwave",
682+
)

0 commit comments

Comments
 (0)