This work details the physical and mathematical foundations of an algorithm to determine the optical profile of thin gradient films using the surface plasmon resonance (SPR) method. The algorithm minimizes the discrepancy function, which quantifies the deviation between experimental data and model data of the targeted gradient layer, approximated using a cubic Hermite interpolant known as PCHIP. Powell's method optimization, implemented in Python, determines the optimal coordinates for the spline nodes approximating the gradient optical layer. To enhance stability, accuracy, and search speed, the algorithm operates in three stages. Each stage refines the search area and sets initial parameters for the subsequent stage to align closely with the targeted gradient layer. The algorithm incorporates angle, wavelength, and external environment scan data derived via SPR.
$^1$Scientific and Technological Center of Unique Instrumentation of RAS (STC UI RAS)