Skip to content

Issue when calculating spectra with very low imagniary components #27

@Titian2

Description

@Titian2

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions