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

periods for near2far adjoint #2321

Merged
merged 2 commits into from
Dec 1, 2022
Merged
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
3 changes: 3 additions & 0 deletions python/adjoint/objective.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@ def __init__(
sim: mp.Simulation,
Near2FarRegions: List[mp.Near2FarRegion],
far_pts: List[mp.Vector3],
nperiods: Optional[int] = 1,
decimation_factor: Optional[int] = 0,
norm_near_fields: Optional[NearToFarData] = None,
):
Expand All @@ -400,12 +401,14 @@ def __init__(
self._nfar_pts = len(far_pts)
self.decimation_factor = decimation_factor
self.norm_near_fields = norm_near_fields
self.nperiods = nperiods

def register_monitors(self, frequencies):
self._frequencies = np.asarray(frequencies)
self._monitor = self.sim.add_near2far(
self._frequencies,
*self.Near2FarRegions,
nperiods=self.nperiods,
decimation_factor=self.decimation_factor,
)
if self.norm_near_fields is not None:
Expand Down