Skip to content

Conversation

tylerflex
Copy link
Collaborator

Requires a merge of frontend PR

@tylerflex tylerflex marked this pull request as draft July 25, 2025 01:00
@tylerflex tylerflex marked this pull request as ready for review September 2, 2025 19:35
Copy link
Contributor

@yaugenst-flex yaugenst-flex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Here my comments:

  1. I know it's topologically the same thing, but this is a very strange looking waveguide crossing 😆 Might be quite confusing to readers to have the ports arranged like that..
  2. You actually don't use autograd numpy other than for setting up to (undifferentiated) linspaces - I guess it works, which is nice. But I'd be careful and just use autograd numpy throughout?
  3. Before Cell 15: Typo: optimizer.th
  4. Cell 18: You set beta_min = beta_max = 20, so no beta scheduling. Is that intentional? If it is, it probably should be commented.
  5. Cell 18: params get appended to params_history and are always mutated in-place, meaning that the final params_history will contain the same parameters for each entry. Should be params_history.append(params.copy()).
  6. import tidy3d.web as web unused. Similarly, there are a couple of other formatting issues, should run ruff format && ruff check --fix. CI is failing.

@tylerflex
Copy link
Collaborator Author

I know it's topologically the same thing, but this is a very strange looking waveguide crossing 😆 Might be quite confusing to readers to have the ports arranged like that..

can you help me make it look better? how would you change it?

@tylerflex
Copy link
Collaborator Author

You actually don't use autograd numpy other than for setting up to (undifferentiated) linspaces - I guess it works, which is nice. But I'd be careful and just use autograd numpy throughout?

sounds good, fixed

Before Cell 15: Typo: optimizer.th

fixed

Cell 18: You set beta_min = beta_max = 20, so no beta scheduling. Is that intentional? If it is, it probably should be commented.

yea it seems to work alright, will add a comment

Cell 18: params get appended to params_history and are always mutated in-place, meaning that the final params_history will contain the same parameters for each entry. Should be params_history.append(params.copy()).

fixed

import tidy3d.web as web unused. Similarly, there are a couple of other formatting issues, should run ruff format && ruff check --fix. CI is failing.

thanks, fixed this too

Will change to a "Plus" setup and will re-run but the queue is horrible today so it's like an iteration every 45 minutes..

Copy link
Contributor

github-actions bot commented Sep 3, 2025

Spell Check Report

Autograd26Smatrix.ipynb:

Cell 8, Line 5: 'staticd'
  > We first define the overall geometry as a `td.Box` and also the number of pixels in x and y staticd on our design region resolution.
Cell 33, Line 7: 'beginnning'
  > # we will just have the same projection strength for beginnning and end in this case
Cell 40, Line 1: 'top-left', 'top-right'
  > The field plots below show the device operating at the central design frequency. We can clearly see the crossover behavior: light entering the top-left port is efficiently routed to the bottom-right port, and light from the bottom-left is routed to the top-right.

Checked 1 notebook(s). Found spelling errors in 1 file(s).
Generated by GitHub Action run: https://github.com/flexcompute/tidy3d-notebooks/actions/runs/17438945531

@groberts-flex
Copy link
Contributor

thanks Tyler, this is really cool! A couple of comments below

  1. leftover print of the tidy3d version in the import section
  2. cell 2: should we remove n_sio2 since it's unused?
  3. cell 3: "and a field monitor" -> "add a field monitor"
  4. cell 12: some commented code leftover for the element_mappings
  5. cell 13: looking at all the input/output for the various ports seems useful for debugging, but maybe ok to only plot one of them as an example in the notebook output for conciseness. If possible, it might be good to add a text label to one of them to identify each port index.
  6. cell 14: can probably get rid of the printed smatrix output
  7. cell 20: leftover print statement in objective

at cell 21, seeing that the output is broken which I'm assuming is due to all the flux in the backend and how the autograd stuff is running. When that part is updated and re-run, I'll add some more comments for the rest of the notebook

@tylerflex
Copy link
Collaborator Author

tylerflex commented Sep 4, 2025

Thanks @groberts-flex , I made all comments and fixed the element mappings too so it only solves from one port (since all results can just be rotated through the ports).

Sorry you saw this version, I had made some major changes after Yannick's initial reviews so it was a bit messy. but appreciate the help cleaning it up.

Once things are back up and running I will polish up and get things into final state.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants