API Reference

Below is the complete reference for Optifik’s public API.

io

optifik.io.load_spectrum(spectrum_path, wavelength_min=0, wavelength_max=inf, delimiter=',')[source]

Load a spectrum file.

TODO : describe expected format

Parameters:
spectrum_pathstring

File path.

wavelength_minscalar, optional

Cut the data at this minimum wavelength (included).

wavelength_maxscalar, optional

Cut the data at this maximum wavelength (included).

delimiterstring, optional

Delimiter between columns in the datafile.

Returns:
valuesarrays

(lamdbas, intensities)

fft

optifik.fft.thickness_from_fft(wavelengths, intensities, refractive_index, num_half_space=None, plot=None)[source]

Determine the tickness by Fast Fourier Transform.

Parameters:
wavelengthsarray

Wavelength values in nm.

intensitiesarray

Intensity values.

refractive_indexscalar, optional

Value of the refractive index of the medium.

num_half_spacescalar, optional

Number of points to compute FFT’s half space. If None, default corresponds to 10*len(wavelengths).

plotboolean, optional

Show plot of the transformed signal and the peak detection.

Returns:
resultsInstance of OptimizeResult class.

The attribute thickness gives the thickness value in nm.

minmax

optifik.minmax.thickness_from_minmax(wavelengths, intensities, refractive_index, min_peak_prominence, min_peak_distance=10, method='linreg', plot=None)[source]

Return the thickness from a min-max detection.

Parameters:
wavelengthsarray

Wavelength values in nm.

intensitiesarray

Intensity values.

refractive_indexscalar, optional

Value of the refractive index of the medium.

min_peak_prominencescalar, optional

Required prominence of peaks.

min_peak_distancescalar, optional

Minimum distance between peaks.

methodstring, optional

Either ‘linreg’ for linear regression or ‘ransac’ for Randon Sampling Consensus.

plotboolean, optional

Show plots of peak detection and lin regression.

Returns:
resultsInstance of OptimizeResult class.

The attribute thickness gives the thickness value in nm.

Notes

For more details about min_peak_prominence and min_peak_distance, see the documentation of scipy.signal.find_peaks. This function is used to find extrema.

scheludko

optifik.scheludko.get_default_start_stop_wavelengths(wavelengths, intensities, refractive_index, min_peak_prominence, plot=None)[source]

Returns the start and stop wavelength values of the last monotonic branch.

Parameters:
wavelengthsarray

Wavelength values in nm.

intensitiesarray

Intensity values.

refractive_indexscalar, optional

Value of the refractive index of the medium.

min_peak_prominencescalar

Required prominence of peaks.

plotbool, optional

Display a curve, useful for checking or debuging. The default is None.

Returns:
wavelength_startscalar
wavelength_stopscalar
Raises:
RuntimeError

if at least one maximum and one minimum are not detected.

optifik.scheludko.thickness_from_scheludko(wavelengths, intensities, refractive_index, wavelength_start=None, wavelength_stop=None, interference_order=None, intensities_void=None, plot=None)[source]

Compute the film thickness based on Scheludko method.

Parameters:
wavelengthsarray

Wavelength values in nm.

intensitiesarray

Intensity values.

refractive_indexscalar, optional

Value of the refractive index of the medium.

wavelength_startscalar, optional

Starting value of a monotonic branch. Mandatory if interference_order != 0.

wavelength_stopscalar, optional

Stoping value of a monotonic branch. Mandatory if interference_order != 0.

interference_orderscalar, optional

Interference order, zero or positive integer. If set to None, the value is guessed.

intensities_voidarray, optional

Intensity in absence of a film. Mandatory if interference_order == 0.

plotbool, optional

Display a curve, useful for checking or debuging. The default is None.

Returns:
resultsInstance of OptimizeResult class.

The attribute thickness gives the thickness value in nm.