refactoring
This commit is contained in:
parent
3debe82f0d
commit
157fcdc102
1 changed files with 30 additions and 11 deletions
|
@ -3,7 +3,8 @@ import numpy as np
|
||||||
from numpy.testing import assert_allclose
|
from numpy.testing import assert_allclose
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from optifik.scheludko import thickness_for_order0
|
from optifik.scheludko import thickness_from_scheludko
|
||||||
|
from optifik.scheludko import get_default_start_stop_wavelengths
|
||||||
from optifik.io import load_spectrum
|
from optifik.io import load_spectrum
|
||||||
from optifik.analysis import smooth_intensities
|
from optifik.analysis import smooth_intensities
|
||||||
|
|
||||||
|
@ -26,13 +27,22 @@ def test_SV2o0_small_tol(spectrum_path, expected):
|
||||||
lambdas, raw_intensities = load_spectrum(spectrum_path, lambda_min=450)
|
lambdas, raw_intensities = load_spectrum(spectrum_path, lambda_min=450)
|
||||||
smoothed_intensities = smooth_intensities(raw_intensities)
|
smoothed_intensities = smooth_intensities(raw_intensities)
|
||||||
|
|
||||||
refractive_index = 1.324188 + 3102.060378 / (lambdas**2)
|
r_index = 1.324188 + 3102.060378 / (lambdas**2)
|
||||||
prominence = 0.020
|
prominence = 0.020
|
||||||
|
|
||||||
|
w_start, w_stop = None, None
|
||||||
|
#w_start, w_stop = get_default_start_stop_wavelengths(lambdas,
|
||||||
|
# smoothed_intensities,
|
||||||
|
# refractive_index=r_index,
|
||||||
|
# min_peak_prominence=prominence,
|
||||||
|
# plot=False)
|
||||||
|
|
||||||
result = thickness_for_order0(lambdas, smoothed_intensities,
|
result = thickness_from_scheludko(lambdas,
|
||||||
refractive_index=refractive_index,
|
smoothed_intensities,
|
||||||
min_peak_prominence=prominence,
|
refractive_index=r_index,
|
||||||
|
wavelength_start=w_start,
|
||||||
|
wavelength_stop=w_stop,
|
||||||
|
interference_order=0,
|
||||||
plot=False)
|
plot=False)
|
||||||
|
|
||||||
assert_allclose(result.thickness, expected, rtol=1e-1)
|
assert_allclose(result.thickness, expected, rtol=1e-1)
|
||||||
|
@ -42,13 +52,22 @@ def test_SV2o0_large_tol(spectrum_path, expected):
|
||||||
lambdas, raw_intensities = load_spectrum(spectrum_path, lambda_min=450)
|
lambdas, raw_intensities = load_spectrum(spectrum_path, lambda_min=450)
|
||||||
smoothed_intensities = smooth_intensities(raw_intensities)
|
smoothed_intensities = smooth_intensities(raw_intensities)
|
||||||
|
|
||||||
refractive_index = 1.324188 + 3102.060378 / (lambdas**2)
|
r_index = 1.324188 + 3102.060378 / (lambdas**2)
|
||||||
prominence = 0.020
|
prominence = 0.020
|
||||||
|
|
||||||
|
w_start, w_stop = None, None
|
||||||
|
# w_start, w_stop = get_default_start_stop_wavelengths(lambdas,
|
||||||
|
# smoothed_intensities,
|
||||||
|
# refractive_index=r_index,
|
||||||
|
# min_peak_prominence=prominence,
|
||||||
|
# plot=False)
|
||||||
|
|
||||||
result = thickness_for_order0(lambdas, smoothed_intensities,
|
result = thickness_from_scheludko(lambdas,
|
||||||
refractive_index=refractive_index,
|
smoothed_intensities,
|
||||||
min_peak_prominence=prominence,
|
refractive_index=r_index,
|
||||||
|
wavelength_start=w_start,
|
||||||
|
wavelength_stop=w_stop,
|
||||||
|
interference_order=0,
|
||||||
plot=False)
|
plot=False)
|
||||||
|
|
||||||
assert_allclose(result.thickness, expected, rtol=2.5e-1)
|
assert_allclose(result.thickness, expected, rtol=2.5e-1)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue