Skip to content

Commit

Permalink
fix union bug
Browse files Browse the repository at this point in the history
  • Loading branch information
tylerflex committed May 24, 2024
1 parent 4ae46b7 commit b8c96f2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions tidy3d/web/api/autograd/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ def E_to_D(fld_data: td.FieldData, eps_data: td.PermittivityData) -> td.FieldDat


def multiply_field_data(
fld_1: td.FieldData, fld_2: td.FieldData | td.PermittivityData
fld_1: td.FieldData, fld_2: typing.Union[td.FieldData, td.PermittivityData]
) -> td.FieldData:
"""Elementwise multiply two field data objects, writes data into ``fld_1`` copy."""

def get_field_key(dim: str, fld_data: td.FieldData | td.PermittivityData) -> str:
def get_field_key(dim: str, fld_data: typing.Union[td.FieldData, td.PermittivityData]) -> str:
"""Get the key corresponding to the scalar field along this dimension."""
return f"E{dim}" if isinstance(fld_data, td.FieldData) else f"eps_{dim}{dim}"

Expand Down
4 changes: 2 additions & 2 deletions tidy3d/web/api/autograd_old.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ def derivative_map_D(


def multiply_field_data(
fld_1: td.FieldData, fld_2: td.FieldData | td.PermittivityData
fld_1: td.FieldData, fld_2: typing.Union[td.FieldData, td.PermittivityData]
) -> td.FieldData:
"""Elementwise multiply two field data objects, writes data into ``fld_1`` copy."""

def get_field_key(dim: str, fld_data: td.FieldData | td.PermittivityData) -> str:
def get_field_key(dim: str, fld_data: typing.Union[td.FieldData, td.PermittivityData]) -> str:
"""Get the key corresponding to the scalar field along this dimension."""
return f"E{dim}" if isinstance(fld_data, td.FieldData) else f"eps_{dim}{dim}"

Expand Down

0 comments on commit b8c96f2

Please sign in to comment.