From ce246eda78488dec3acdcb16e926d3f8714d73a6 Mon Sep 17 00:00:00 2001 From: momchil Date: Mon, 31 Jan 2022 12:14:32 -0800 Subject: [PATCH] Setting 'visualize' status directly to 'success' --- tidy3d/components/data.py | 5 +++-- tidy3d/components/mode.py | 2 +- tidy3d/components/simulation.py | 3 ++- tidy3d/web/container.py | 4 ++++ tidy3d/web/webapi.py | 2 ++ 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/tidy3d/components/data.py b/tidy3d/components/data.py index c65845bb8..58b4b894f 100644 --- a/tidy3d/components/data.py +++ b/tidy3d/components/data.py @@ -848,7 +848,8 @@ def at_centers(self, field_monitor_name: str) -> xr.Dataset: @equal_aspect @add_ax_if_none - def plot_field( # pylint:disable=too-many-arguments, too-many-locals, too-many-branches + # pylint:disable=too-many-arguments, too-many-locals, too-many-branches, too-many-statements + def plot_field( self, field_monitor_name: str, field_name: str, @@ -956,7 +957,7 @@ def plot_field( # pylint:disable=too-many-arguments, too-many-locals, too-many- elif val == "abs": field_data = abs(field_data) - if val=="abs" or field_name=="int": + if val == "abs" or field_name == "int": cmap = "magma" else: cmap = "RdBu" diff --git a/tidy3d/components/mode.py b/tidy3d/components/mode.py index db0c16f9b..8529cfa0e 100644 --- a/tidy3d/components/mode.py +++ b/tidy3d/components/mode.py @@ -56,7 +56,7 @@ class ModeSpec(Tidy3dBaseModel): description="Index into the first two non-propagating axes defining the normal to the " "plane in which the bend lies. This must be provided if ``bend_radius`` is not ``None``. " "For example, for a ring in the global xy-plane, and a mode plane in either the xz or the " - "yz plane, the ``bend_axis`` is always 1 (the global z axis)." + "yz plane, the ``bend_axis`` is always 1 (the global z axis).", ) @pd.validator("bend_axis", always=True) diff --git a/tidy3d/components/simulation.py b/tidy3d/components/simulation.py index 3d1aa4736..5dcc5457d 100644 --- a/tidy3d/components/simulation.py +++ b/tidy3d/components/simulation.py @@ -6,10 +6,11 @@ import numpy as np import xarray as xr import matplotlib.pylab as plt + try: import matplotlib as mpl from mpl_toolkits.axes_grid1 import make_axes_locatable -except Exception: # pylint: disable=broad-except +except Exception: # pylint: disable=broad-except print("Could not import matplotlib!") from descartes import PolygonPatch diff --git a/tidy3d/web/container.py b/tidy3d/web/container.py index 169e32da4..2dc546705 100644 --- a/tidy3d/web/container.py +++ b/tidy3d/web/container.py @@ -138,6 +138,8 @@ def monitor(self) -> None: while status not in ("success", "error", "diverged", "deleted", "draft"): new_status = self.status + if new_status == "visualize": + new_status = "success" if new_status != status: console.log(f"status = {new_status}") status = new_status @@ -324,6 +326,8 @@ def pbar_description(task_name: str, status: str) -> str: for status_index, (task_name, job) in enumerate(self.jobs.items()): current_status = statuses[status_index] new_status = job.status + if new_status == "visualize": + new_status = "success" if new_status != current_status: completed = run_statuses.index(new_status) pbar = pbar_tasks[task_name] diff --git a/tidy3d/web/webapi.py b/tidy3d/web/webapi.py index 5ffd47725..221cb1d6d 100644 --- a/tidy3d/web/webapi.py +++ b/tidy3d/web/webapi.py @@ -196,6 +196,8 @@ def monitor(task_id: TaskId) -> None: while status not in ("success", "error", "diverged", "deleted", "draft"): new_status = get_info(task_id).status + if new_status == "visualize": + new_status = "success" if new_status != status: console.log(f"status = {new_status}") status = new_status