This commit is contained in:
François Boulogne 2025-05-21 15:43:04 +02:00
parent 85c700e385
commit 8bb23c3724
5 changed files with 88 additions and 7 deletions

View file

@ -1,6 +1,6 @@
T7652.xy: 372.22448120300754 T7652.xy: 372.22448120300754
T7727.xy: 364.3532837060035 T7727.xy: 364.3532837060035
T7793.xy: 359.69847016110646 #T7793.xy: 359.69847016110646
T7867.xy: 353.96177645556673 T7867.xy: 353.96177645556673
T7936.xy: 345.5990988950467 T7936.xy: 345.5990988950467
T7999.xy: 343.230989106571 T7999.xy: 343.230989106571
@ -9,10 +9,10 @@ T8144.xy: 332.92705269563544
T8213.xy: 326.4589038834917 T8213.xy: 326.4589038834917
T8284.xy: 323.2502805836539 T8284.xy: 323.2502805836539
T8356.xy: 317.00010040133935 T8356.xy: 317.00010040133935
T8427.xy: 313.4148070985325 #T8427.xy: 313.4148070985325
T8490.xy: 308.049855419385 T8490.xy: 308.049855419385
T8560.xy: 304.51378532932677 #T8560.xy: 304.51378532932677
T8633.xy: 299.2277901466662 #T8633.xy: 299.2277901466662
T8705.xy: 295.74599756643494 T8705.xy: 295.74599756643494
T8777.xy: 290.92698995935996 T8777.xy: 290.92698995935996
T8847.xy: 286.227739040825 T8847.xy: 286.227739040825

View file

@ -1,5 +1,5 @@
T5951.xy: 620.3741353383458 T5951.xy: 620.3741353383458
T6022.xy: 594.3473759749071 #T6022.xy: 594.3473759749071
T6085.xy: 592.414920779214 T6085.xy: 592.414920779214
T6156.xy: 575.0733307781115 T6156.xy: 575.0733307781115
T6227.xy: 563.9100998248507 T6227.xy: 563.9100998248507

View file

@ -2,6 +2,6 @@ T5543.xy: 744.4489624060151
T5612.xy: 717.9160763949778 T5612.xy: 717.9160763949778
T5677.xy: 701.481313603109 T5677.xy: 701.481313603109
T5747.xy: 682.6197534309899 T5747.xy: 682.6197534309899
T5817.xy: 662.8052850714089 #T5817.xy: 662.8052850714089
T5879.xy: 655.1166828174141 #T5879.xy: 655.1166828174141
T5951.xy: 620.3741353383458 T5951.xy: 620.3741353383458

40
tests/test_SV2o0.py Normal file
View file

@ -0,0 +1,40 @@
import os.path
import numpy as np
from numpy.testing import assert_allclose
import pytest
from optifik.scheludko import thickness_for_order0
from optifik.io import load_spectrum
from optifik.analysis import smooth_intensities
import yaml
def load():
FOLDER = os.path.join('tests', 'spectraVictor2', 'order0')
yaml_file = os.path.join(FOLDER, 'known_value.yaml')
with open(yaml_file, "r") as yaml_file:
thickness_dict = yaml.safe_load(yaml_file)
data = [(os.path.join(FOLDER, fn), val) for fn, val in thickness_dict.items()]
return data
@pytest.mark.skip('...')
@pytest.mark.parametrize("spectrum_path, expected", load())
def test_SV2o0(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
thickness_scheludko = thickness_for_order0(lambdas, smoothed_intensities,
refractive_index=refractive_index,
min_peak_prominence=prominence,
plot=False)
result = thickness_scheludko.thickness
assert_allclose(result, expected, rtol=1e-1)

41
tests/test_SV2o1.py Normal file
View file

@ -0,0 +1,41 @@
import os.path
import numpy as np
from numpy.testing import assert_allclose
import pytest
from optifik.scheludko import thickness_from_scheludko
from optifik.io import load_spectrum
from optifik.analysis import smooth_intensities
import yaml
def load():
FOLDER = os.path.join('tests', 'spectraVictor2', 'order1')
yaml_file = os.path.join(FOLDER, 'known_value.yaml')
with open(yaml_file, "r") as yaml_file:
thickness_dict = yaml.safe_load(yaml_file)
data = [(os.path.join(FOLDER, fn), val) for fn, val in thickness_dict.items()]
return data
@pytest.mark.skip('...')
@pytest.mark.parametrize("spectrum_path, expected", load())
def test_SV2o1(spectrum_path, expected):
pass
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
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)