Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type hinting #2176

Merged
merged 2 commits into from
Jul 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion python/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
except ImportError:
from collections.abc import Sequence

import meep.visualization as vis
import numpy as np
from meep.geom import GeometricObject, Medium, Vector3, init_do_averaging
from meep.source import (
Expand Down Expand Up @@ -4680,6 +4679,8 @@ def plot2D(
- `post_process=np.real`: post processing function to apply to fields (must be
a function object)
"""
import meep.visualization as vis

return vis.plot2D(
self,
ax=ax,
Expand All @@ -4700,13 +4701,17 @@ def plot2D(
)

def plot_fields(self, **kwargs):
import meep.visualization as vis

return vis.plot_fields(self, **kwargs)

def plot3D(self):
"""
Uses Mayavi to render a 3D simulation domain. The simulation object must be 3D.
Can also be embedded in Jupyter notebooks.
"""
import meep.visualization as vis

return vis.plot3D(self)

def visualize_chunks(self):
Expand All @@ -4715,6 +4720,8 @@ def visualize_chunks(self):
rectangular region is a chunk, and each color represents a different processor.
Requires [matplotlib](https://matplotlib.org).
"""
import meep.visualization as vis

vis.visualize_chunks(self)


Expand Down
Loading