Skip to content

Commit 37af42e

Browse files
dev configured right web
1 parent 99a2fb9 commit 37af42e

File tree

16 files changed

+73
-73
lines changed

16 files changed

+73
-73
lines changed

docs/notebooks

tidy3d/plugins/smatrix/run.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from tidy3d.plugins.smatrix.data.modal import ComponentModelerData, PortSimulationData
1111
from tidy3d.plugins.smatrix.data.terminal import TerminalComponentModelerData
1212
from tidy3d.plugins.smatrix.data.types import ComponentModelerDataType
13-
from tidy3d.web import Batch, BatchData
13+
from tidy3d.plugins.smatrix.web import Batch, BatchData
1414

1515
DEFAULT_DATA_DIR = "."
1616

tidy3d/plugins/smatrix/web/api/asynchronous.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from typing import Literal, Optional, Union
66

77
from tidy3d.log import log
8-
from tidy3d.web.core.types import PayType
8+
from tidy3d.plugins.smatrix.web.core.types import PayType
99

1010
from .container import DEFAULT_DATA_DIR, Batch, BatchData
1111
from .tidy3d_stub import SimulationType

tidy3d/plugins/smatrix/web/api/autograd/autograd.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@
2323
from tidy3d.components.autograd.derivative_utils import DerivativeInfo
2424
from tidy3d.components.data.data_array import DataArray
2525
from tidy3d.exceptions import AdjointError
26-
from tidy3d.web.api.asynchronous import DEFAULT_DATA_DIR
27-
from tidy3d.web.api.asynchronous import run_async as run_async_webapi
28-
from tidy3d.web.api.container import DEFAULT_DATA_PATH, Batch, BatchData, Job
29-
from tidy3d.web.api.tidy3d_stub import SimulationDataType, SimulationType
30-
from tidy3d.web.api.webapi import run as run_webapi
31-
from tidy3d.web.core.s3utils import download_file, upload_file
32-
from tidy3d.web.core.types import PayType
26+
from tidy3d.plugins.smatrix.web.api.asynchronous import DEFAULT_DATA_DIR
27+
from tidy3d.plugins.smatrix.web.api.asynchronous import run_async as run_async_webapi
28+
from tidy3d.plugins.smatrix.web.api.container import DEFAULT_DATA_PATH, Batch, BatchData, Job
29+
from tidy3d.plugins.smatrix.web.api.tidy3d_stub import SimulationDataType, SimulationType
30+
from tidy3d.plugins.smatrix.web.api.webapi import run as run_webapi
31+
from tidy3d.plugins.smatrix.web.core.s3utils import download_file, upload_file
32+
from tidy3d.plugins.smatrix.web.core.types import PayType
3333

3434
from .utils import E_to_D, FieldMap, TracerKeys, get_derivative_maps
3535

@@ -166,11 +166,11 @@ def run(
166166
167167
.. code-block:: python
168168
169-
sim_data = tidy3d.web.api.webapi.run(simulation, task_name='my_task', path='out/data.hdf5')
169+
sim_data = tidy3d.plugins.smatrix.web.api.webapi.run(simulation, task_name='my_task', path='out/data.hdf5')
170170
171-
The :meth:`tidy3d.web.api.webapi.run()` method shows the simulation progress by default. When uploading a
172-
simulation to the server without running it, you can use the :meth:`tidy3d.web.api.webapi.monitor`,
173-
:meth:`tidy3d.web.api.container.Job.monitor`, or :meth:`tidy3d.web.api.container.Batch.monitor` methods to
171+
The :meth:`tidy3d.plugins.smatrix.web.api.webapi.run()` method shows the simulation progress by default. When uploading a
172+
simulation to the server without running it, you can use the :meth:`tidy3d.plugins.smatrix.web.api.webapi.monitor`,
173+
:meth:`tidy3d.plugins.smatrix.web.api.container.Job.monitor`, or :meth:`tidy3d.plugins.smatrix.web.api.container.Batch.monitor` methods to
174174
display the progress of your simulation(s).
175175
176176
Examples
@@ -189,13 +189,13 @@ def run(
189189
See Also
190190
--------
191191
192-
:meth:`tidy3d.web.api.webapi.monitor`
192+
:meth:`tidy3d.plugins.smatrix.web.api.webapi.monitor`
193193
Print the real time task progress until completion.
194194
195-
:meth:`tidy3d.web.api.container.Job.monitor`
195+
:meth:`tidy3d.plugins.smatrix.web.api.container.Job.monitor`
196196
Monitor progress of running :class:`Job`.
197197
198-
:meth:`tidy3d.web.api.container.Batch.monitor`
198+
:meth:`tidy3d.plugins.smatrix.web.api.container.Batch.monitor`
199199
Monitor progress of each of the running tasks.
200200
"""
201201
if priority is not None and (priority < 1 or priority > 10):
@@ -945,7 +945,7 @@ def setup_adj(
945945

946946
import matplotlib.pylab as plt
947947

948-
import tidy3d.web as web
948+
import tidy3d.plugins.smatrix.web as web
949949

950950
sim_data_new = web.run(
951951
sims_adj[0].updated_copy(monitors=[adj_fld_mnt]),

tidy3d/plugins/smatrix/web/api/container.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818
from tidy3d.components.types import annotate_type
1919
from tidy3d.exceptions import DataError
2020
from tidy3d.log import get_logging_console, log
21-
from tidy3d.web.api import webapi as web
22-
from tidy3d.web.core.constants import TaskId, TaskName
23-
from tidy3d.web.core.task_core import Folder
24-
from tidy3d.web.core.task_info import RunInfo, TaskInfo
25-
from tidy3d.web.core.types import PayType
21+
from tidy3d.plugins.smatrix.web.api import webapi as web
22+
from tidy3d.plugins.smatrix.web.core.constants import TaskId, TaskName
23+
from tidy3d.plugins.smatrix.web.core.task_core import Folder
24+
from tidy3d.plugins.smatrix.web.core.task_info import RunInfo, TaskInfo
25+
from tidy3d.plugins.smatrix.web.core.types import PayType
2626

2727
from .tidy3d_stub import SimulationDataType, SimulationType
2828

@@ -80,29 +80,29 @@ class Job(WebContainer):
8080
Examples
8181
--------
8282
83-
Once you've created a ``job`` object using :class:`tidy3d.web.api.container.Job`, you can upload it to our servers with:
83+
Once you've created a ``job`` object using :class:`tidy3d.plugins.smatrix.web.api.container.Job`, you can upload it to our servers with:
8484
8585
.. code-block:: python
8686
87-
tidy3d.web.upload(simulation, task_name="task_name", verbose=verbose)`
87+
tidy3d.plugins.smatrix.web.upload(simulation, task_name="task_name", verbose=verbose)`
8888
8989
It will not run until you explicitly tell it to do so with:
9090
9191
.. code-block:: python
9292
93-
tidy3d.web.api.webapi.start(job.task_id)
93+
tidy3d.plugins.smatrix.web.api.webapi.start(job.task_id)
9494
9595
To monitor the simulation's progress and wait for its completion, use
9696
9797
.. code-block:: python
9898
99-
tidy3d.web.api.webapi.monitor(job.task_id, verbose=verbose)
99+
tidy3d.plugins.smatrix.web.api.webapi.monitor(job.task_id, verbose=verbose)
100100
101101
After running the simulation, you can load the results using for example:
102102
103103
.. code-block:: python
104104
105-
sim_data = tidy3d.web.api.webapi.load(job.task_id, path="out/simulation.hdf5", verbose=verbose)
105+
sim_data = tidy3d.plugins.smatrix.web.api.webapi.load(job.task_id, path="out/simulation.hdf5", verbose=verbose)
106106
107107
The job container has a convenient method to save and load the results of a job that has already finished,
108108
without needing to know the task_id, as below:
@@ -115,7 +115,7 @@ class Job(WebContainer):
115115
# You can exit the session, break here, or continue in new session.
116116
117117
# Load the job metadata from file.
118-
job_loaded = tidy3d.web.api.container.Job.from_file("data/job.json")
118+
job_loaded = tidy3d.plugins.smatrix.web.api.container.Job.from_file("data/job.json")
119119
120120
# Download the data from the server and load it into a SimulationData object.
121121
sim_data = job_loaded.load(path="data/sim.hdf5")
@@ -124,7 +124,7 @@ class Job(WebContainer):
124124
See Also
125125
--------
126126
127-
:meth:`tidy3d.web.api.webapi.run_async`
127+
:meth:`tidy3d.plugins.smatrix.web.api.webapi.run_async`
128128
Submits a set of :class:`.Simulation` objects to server, starts running, monitors progress,
129129
downloads, and loads results as a :class:`.BatchData` object.
130130
@@ -494,7 +494,7 @@ class Batch(WebContainer):
494494
See Also
495495
--------
496496
497-
:meth:`tidy3d.web.api.webapi.run_async`
497+
:meth:`tidy3d.plugins.smatrix.web.api.webapi.run_async`
498498
Submits a set of :class:`.Simulation` objects to server, starts running, monitors progress,
499499
downloads, and loads results as a :class:`.BatchData` object.
500500
@@ -600,7 +600,7 @@ def run(self, path_dir: str = DEFAULT_DATA_DIR) -> BatchData:
600600
----
601601
A typical usage might look like:
602602
603-
>>> from tidy3d.web.api.container import Batch
603+
>>> from tidy3d.plugins.smatrix.web.api.container import Batch
604604
>>> custom_batch = Batch()
605605
>>> batch_data = custom_batch.run() # doctest: +SKIP
606606
>>> for task_name, sim_data in batch_data.items(): # doctest: +SKIP

tidy3d/plugins/smatrix/web/api/material_fitter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
from pydantic.v1 import BaseModel, Field
1414

1515
from tidy3d.plugins.dispersion import DispersionFitter
16-
from tidy3d.web.core.http_util import http
17-
from tidy3d.web.core.types import Submittable
16+
from tidy3d.plugins.smatrix.web.core.http_util import http
17+
from tidy3d.plugins.smatrix.web.core.types import Submittable
1818

1919

2020
class ConstraintEnum(str, Enum):

tidy3d/plugins/smatrix/web/api/material_libray.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
from pydantic.v1 import Field, parse_obj_as, validator
1010

1111
from tidy3d.components.medium import MediumType
12-
from tidy3d.web.core.http_util import http
13-
from tidy3d.web.core.types import Queryable
12+
from tidy3d.plugins.smatrix.web.core.http_util import http
13+
from tidy3d.plugins.smatrix.web.core.types import Queryable
1414

1515

1616
class MaterialLibray(Queryable, smart_union=True):

tidy3d/plugins/smatrix/web/api/mode.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@
2222
from tidy3d.log import get_logging_console, log
2323
from tidy3d.plugins.mode.mode_solver import MODE_MONITOR_NAME, ModeSolver
2424
from tidy3d.version import __version__
25-
from tidy3d.web.core.core_config import get_logger_console
26-
from tidy3d.web.core.environment import Env
27-
from tidy3d.web.core.http_util import http
28-
from tidy3d.web.core.s3utils import download_file, download_gz_file, upload_file
29-
from tidy3d.web.core.task_core import Folder
30-
from tidy3d.web.core.types import PayType, ResourceLifecycle, Submittable
25+
from tidy3d.plugins.smatrix.web.core.core_config import get_logger_console
26+
from tidy3d.plugins.smatrix.web.core.environment import Env
27+
from tidy3d.plugins.smatrix.web.core.http_util import http
28+
from tidy3d.plugins.smatrix.web.core.s3utils import download_file, download_gz_file, upload_file
29+
from tidy3d.plugins.smatrix.web.core.task_core import Folder
30+
from tidy3d.plugins.smatrix.web.core.types import PayType, ResourceLifecycle, Submittable
3131

3232
SIMULATION_JSON = "simulation.json"
3333
SIM_FILE_HDF5_GZ = "simulation.hdf5.gz"

tidy3d/plugins/smatrix/web/api/tidy3d_stub.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@
3232
TerminalComponentModeler,
3333
TerminalComponentModelerData,
3434
)
35-
from tidy3d.web.core.file_util import (
35+
from tidy3d.plugins.smatrix.web.core.file_util import (
3636
read_simulation_from_hdf5,
3737
read_simulation_from_hdf5_gz,
3838
read_simulation_from_json,
3939
)
40-
from tidy3d.web.core.stub import TaskStub, TaskStubData
41-
from tidy3d.web.core.types import TaskType
40+
from tidy3d.plugins.smatrix.web.core.stub import TaskStub, TaskStubData
41+
from tidy3d.plugins.smatrix.web.core.types import TaskType
4242

4343
SimulationType = Union[
4444
Simulation,

tidy3d/plugins/smatrix/web/api/webapi.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,19 @@
1616
from tidy3d.components.mode.simulation import ModeSimulation
1717
from tidy3d.exceptions import WebError
1818
from tidy3d.log import get_logging_console, log
19-
from tidy3d.web.core.account import Account
20-
from tidy3d.web.core.constants import (
19+
from tidy3d.plugins.smatrix.web.core.account import Account
20+
from tidy3d.plugins.smatrix.web.core.constants import (
2121
MODE_DATA_HDF5_GZ,
2222
MODE_FILE_HDF5_GZ,
2323
SIM_FILE_HDF5,
2424
SIM_FILE_HDF5_GZ,
2525
SIMULATION_DATA_HDF5_GZ,
2626
TaskId,
2727
)
28-
from tidy3d.web.core.environment import Env
29-
from tidy3d.web.core.task_core import Folder, SimulationTask
30-
from tidy3d.web.core.task_info import ChargeType, TaskInfo
31-
from tidy3d.web.core.types import PayType
28+
from tidy3d.plugins.smatrix.web.core.environment import Env
29+
from tidy3d.plugins.smatrix.web.core.task_core import Folder, SimulationTask
30+
from tidy3d.plugins.smatrix.web.core.task_info import ChargeType, TaskInfo
31+
from tidy3d.plugins.smatrix.web.core.types import PayType
3232

3333
from .connect_util import REFRESH_TIME, get_grid_points_str, get_time_steps_str, wait_for_connection
3434
from .tidy3d_stub import SimulationDataType, SimulationType, Tidy3dStub, Tidy3dStubData
@@ -132,11 +132,11 @@ def run(
132132
133133
.. code-block:: python
134134
135-
sim_data = tidy3d.web.api.webapi.run(simulation, task_name='my_task', path='out/data.hdf5')
135+
sim_data = tidy3d.plugins.smatrix.web.api.webapi.run(simulation, task_name='my_task', path='out/data.hdf5')
136136
137-
The :meth:`tidy3d.web.api.webapi.run()` method shows the simulation progress by default. When uploading a
138-
simulation to the server without running it, you can use the :meth:`tidy3d.web.api.webapi.monitor`,
139-
:meth:`tidy3d.web.api.container.Job.monitor`, or :meth:`tidy3d.web.api.container.Batch.monitor` methods to
137+
The :meth:`tidy3d.plugins.smatrix.web.api.webapi.run()` method shows the simulation progress by default. When uploading a
138+
simulation to the server without running it, you can use the :meth:`tidy3d.plugins.smatrix.web.api.webapi.monitor`,
139+
:meth:`tidy3d.plugins.smatrix.web.api.container.Job.monitor`, or :meth:`tidy3d.plugins.smatrix.web.api.container.Batch.monitor` methods to
140140
display the progress of your simulation(s).
141141
142142
Examples
@@ -155,13 +155,13 @@ def run(
155155
See Also
156156
--------
157157
158-
:meth:`tidy3d.web.api.webapi.monitor`
158+
:meth:`tidy3d.plugins.smatrix.web.api.webapi.monitor`
159159
Print the real time task progress until completion.
160160
161-
:meth:`tidy3d.web.api.container.Job.monitor`
161+
:meth:`tidy3d.plugins.smatrix.web.api.container.Job.monitor`
162162
Monitor progress of running :class:`Job`.
163163
164-
:meth:`tidy3d.web.api.container.Batch.monitor`
164+
:meth:`tidy3d.plugins.smatrix.web.api.container.Batch.monitor`
165165
Monitor progress of each of the running tasks.
166166
"""
167167
task_id = upload(
@@ -244,13 +244,13 @@ def upload(
244244
Notes
245245
-----
246246
247-
Once you've created a ``job`` object using :class:`tidy3d.web.api.container.Job`, you can upload it to our servers with:
247+
Once you've created a ``job`` object using :class:`tidy3d.plugins.smatrix.web.api.container.Job`, you can upload it to our servers with:
248248
249249
.. code-block:: python
250250
251251
web.upload(simulation, task_name="task_name", verbose=verbose)
252252
253-
It will not run until you explicitly tell it to do so with :meth:`tidy3d.web.api.webapi.start`.
253+
It will not run until you explicitly tell it to do so with :meth:`tidy3d.plugins.smatrix.web.api.webapi.start`.
254254
255255
"""
256256

@@ -473,7 +473,7 @@ def monitor(task_id: TaskId, verbose: bool = True) -> None:
473473
474474
.. code-block:: python
475475
476-
tidy3d.web.api.webapi.monitor(job.task_id, verbose=verbose).
476+
tidy3d.plugins.smatrix.web.api.webapi.monitor(job.task_id, verbose=verbose).
477477
478478
Parameters
479479
----------
@@ -797,7 +797,7 @@ def load(
797797
798798
sim_data = web.load(task_id, path="outt/sim.hdf5", verbose=verbose)
799799
800-
The :meth:`tidy3d.web.api.webapi.load` method is very convenient to load and postprocess results from simulations
800+
The :meth:`tidy3d.plugins.smatrix.web.api.webapi.load` method is very convenient to load and postprocess results from simulations
801801
created using Tidy3D GUI.
802802
803803
Parameters
@@ -1043,7 +1043,7 @@ def real_cost(task_id: str, verbose=True) -> float:
10431043
Examples
10441044
--------
10451045
1046-
To obtain the cost of a simulation, you can use the function ``tidy3d.web.real_cost(task_id)``. In the example
1046+
To obtain the cost of a simulation, you can use the function ``tidy3d.plugins.smatrix.web.real_cost(task_id)``. In the example
10471047
below, a job is created, and its cost is estimated. After running the simulation, the real cost can be obtained.
10481048
10491049
.. code-block:: python

0 commit comments

Comments
 (0)