include peak detection in scheludko
This commit is contained in:
parent
56aac01151
commit
ccd1f2c1f0
7 changed files with 100 additions and 82 deletions
|
@ -29,10 +29,6 @@ def test_minmax(spectrum_path, expected):
|
|||
indice = 1.324188 + 3102.060378 / (lambdas**2)
|
||||
prominence = 0.02
|
||||
|
||||
total_extrema, peaks_min, peaks_max = finds_peak(lambdas, smoothed_intensities,
|
||||
min_peak_prominence=prominence,
|
||||
plot=False)
|
||||
|
||||
thickness_minmax = thickness_from_minmax(lambdas,
|
||||
smoothed_intensities,
|
||||
refractive_index=indice,
|
||||
|
|
|
@ -6,7 +6,6 @@ import pytest
|
|||
from optifik.scheludko import thickness_from_scheludko
|
||||
from optifik.io import load_spectrum
|
||||
from optifik.analysis import smooth_intensities
|
||||
from optifik.analysis import finds_peak
|
||||
|
||||
import yaml
|
||||
|
||||
|
@ -22,22 +21,18 @@ def load():
|
|||
|
||||
|
||||
@pytest.mark.parametrize("spectrum_path, expected", load())
|
||||
def test_minmax(spectrum_path, expected):
|
||||
def test_SV2o5(spectrum_path, expected):
|
||||
lambdas, raw_intensities = load_spectrum(spectrum_path, lambda_min=450)
|
||||
smoothed_intensities = smooth_intensities(raw_intensities)
|
||||
|
||||
refractive_index = 1.324188 + 3102.060378 / (lambdas**2)
|
||||
prominence = 0.02
|
||||
|
||||
total_extrema, peaks_min, peaks_max = finds_peak(lambdas, smoothed_intensities,
|
||||
min_peak_prominence=prominence,
|
||||
plot=False)
|
||||
|
||||
thickness_scheludko = thickness_from_scheludko(lambdas,
|
||||
smoothed_intensities,
|
||||
peaks_min,
|
||||
peaks_max,
|
||||
refractive_index)
|
||||
thickness_scheludko = thickness_from_scheludko(lambdas, smoothed_intensities,
|
||||
refractive_index=refractive_index,
|
||||
min_peak_prominence=prominence,
|
||||
plot=False)
|
||||
result = thickness_scheludko.thickness
|
||||
|
||||
assert_allclose(result, expected, rtol=1e-1)
|
||||
|
|
|
@ -3,13 +3,12 @@ import numpy as np
|
|||
from numpy.testing import assert_allclose
|
||||
import pytest
|
||||
|
||||
from optifik.analysis import thickness_from_fft
|
||||
from optifik.analysis import thickness_from_minmax
|
||||
from optifik.analysis import thickness_from_scheludko
|
||||
from optifik.analysis import thickness_for_order0
|
||||
from optifik.fft import thickness_from_fft
|
||||
from optifik.minmax import thickness_from_minmax
|
||||
from optifik.scheludko import thickness_from_scheludko
|
||||
from optifik.scheludko import thickness_for_order0
|
||||
from optifik.analysis import smooth_intensities
|
||||
from optifik.analysis import Prominence_from_fft
|
||||
from optifik.analysis import finds_peak
|
||||
from optifik.io import load_spectrum
|
||||
|
||||
|
||||
|
@ -69,14 +68,10 @@ def test_scheludko_4peaks():
|
|||
|
||||
prominence = Prominence_from_fft(lambdas=lambdas, intensities=smoothed_intensities, refractive_index=indice, plot=False)
|
||||
|
||||
total_extrema, peaks_min, peaks_max = finds_peak(lambdas, smoothed_intensities,
|
||||
min_peak_prominence=prominence,
|
||||
plot=False)
|
||||
|
||||
|
||||
result = thickness_from_scheludko(lambdas, smoothed_intensities,
|
||||
peaks_min, peaks_max,
|
||||
refractive_index=indice,
|
||||
min_peak_prominence=prominence,
|
||||
plot=False)
|
||||
|
||||
assert_allclose(result.thickness, expected, rtol=1e-1)
|
||||
|
@ -95,13 +90,9 @@ def test_scheludko_2peaks():
|
|||
|
||||
prominence = 0.03
|
||||
|
||||
total_extrema, peaks_min, peaks_max = finds_peak(lambdas, smoothed_intensities,
|
||||
min_peak_prominence=prominence,
|
||||
plot=False)
|
||||
|
||||
result = thickness_from_scheludko(lambdas, smoothed_intensities,
|
||||
peaks_min, peaks_max,
|
||||
refractive_index=indice,
|
||||
min_peak_prominence=prominence,
|
||||
plot=False)
|
||||
|
||||
assert_allclose(result.thickness, expected, rtol=1e-1)
|
||||
|
@ -122,13 +113,10 @@ def test_order0():
|
|||
|
||||
prominence = 0.03
|
||||
|
||||
total_extrema, peaks_min, peaks_max = finds_peak(lambdas, smoothed_intensities,
|
||||
min_peak_prominence=prominence,
|
||||
plot=False)
|
||||
|
||||
result = thickness_for_order0(lambdas, smoothed_intensities,
|
||||
peaks_min, peaks_max,
|
||||
refractive_index=indice,
|
||||
min_peak_prominence=prominence,
|
||||
plot=False)
|
||||
|
||||
assert_allclose(result.thickness, expected, rtol=1e-1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue