add test
This commit is contained in:
parent
17b53f1c4c
commit
439104a17f
1 changed files with 53 additions and 2 deletions
|
@ -9,7 +9,9 @@ from optifik.analysis import smooth_intensities
|
|||
from optifik.io import load_spectrum
|
||||
|
||||
|
||||
def test_scheludko_4peaks():
|
||||
|
||||
@pytest.fixture
|
||||
def dataset1():
|
||||
FOLDER = os.path.join('tests', 'basic')
|
||||
FILE_NAME = '000005253.xy'
|
||||
expected = 777.07
|
||||
|
@ -17,8 +19,57 @@ def test_scheludko_4peaks():
|
|||
spectrum_path = os.path.join(FOLDER, FILE_NAME)
|
||||
lambdas, raw_intensities = load_spectrum(spectrum_path, lambda_min=450)
|
||||
smoothed_intensities = smooth_intensities(raw_intensities)
|
||||
r_index = 1.324188 + 3102.060378 / (lambdas**2)
|
||||
r_index = 1.324188 + 3102.060378 / (lambdas**2)
|
||||
|
||||
return {
|
||||
"expected": expected,
|
||||
"lambdas": lambdas,
|
||||
"smoothed_intensities": smoothed_intensities,
|
||||
"r_index": r_index,
|
||||
}
|
||||
|
||||
|
||||
|
||||
def test_interference_order_positive(dataset1):
|
||||
expected = dataset1['expected']
|
||||
lambdas = dataset1['lambdas']
|
||||
smoothed_intensities = dataset1['smoothed_intensities']
|
||||
r_index = dataset1['r_index']
|
||||
prominence = 0.02
|
||||
|
||||
w_start, w_stop = 300, 500
|
||||
with pytest.raises(ValueError):
|
||||
result = thickness_from_scheludko(lambdas,
|
||||
smoothed_intensities,
|
||||
refractive_index=r_index,
|
||||
wavelength_start=w_start,
|
||||
wavelength_stop=w_stop,
|
||||
interference_order=-1,
|
||||
plot=False)
|
||||
|
||||
def test_start_stop_swapped(dataset1):
|
||||
expected = dataset1['expected']
|
||||
lambdas = dataset1['lambdas']
|
||||
smoothed_intensities = dataset1['smoothed_intensities']
|
||||
r_index = dataset1['r_index']
|
||||
prominence = 0.02
|
||||
|
||||
w_start, w_stop = 500, 300
|
||||
with pytest.raises(ValueError):
|
||||
result = thickness_from_scheludko(lambdas,
|
||||
smoothed_intensities,
|
||||
refractive_index=r_index,
|
||||
wavelength_start=w_start,
|
||||
wavelength_stop=w_stop,
|
||||
interference_order=None,
|
||||
plot=False)
|
||||
|
||||
|
||||
def test_scheludko_4peaks(dataset1):
|
||||
expected = dataset1['expected']
|
||||
lambdas = dataset1['lambdas']
|
||||
smoothed_intensities = dataset1['smoothed_intensities']
|
||||
r_index = dataset1['r_index']
|
||||
prominence = 0.02
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue