|
2 | 2 |
|
3 | 3 | from __future__ import annotations
|
4 | 4 |
|
| 5 | +import os |
5 | 6 | from typing import Optional, Union
|
6 | 7 |
|
7 | 8 | import numpy as np
|
@@ -430,27 +431,27 @@ def compute_port_VI(
|
430 | 431 |
|
431 | 432 | return compute_port_VI(port_out=port_out, sim_data=sim_data)
|
432 | 433 |
|
433 |
| - # @cached_property |
434 |
| - # def _terminal_modeler_path(self) -> str: |
435 |
| - # """Where we store the for this :class:`TerminalComponentModeler` instance after the run.""" |
436 |
| - # return os.path.join(self.path_dir, "tcp_" + str(hash(self)) + ".hdf5") |
437 |
| - # |
438 |
| - # def _upload_terminal_modeler(self): |
439 |
| - # # TODO properly refactor, plugins data types should not have web methods. |
440 |
| - # from tidy3d.web.api.container import Job |
441 |
| - # |
442 |
| - # # first try loading the terminal_component_modeler from file, if it exists |
443 |
| - # terminal_modeler_path = self._terminal_modeler_path |
444 |
| - # |
445 |
| - # if os.path.exists(terminal_modeler_path): |
446 |
| - # return Job.from_file(fname=terminal_modeler_path) |
447 |
| - # |
448 |
| - # return Job( |
449 |
| - # simulation=self, |
450 |
| - # task_name=self.name, |
451 |
| - # folder_name=self.folder_name, |
452 |
| - # callback_url=self.callback_url, |
453 |
| - # verbose=self.verbose, |
454 |
| - # solver_version=self.solver_version, |
455 |
| - # simulation_type="microwave", |
456 |
| - # ) |
| 434 | + @cached_property |
| 435 | + def _terminal_modeler_path(self) -> str: |
| 436 | + """Where we store the for this :class:`TerminalComponentModeler` instance after the run.""" |
| 437 | + return os.path.join(self.path_dir, "tcp_" + str(hash(self)) + ".hdf5") |
| 438 | + |
| 439 | + def _upload_terminal_modeler(self): |
| 440 | + # TODO properly refactor, plugins data types should not have web methods. |
| 441 | + from tidy3d.web.api.container import Job |
| 442 | + |
| 443 | + # first try loading the terminal_component_modeler from file, if it exists |
| 444 | + terminal_modeler_path = self._terminal_modeler_path |
| 445 | + |
| 446 | + if os.path.exists(terminal_modeler_path): |
| 447 | + return Job.from_file(fname=terminal_modeler_path) |
| 448 | + |
| 449 | + return Job( |
| 450 | + simulation=self, |
| 451 | + task_name=self.name, |
| 452 | + folder_name=self.folder_name, |
| 453 | + callback_url=self.callback_url, |
| 454 | + verbose=self.verbose, |
| 455 | + solver_version=self.solver_version, |
| 456 | + simulation_type="microwave", |
| 457 | + ) |
0 commit comments