tidy3d icon indicating copy to clipboard operation
tidy3d copied to clipboard

Fix pol vector

Open dbochkov-flexcompute opened this issue 9 months ago • 1 comments

Related to https://github.com/flexcompute/tidy3d/issues/1683

It seems like our frontend polarization visualization was inconsistent with actual fields being injected. Frontend arrow was calculated sometimes based on summation and sometimes based on subtraction of angle_phi and pol_angle, while on backend it is always summation. That is, rotation for angle_phi and pol_angle are always with respect to the positive direction of injection axis. Moreover the visualization was discontinuous between theta < 0, theta = 0, and theta > 0.

Here's comparison between the visualized polarization vector (red) and extracted from actual fields (blue) pol_vector_old

Now we just repeat the same steps for computing _pol_vector as the backend does for field computations. This seems to resolve all inconsistencies pol_vector_new

dbochkov-flexcompute avatar May 09 '24 23:05 dbochkov-flexcompute

Thanks @dbochkov-flexcompute. Can you just add a changelog item under fixed and I think this is good to merge and also fixes #1683 as far as I can tell.

tylerflex avatar May 10 '24 20:05 tylerflex