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

Issue when calculating spectra with very low imagniary components #27

Open
Titian2 opened this issue Mar 1, 2025 · 1 comment
Open

Comments

@Titian2
Copy link

Titian2 commented Mar 1, 2025

I have been playing with this script for a few hours now and have also encountered the "weird refractive index" error when trying to model a HR reflector at 1064 nm. This is just on a standard silica substrate n=1.44 , k = 3E-8 @ 1064 nm .

I am encountering an assertion error when running a multi-wavelength TMM simulation at normal incidence using tmm‑fast. The error arises in the SnellLaw_vectorized function and reads:

AssertionError: It's not clear which beam is incoming vs outgoing. Weird index maybe?

This happens even though my input arrays have the correct shapes. In my case, I am simulating a coating stack with 54 physical layers (plus the incident and substrate media) and specifying two wavelengths (532 nm and 1064 nm). The refractive indices for the layers include very small imaginary components (e.g., 1.45+3e-8j, 1.89+2e-7j), which represent a measured absorption.
the issue seems to arise when i create a substrate with the same level of low absorption. However when i change the properties of the substrate's imaginary parts to zero, the simulation runs successfully.

@MLResearchAtOSRAM
Copy link
Owner

Hey Titian,

the transfer Matrix doesn't support imaginary parts in neither the first or the last layer because it assumes that those layers go towards infinity in thickness. You can circumvent this issues and still get your desired optical behaviour by splitting your final substrate into a final infinitely thick layer without absorption and a very thick one, say >1e0m with low absorption. The fields are then zero when reaching the infinite substrate but you avoid the computational problems with absoprtion in infinite layers

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

No branches or pull requests

2 participants