From 3319e26d82a23bdd45285f7dc0e377b221c93679 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Boulogne?= Date: Wed, 21 May 2025 14:47:08 +0200 Subject: [PATCH] fixes --- check.py | 13 ++++++------- optifik/auto.py | 21 +++++++++++---------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/check.py b/check.py index 6c9767c..8e659a5 100644 --- a/check.py +++ b/check.py @@ -51,7 +51,7 @@ def play(): plot_spectrum(lambdas, smoothed_intensities, title='Smoothed') prominence = 0.02 - total_extrema, peaks_min, peaks_max = finds_peak(lambdas, smoothed_intensities, + peaks_min, peaks_max = finds_peak(lambdas, smoothed_intensities, min_peak_prominence=prominence, plot=True) @@ -112,16 +112,15 @@ def check_SV1(): ##### Find Peak ##### - total_extrema, peaks_min, peaks_max = finds_peak(lambdas, smoothed_intensities, + peaks_min, peaks_max = finds_peak(lambdas, smoothed_intensities, min_peak_prominence=prominence, plot=False) - thickness_minmax = thickness_from_minmax(lambdas, + result = thickness_from_minmax(lambdas, smoothed_intensities, refractive_index=indice, min_peak_prominence=prominence) - thickness = thickness_minmax.thickness - print(f'thickness: {thickness:.2f} nm') + print(f'thickness: {result.thickness:.2f} nm') print(f'expected: {val}') @@ -132,6 +131,6 @@ def check_SV1(): if __name__ == '__main__': - #check_basic() - #check_SV1() + check_basic() + check_SV1() play() \ No newline at end of file diff --git a/optifik/auto.py b/optifik/auto.py index 078d180..436e052 100644 --- a/optifik/auto.py +++ b/optifik/auto.py @@ -45,39 +45,40 @@ def auto(spectrum_file, plot=None): if total_extrema > 15 and total_extrema > 4: print('Apply method FFT') - thickness_FFT = thickness_from_fft(lambdas, smoothed_intensities, + result = thickness_from_fft(lambdas, smoothed_intensities, refractive_index=indice, plot=plot) - thickness = thickness_FFT.thickness - print(f'thickness: {thickness:.2f} nm') + + print(f'thickness: {result.thickness:.2f} nm') if total_extrema <= 15 and total_extrema > 4: print('Apply method minmax') - thickness_minmax = thickness_from_minmax(lambdas, smoothed_intensities, + result = thickness_from_minmax(lambdas, smoothed_intensities, refractive_index=indice, min_peak_prominence=prominence, plot=plot) - thickness = thickness_minmax.thickness - print(f'thickness: {thickness:.2f} nm') + + print(f'thickness: {result.thickness:.2f} nm') if total_extrema <= 4 and total_extrema >= 2: #& 2peak minimum: print('Apply method Scheludko') - thickness = thickness_from_scheludko(lambdas, smoothed_intensities, + result = thickness_from_scheludko(lambdas, smoothed_intensities, refractive_index=indice, min_peak_prominence=prominence, plot=plot) - print(f'thickness: {thickness:.2f} nm') + + print(f'thickness: {result.thickness:.2f} nm') if total_extrema <= 4 and len(peaks_max) == 1 and len(peaks_min) == 0 : #dans l'ordre zéro ! print('Apply method ordre0') - thickness = thickness_for_order0(lambdas, smoothed_intensities, + result = thickness_for_order0(lambdas, smoothed_intensities, refractive_index=indice, min_peak_prominence=prominence, plot=plot) - print(f'thickness: {thickness:.2f} nm') + print(f'thickness: {result.thickness:.2f} nm') if total_extrema <= 4 and len(peaks_max) == 0 and (len(peaks_min) == 1 or len(peaks_min) == 0): #& 1peak min ou zéro: