This commit is contained in:
François Boulogne 2025-05-21 14:47:08 +02:00
parent ccd1f2c1f0
commit 3319e26d82
2 changed files with 17 additions and 17 deletions

View file

@ -51,7 +51,7 @@ def play():
plot_spectrum(lambdas, smoothed_intensities, title='Smoothed') plot_spectrum(lambdas, smoothed_intensities, title='Smoothed')
prominence = 0.02 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, min_peak_prominence=prominence,
plot=True) plot=True)
@ -112,16 +112,15 @@ def check_SV1():
##### Find Peak ##### ##### 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, min_peak_prominence=prominence,
plot=False) plot=False)
thickness_minmax = thickness_from_minmax(lambdas, result = thickness_from_minmax(lambdas,
smoothed_intensities, smoothed_intensities,
refractive_index=indice, refractive_index=indice,
min_peak_prominence=prominence) min_peak_prominence=prominence)
thickness = thickness_minmax.thickness print(f'thickness: {result.thickness:.2f} nm')
print(f'thickness: {thickness:.2f} nm')
print(f'expected: {val}') print(f'expected: {val}')
@ -132,6 +131,6 @@ def check_SV1():
if __name__ == '__main__': if __name__ == '__main__':
#check_basic() check_basic()
#check_SV1() check_SV1()
play() play()

View file

@ -45,39 +45,40 @@ def auto(spectrum_file, plot=None):
if total_extrema > 15 and total_extrema > 4: if total_extrema > 15 and total_extrema > 4:
print('Apply method FFT') print('Apply method FFT')
thickness_FFT = thickness_from_fft(lambdas, smoothed_intensities, result = thickness_from_fft(lambdas, smoothed_intensities,
refractive_index=indice, refractive_index=indice,
plot=plot) 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: if total_extrema <= 15 and total_extrema > 4:
print('Apply method minmax') print('Apply method minmax')
thickness_minmax = thickness_from_minmax(lambdas, smoothed_intensities, result = thickness_from_minmax(lambdas, smoothed_intensities,
refractive_index=indice, refractive_index=indice,
min_peak_prominence=prominence, min_peak_prominence=prominence,
plot=plot) 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: if total_extrema <= 4 and total_extrema >= 2: #& 2peak minimum:
print('Apply method Scheludko') print('Apply method Scheludko')
thickness = thickness_from_scheludko(lambdas, smoothed_intensities, result = thickness_from_scheludko(lambdas, smoothed_intensities,
refractive_index=indice, refractive_index=indice,
min_peak_prominence=prominence, min_peak_prominence=prominence,
plot=plot) 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 ! if total_extrema <= 4 and len(peaks_max) == 1 and len(peaks_min) == 0 : #dans l'ordre zéro !
print('Apply method ordre0') print('Apply method ordre0')
thickness = thickness_for_order0(lambdas, smoothed_intensities, result = thickness_for_order0(lambdas, smoothed_intensities,
refractive_index=indice, refractive_index=indice,
min_peak_prominence=prominence, min_peak_prominence=prominence,
plot=plot) 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): if total_extrema <= 4 and len(peaks_max) == 0 and (len(peaks_min) == 1 or len(peaks_min) == 0):
#& 1peak min ou zéro: #& 1peak min ou zéro: