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

remove redundant phase from shifted source in smatrix #1036

Merged
merged 1 commit into from
Jul 27, 2023
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed
- Fix the `Environment has no attribute _current` issue when set `TIDY3D_ENV=prod`
- Redundant phase compensation for shifted source in smatrix plugin.

## [2.3.2] - 2023-7-21

Expand Down
11 changes: 3 additions & 8 deletions tidy3d/plugins/smatrix/smatrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import pydantic as pd
import numpy as np

from ...constants import HERTZ, C_0
from ...constants import HERTZ
from ...components.simulation import Simulation
from ...components.geometry import Box
from ...components.mode import ModeSpec
Expand Down Expand Up @@ -368,14 +368,9 @@ def _normalization_factor(self, port_source: Port, sim_data: SimulationData) ->
f=self.freqs,
direction=port_source.direction,
mode_index=mode_index,
).values

normalize_n_eff = port_monitor_data.n_eff.sel(f=self.freqs, mode_index=mode_index).values
)

k0s = 2 * np.pi * C_0 / np.array(self.freqs)
k_effs = k0s * normalize_n_eff
shift_value = self._shift_value_signed(port=port_source)
return normalize_amps * np.exp(1j * k_effs * shift_value)
return normalize_amps.values

@cached_property
def max_mode_index(self) -> Tuple[int, int]:
Expand Down