add files
This commit is contained in:
parent
5fe2ef7a67
commit
17b53f1c4c
6 changed files with 319 additions and 47 deletions
130
tests/spectraVictor2/order0/known_to_fail.yaml
Normal file
130
tests/spectraVictor2/order0/known_to_fail.yaml
Normal file
|
@ -0,0 +1,130 @@
|
||||||
|
T16053.xy: 90.45300835427635
|
||||||
|
T16617.xy: 81.21047762108086
|
||||||
|
T16678.xy: 80.31780246995505
|
||||||
|
T16739.xy: 79.15724700943923
|
||||||
|
T16812.xy: 78.44798662153762
|
||||||
|
T16871.xy: 77.4520761261443
|
||||||
|
T16933.xy: 76.66196112954584
|
||||||
|
T17008.xy: 75.373800563203
|
||||||
|
T17077.xy: 74.28223895630823
|
||||||
|
T17137.xy: 73.38655766446928
|
||||||
|
T17200.xy: 72.1896895417961
|
||||||
|
T17271.xy: 71.56217278784045
|
||||||
|
T17343.xy: 70.12160217440957
|
||||||
|
T17416.xy: 68.92969343342145
|
||||||
|
T17486.xy: 68.12049284214301
|
||||||
|
T17549.xy: 66.80303824279235
|
||||||
|
T17625.xy: 65.99608104409013
|
||||||
|
T17695.xy: 65.25251792159017
|
||||||
|
T17769.xy: 64.00266354954327
|
||||||
|
T17836.xy: 63.015781912851686
|
||||||
|
T17906.xy: 61.562998778797
|
||||||
|
T17969.xy: 60.8954006296276
|
||||||
|
T18040.xy: 59.61929259890727
|
||||||
|
T18111.xy: 58.78017522831741
|
||||||
|
T18177.xy: 57.867491523721604
|
||||||
|
T18244.xy: 56.628928486673345
|
||||||
|
T18315.xy: 55.58274202642659
|
||||||
|
T18388.xy: 54.76911277607284
|
||||||
|
T18458.xy: 53.23742605239474
|
||||||
|
T18531.xy: 52.457573607339896
|
||||||
|
T18605.xy: 51.130249935893495
|
||||||
|
T18674.xy: 50.18605538362272
|
||||||
|
T18748.xy: 48.82375634938857
|
||||||
|
T18818.xy: 47.898926722625646
|
||||||
|
T18889.xy: 47.24554206801689
|
||||||
|
T18960.xy: 45.92649719589015
|
||||||
|
T19033.xy: 45.31404852626354
|
||||||
|
T19103.xy: 44.04792240037513
|
||||||
|
T19175.xy: 43.512162472031946
|
||||||
|
T19246.xy: 42.39974893171179
|
||||||
|
T19307.xy: 41.40370710601314
|
||||||
|
T19368.xy: 40.190000003978724
|
||||||
|
T19442.xy: 39.7908194502919
|
||||||
|
T19504.xy: 38.86873798965855
|
||||||
|
T19577.xy: 38.256582406214875
|
||||||
|
T19646.xy: 36.732536890445104
|
||||||
|
T19720.xy: 36.302952043599674
|
||||||
|
T19795.xy: 35.33077538066582
|
||||||
|
T19861.xy: 33.82853466198359
|
||||||
|
T19922.xy: 33.6264129799091
|
||||||
|
T19984.xy: 32.56882980723177
|
||||||
|
T20056.xy: 31.716029588070004
|
||||||
|
T20128.xy: 30.9389509299541
|
||||||
|
T20201.xy: 29.801282167285436
|
||||||
|
T20270.xy: 28.843694109308284
|
||||||
|
T20343.xy: 28.022933381569352
|
||||||
|
T20417.xy: 27.12695804779101
|
||||||
|
T20489.xy: 26.697121450809053
|
||||||
|
T20558.xy: 25.801797115458406
|
||||||
|
T20628.xy: 24.80468338477568
|
||||||
|
T20700.xy: 24.08677644034063
|
||||||
|
T20771.xy: 23.216851687498718
|
||||||
|
T20833.xy: 22.403639545458578
|
||||||
|
T20907.xy: 21.450824944786188
|
||||||
|
T20978.xy: 20.698403220925407
|
||||||
|
T21050.xy: 20.180242579832115
|
||||||
|
T21120.xy: 19.073026686872062
|
||||||
|
T21193.xy: 18.067527932796555
|
||||||
|
T21266.xy: 17.788340332627318
|
||||||
|
T21335.xy: 16.73984202033769
|
||||||
|
T21409.xy: 16.15580200933398
|
||||||
|
T21477.xy: 15.392400576341881
|
||||||
|
T21541.xy: 14.662332974949772
|
||||||
|
T21610.xy: 14.114418248767004
|
||||||
|
T21673.xy: 13.670336677360423
|
||||||
|
T21746.xy: 12.643113927012816
|
||||||
|
T21818.xy: 12.517769120321669
|
||||||
|
T21887.xy: 11.197431215995442
|
||||||
|
T21948.xy: 11.459041839515868
|
||||||
|
T22020.xy: 11.521111661090618
|
||||||
|
T22092.xy: 10.38658595887989
|
||||||
|
T22157.xy: 10.383172535760965
|
||||||
|
T22228.xy: 10.061869216456225
|
||||||
|
T22299.xy: 9.278080287311097
|
||||||
|
T22371.xy: 8.83668184571166
|
||||||
|
T22447.xy: 8.352209963184631
|
||||||
|
T22512.xy: 8.955785625765454
|
||||||
|
T22573.xy: 7.90930609871769
|
||||||
|
T22648.xy: 3.4643319393515317
|
||||||
|
T22718.xy: 4.1507304003627565
|
||||||
|
T22788.xy: 3.2807740203778155
|
||||||
|
T22865.xy: 1.5726691486794457
|
||||||
|
T22932.xy: 3.0897989180398984
|
||||||
|
T22994.xy: 1.0558253042494077
|
||||||
|
T23064.xy: 1.4392233684991647
|
||||||
|
T23138.xy: 2.0496273589825957
|
||||||
|
T23208.xy: 0.3478652040929014
|
||||||
|
T23280.xy: 2.3547687674325593
|
||||||
|
T23361.xy: 2.8459896671389484
|
||||||
|
T23433.xy: 0.7120535181141793
|
||||||
|
T23496.xy: 1.5881943255362871
|
||||||
|
T23566.xy: -0.8318854167488029
|
||||||
|
T23639.xy: -0.19584335188209473
|
||||||
|
T23710.xy: 4.127075248698121
|
||||||
|
T23782.xy: 1.503825079280638
|
||||||
|
T23842.xy: 1.298701481981237
|
||||||
|
T23905.xy: -1.9875197542258602
|
||||||
|
T23978.xy: 1.1092062721462115
|
||||||
|
T24052.xy: 1.7960423393624443
|
||||||
|
T24121.xy: 2.2015433421886708
|
||||||
|
T24194.xy: -1.118879018385083
|
||||||
|
T24262.xy: -1.6892400749730334
|
||||||
|
T24326.xy: -1.7383043762838022
|
||||||
|
T24397.xy: 2.6087265909066253
|
||||||
|
T24467.xy: -0.6892358011630055
|
||||||
|
T24530.xy: 2.4643805068983773
|
||||||
|
T24600.xy: 1.4116956879360614
|
||||||
|
T24675.xy: 3.1703609297698665
|
||||||
|
T24744.xy: 0.11053285060109477
|
||||||
|
T24817.xy: 2.316149667416408
|
||||||
|
T24894.xy: 0.5364199414541123
|
||||||
|
T24957.xy: -2.152460736629538
|
||||||
|
T25024.xy: -2.0971135573427073
|
||||||
|
T25092.xy: 2.091629797823038
|
||||||
|
T25152.xy: 2.4945719274003846
|
||||||
|
T25215.xy: 1.1069965768579215
|
||||||
|
T25286.xy: 2.1208495454024825
|
||||||
|
T25348.xy: 2.5511295565177003
|
||||||
|
T25418.xy: -2.908469183861368
|
||||||
|
T25492.xy: -1.9420736825064098
|
34
tests/spectraVictor2/order0/known_value_large_tol.yaml
Normal file
34
tests/spectraVictor2/order0/known_value_large_tol.yaml
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
T14143.xy: 123.95295558284394
|
||||||
|
T14211.xy: 115.26802909226424
|
||||||
|
T14283.xy: 115.70504212601391
|
||||||
|
T14354.xy: 116.09744924015496
|
||||||
|
T14432.xy: 115.5189035534501
|
||||||
|
T14503.xy: 113.26445263139607
|
||||||
|
T14573.xy: 113.32417457681417
|
||||||
|
T14642.xy: 113.39326934945271
|
||||||
|
T14714.xy: 112.32070148051518
|
||||||
|
T14787.xy: 108.97163127594759
|
||||||
|
T14857.xy: 109.64817699038785
|
||||||
|
T14927.xy: 107.22679420091224
|
||||||
|
T14993.xy: 107.32677769871788
|
||||||
|
T15063.xy: 106.35472238842755
|
||||||
|
T15136.xy: 105.39933227233728
|
||||||
|
T15206.xy: 104.03778591581003
|
||||||
|
T15277.xy: 102.33092796214031
|
||||||
|
T15350.xy: 100.8763921934027
|
||||||
|
T15418.xy: 100.49522871553593
|
||||||
|
T15492.xy: 99.08281468883276
|
||||||
|
T15562.xy: 97.3258169088354
|
||||||
|
T15633.xy: 95.90149574477304
|
||||||
|
T15706.xy: 95.4219114489226
|
||||||
|
T15777.xy: 93.9096812365406
|
||||||
|
T15838.xy: 93.38407856938173
|
||||||
|
T15910.xy: 91.74790491639014
|
||||||
|
T15981.xy: 91.22741714198933
|
||||||
|
T16127.xy: 88.5882756065361
|
||||||
|
T16203.xy: 87.67147079674957
|
||||||
|
T16267.xy: 87.09015257940483
|
||||||
|
T16335.xy: 85.72596923247862
|
||||||
|
T16406.xy: 84.17908589568572
|
||||||
|
T16481.xy: 83.45410256101752
|
||||||
|
T16545.xy: 82.12170648181431
|
64
tests/spectraVictor2/order1/known_to_fail.yaml
Normal file
64
tests/spectraVictor2/order1/known_to_fail.yaml
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
T09645.xy: 245.46033847050612
|
||||||
|
T09718.xy: 243.41903129124586
|
||||||
|
T09789.xy: 241.21949876883892
|
||||||
|
T09861.xy: 238.4571154091408
|
||||||
|
T09934.xy: 236.11845951107506
|
||||||
|
T10006.xy: 233.329724848239
|
||||||
|
T10078.xy: 230.23128301432772
|
||||||
|
T10148.xy: 227.2060868441092
|
||||||
|
T10219.xy: 225.02036582651868
|
||||||
|
T10292.xy: 222.3391859812666
|
||||||
|
T10365.xy: 219.36439123675694
|
||||||
|
T10434.xy: 216.8316887315054
|
||||||
|
T10508.xy: 214.65439233174595
|
||||||
|
T10578.xy: 212.6630194652351
|
||||||
|
T10652.xy: 209.35291515985267
|
||||||
|
T10720.xy: 207.53963211444182
|
||||||
|
T10792.xy: 205.202151932784
|
||||||
|
T10865.xy: 202.9202516375391
|
||||||
|
T10940.xy: 200.48951783003758
|
||||||
|
T11012.xy: 198.90498905791395
|
||||||
|
T11090.xy: 196.25923365123484
|
||||||
|
T11160.xy: 193.70937893792623
|
||||||
|
T11232.xy: 191.97930409523318
|
||||||
|
T11294.xy: 189.85169813518527
|
||||||
|
T11368.xy: 187.60277990913383
|
||||||
|
T11438.xy: 186.3322313281465
|
||||||
|
T11509.xy: 184.2324022567865
|
||||||
|
T11581.xy: 182.10502061232944
|
||||||
|
T11653.xy: 180.0894053909909
|
||||||
|
T11724.xy: 178.3073777205182
|
||||||
|
T11794.xy: 176.2873336683524
|
||||||
|
T11869.xy: 174.52572136333612
|
||||||
|
T11940.xy: 172.6550661404221
|
||||||
|
T12014.xy: 170.60551746889755
|
||||||
|
T12084.xy: 169.20956775306206
|
||||||
|
T12154.xy: 166.52192608722368
|
||||||
|
T12225.xy: 165.7733825398034
|
||||||
|
T12296.xy: 163.4955609022588
|
||||||
|
T12357.xy: 162.00360928305108
|
||||||
|
T12420.xy: 160.60197157017484
|
||||||
|
T12492.xy: 159.09096945370646
|
||||||
|
T12563.xy: 157.9826893495801
|
||||||
|
T12634.xy: 155.80700194703243
|
||||||
|
T12705.xy: 153.95358865552637
|
||||||
|
T12779.xy: 153.0679760117474
|
||||||
|
T12851.xy: 151.5209853112445
|
||||||
|
T12923.xy: 149.24454346116275
|
||||||
|
T12993.xy: 148.22548121802149
|
||||||
|
T13065.xy: 147.15842152075152
|
||||||
|
T13138.xy: 145.6549808317728
|
||||||
|
T13210.xy: 143.81696112077432
|
||||||
|
T13281.xy: 142.3835657314117
|
||||||
|
T13351.xy: 141.46124817523673
|
||||||
|
T13426.xy: 140.2439100090884
|
||||||
|
T13495.xy: 138.15716499894242
|
||||||
|
T13566.xy: 137.96533477180347
|
||||||
|
T13638.xy: 134.74094291420806
|
||||||
|
T13710.xy: 135.03189827660162
|
||||||
|
T13783.xy: 130.63269740906642
|
||||||
|
T13855.xy: 132.89681292564688
|
||||||
|
T13930.xy: 133.08843881850441
|
||||||
|
T13997.xy: 129.5682971991444
|
||||||
|
T14070.xy: 131.84919488958164
|
||||||
|
T14143.xy: 124.07482706766918
|
28
tests/test_fft.py
Normal file
28
tests/test_fft.py
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
import os.path
|
||||||
|
import numpy as np
|
||||||
|
from numpy.testing import assert_allclose
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
from optifik.fft import thickness_from_fft
|
||||||
|
from optifik.analysis import smooth_intensities
|
||||||
|
from optifik.io import load_spectrum
|
||||||
|
|
||||||
|
|
||||||
|
def test_FFT():
|
||||||
|
FOLDER = os.path.join('tests', 'basic')
|
||||||
|
FILE_NAME = '003582.xy'
|
||||||
|
expected = 3524.51
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
thickness_FFT = thickness_from_fft(lambdas,
|
||||||
|
smoothed_intensities,
|
||||||
|
refractive_index=r_index)
|
||||||
|
result = thickness_FFT.thickness
|
||||||
|
|
||||||
|
assert_allclose(result, expected, rtol=1e-1)
|
||||||
|
|
||||||
|
|
54
tests/test_minmax.py
Normal file
54
tests/test_minmax.py
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
import os.path
|
||||||
|
import numpy as np
|
||||||
|
from numpy.testing import assert_allclose
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
from optifik.minmax import thickness_from_minmax
|
||||||
|
from optifik.analysis import smooth_intensities
|
||||||
|
from optifik.io import load_spectrum
|
||||||
|
|
||||||
|
|
||||||
|
def test_minmax_ransac():
|
||||||
|
FOLDER = os.path.join('tests', 'basic')
|
||||||
|
FILE_NAME = '000004310.xy'
|
||||||
|
expected = 1338.35
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
prominence = 0.02
|
||||||
|
|
||||||
|
result = thickness_from_minmax(lambdas,
|
||||||
|
smoothed_intensities,
|
||||||
|
refractive_index=r_index,
|
||||||
|
min_peak_prominence=prominence,
|
||||||
|
method='ransac',
|
||||||
|
plot=False)
|
||||||
|
|
||||||
|
assert_allclose(result.thickness, expected, rtol=1e-1)
|
||||||
|
|
||||||
|
|
||||||
|
def test_minmax_linreg():
|
||||||
|
FOLDER = os.path.join('tests', 'basic')
|
||||||
|
FILE_NAME = '000004310.xy'
|
||||||
|
expected = 1338.35
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
prominence = 0.02
|
||||||
|
|
||||||
|
result = thickness_from_minmax(lambdas,
|
||||||
|
smoothed_intensities,
|
||||||
|
refractive_index=r_index,
|
||||||
|
min_peak_prominence=prominence,
|
||||||
|
method='linreg',
|
||||||
|
plot=False)
|
||||||
|
|
||||||
|
assert_allclose(result.thickness, expected, rtol=1e-1)
|
||||||
|
|
||||||
|
|
|
@ -3,55 +3,12 @@ import numpy as np
|
||||||
from numpy.testing import assert_allclose
|
from numpy.testing import assert_allclose
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
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_from_scheludko
|
||||||
from optifik.scheludko import get_default_start_stop_wavelengths
|
from optifik.scheludko import get_default_start_stop_wavelengths
|
||||||
from optifik.scheludko import thickness_for_order0
|
|
||||||
from optifik.analysis import smooth_intensities
|
from optifik.analysis import smooth_intensities
|
||||||
from optifik.io import load_spectrum
|
from optifik.io import load_spectrum
|
||||||
|
|
||||||
|
|
||||||
def test_FFT():
|
|
||||||
FOLDER = os.path.join('tests', 'basic')
|
|
||||||
FILE_NAME = '003582.xy'
|
|
||||||
expected = 3524.51
|
|
||||||
|
|
||||||
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)
|
|
||||||
|
|
||||||
thickness_FFT = thickness_from_fft(lambdas,
|
|
||||||
smoothed_intensities,
|
|
||||||
refractive_index=r_index)
|
|
||||||
result = thickness_FFT.thickness
|
|
||||||
|
|
||||||
assert_allclose(result, expected, rtol=1e-1)
|
|
||||||
|
|
||||||
|
|
||||||
def test_minmax_ransac():
|
|
||||||
FOLDER = os.path.join('tests', 'basic')
|
|
||||||
FILE_NAME = '000004310.xy'
|
|
||||||
expected = 1338.35
|
|
||||||
|
|
||||||
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)
|
|
||||||
|
|
||||||
prominence = 0.02
|
|
||||||
|
|
||||||
result = thickness_from_minmax(lambdas,
|
|
||||||
smoothed_intensities,
|
|
||||||
refractive_index=r_index,
|
|
||||||
min_peak_prominence=prominence,
|
|
||||||
method='ransac',
|
|
||||||
plot=False)
|
|
||||||
|
|
||||||
assert_allclose(result.thickness, expected, rtol=1e-1)
|
|
||||||
|
|
||||||
|
|
||||||
def test_scheludko_4peaks():
|
def test_scheludko_4peaks():
|
||||||
FOLDER = os.path.join('tests', 'basic')
|
FOLDER = os.path.join('tests', 'basic')
|
||||||
FILE_NAME = '000005253.xy'
|
FILE_NAME = '000005253.xy'
|
||||||
|
@ -126,11 +83,16 @@ def test_order0():
|
||||||
prominence = 0.03
|
prominence = 0.03
|
||||||
|
|
||||||
|
|
||||||
result = thickness_for_order0(lambdas, smoothed_intensities,
|
w_start, w_stop = None, None
|
||||||
|
result = thickness_from_scheludko(lambdas,
|
||||||
|
smoothed_intensities,
|
||||||
refractive_index=r_index,
|
refractive_index=r_index,
|
||||||
min_peak_prominence=prominence,
|
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)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue