Skip to content

Commit

Permalink
add type hints for MaterialGrid class (#2395)
Browse files Browse the repository at this point in the history
  • Loading branch information
oskooi committed Feb 9, 2023
1 parent 3eb4026 commit 395d821
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions python/geom.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from typing import Union, Tuple
import functools
import math
import numbers
Expand All @@ -6,9 +7,7 @@
from collections import namedtuple
from copy import deepcopy
from numbers import Number

import numpy as np

import meep as mp

FreqRange = namedtuple("FreqRange", ["min", "max"])
Expand Down Expand Up @@ -587,15 +586,15 @@ def check_weights(self, w):

def __init__(
self,
grid_size,
medium1,
medium2,
weights=None,
grid_type="U_DEFAULT",
do_averaging=True,
beta=0,
eta=0.5,
damping=0,
grid_size: Union[Vector3, Tuple[float, ...]],
medium1: Medium,
medium2: Medium,
weights: np.ndarray = None,
grid_type: str = "U_DEFAULT",
do_averaging: bool = True,
beta: float = 0,
eta: float = 0.5,
damping: float = 0,
):
"""
Creates a `MaterialGrid` object.
Expand Down Expand Up @@ -691,7 +690,7 @@ def isclose(a, b, rel_tol=1e-09, abs_tol=0.0):

self.swigobj = None

def update_weights(self, x):
def update_weights(self, x: np.ndarray):
"""
Reset the `weights` to `x`.
"""
Expand Down

0 comments on commit 395d821

Please sign in to comment.