-
Notifications
You must be signed in to change notification settings - Fork 50
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
correcting plot functions for ModeSolver #1966
Conversation
Hi @FilipeFcp! Regarding the size of the mode plane, I understand that we should show the calculation plane for users. However, the fact that it differs from the values they used to define the mode plane can create confusion. If the user sets a 3 x 2 microns plane and visualizes a 3.2 x 2.1 (or other value), that can sound like an error (maybe more critical for GUI users). @momchil-flex, if we include grid |
39d1f5d
to
1520f5b
Compare
Hi @e-g-melo, I just spoke with Tom and realized I misunderstood the ModeSolver behavior. I initially thought that if the ModeSolver plane was larger than the simulation size, the calculation would take place on the larger plane. I've reverted to the current version and just corrected the plane positioning. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @FilipeFcp! Those questions still remain, though. The simulation plane is usually slightly larger than the mode plane definition by some nanometers (~100-300 nm). If we can make it the same size, that would be interesting.
Maybe, I'm not 100% sure if we don't do like an extra pixel in some cases or something like that.
Yeah I've thought about this a few times but my conclusion always is that it's unfortunately not that straightforward. We should do it some day.. but since it won't be quick, I'm not sure when. |
1520f5b
to
c5e4133
Compare
Hi @e-g-melo, I believe it should be relatively easy to add this extra space to the plot. Regarding the PML, would it be possible to include the PML in the |
Yes.. that is good! |
040f08e
to
4fce96b
Compare
@e-g-melo I made a minor adjustment so that the |
Hi @FilipeFcp! It sounds good and will help our users. Thanks |
h_min = self.plane.center[t_axes[0]] - self.plane.size[t_axes[0]] / 2 | ||
h_max = self.plane.center[t_axes[0]] + self.plane.size[t_axes[0]] / 2 | ||
v_min = self.plane.center[t_axes[1]] - self.plane.size[t_axes[1]] / 2 | ||
v_max = self.plane.center[t_axes[1]] + self.plane.size[t_axes[1]] / 2 | ||
|
||
h_lim = [ | ||
h_min if abs(h_min) < abs(h_min_s) else h_min_s, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed you had removed the absolute value here, but now it is restored. Seems like it shouldn't be here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Initially, I thought the definition of h_lim
was causing issues in some situations, but I realized that wasn't the case. Since this definition is equivalent to mine without the absolute value, I decided to keep the original. Do you think I should revise it?
If they are equivalent then this is fine. Thanks
…On Thu, Sep 26, 2024 at 3:20 PM FilipeFcp ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In tidy3d/plugins/mode/mode_solver.py
<#1966 (comment)>:
> @@ -1472,10 +1474,10 @@ def _center_and_lims(self) -> Tuple[List, List, List, List]:
_, (h_min_s, v_min_s) = Box.pop_axis(self.simulation.bounds[0], axis=n_axis)
_, (h_max_s, v_max_s) = Box.pop_axis(self.simulation.bounds[1], axis=n_axis)
- h_min = a_center[n_axis] - self.plane.size[t_axes[0]] / 2
- h_max = a_center[n_axis] + self.plane.size[t_axes[0]] / 2
- v_min = a_center[n_axis] - self.plane.size[t_axes[1]] / 2
- v_max = a_center[n_axis] + self.plane.size[t_axes[1]] / 2
+ h_min = self.plane.center[t_axes[0]] - self.plane.size[t_axes[0]] / 2
+ h_max = self.plane.center[t_axes[0]] + self.plane.size[t_axes[0]] / 2
+ v_min = self.plane.center[t_axes[1]] - self.plane.size[t_axes[1]] / 2
+ v_max = self.plane.center[t_axes[1]] + self.plane.size[t_axes[1]] / 2
h_lim = [
h_min if abs(h_min) < abs(h_min_s) else h_min_s,
Yes. Initially, I thought the definition of h_lim was causing issues in
some situations, but I realized that wasn't the case. Since this definition
is equivalent to mine without the absolute value, I decided to keep the
original. Do you think I should revise it?
—
Reply to this email directly, view it on GitHub
<#1966 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A3KLECNIJR2CLOAY36UIMODZYP3YNAVCNFSM6AAAAABOQPNT5KVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDGMZRGA3DQNJZGY>
.
You are receiving this because your review was requested.Message ID:
***@***.***>
|
I haven't really followed this but @e-g-melo @FilipeFcp if you think this is now done we could merge. |
Hi @momchil-flex, I believe it is. The only modification is that the .plot method for ModeSolver now includes plotting the PML (so does that same as the .plot_pml method). Apart from that, it's just a minor correction. |
Hi @FilipeFcp! Since you have included the PML in |
4fce96b
to
494eed4
Compare
Hi @e-g-melo . I removed the structures for the |
Thanks @FilipeFcp! It seems good! |
@FilipeFcp could you just add a changelog item for this please? Or message it to me I need to update the changelog a bit before release anyway. |
Hi @momchil-flex. I would add this under ###fixed: - |
There was a little bug in the
_center_and_lims
method, so simulations with the center not in origin would plot an incorrectModeSolver
plot.Also, I made a little adaptation to ensure that the plot functions would plot the entire
plane
object of theModeSolver
. I believe that the computation will be carried out in theplane
right, regardless of whether it is larger than theSimulation
object size, is that correct?I did some tests in this notebook
There seems to be still a little bug with the
plot_pml
function.