chemotools 0.0.27__py3-none-any.whl → 0.0.28__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- chemotools/baseline/constant_baseline_correction.py +0 -2
- chemotools/datasets/__init__.py +1 -0
- chemotools/datasets/_base.py +17 -0
- chemotools/datasets/data/coffee_labels.csv +61 -0
- chemotools/datasets/data/coffee_spectra.csv +61 -0
- chemotools/scale/point_scaler.py +0 -2
- chemotools/variable_selection/range_cut.py +0 -2
- {chemotools-0.0.27.dist-info → chemotools-0.0.28.dist-info}/METADATA +1 -1
- {chemotools-0.0.27.dist-info → chemotools-0.0.28.dist-info}/RECORD +14 -12
- tests/test_datasets.py +14 -1
- tests/test_functionality.py +25 -0
- {chemotools-0.0.27.dist-info → chemotools-0.0.28.dist-info}/LICENSE +0 -0
- {chemotools-0.0.27.dist-info → chemotools-0.0.28.dist-info}/WHEEL +0 -0
- {chemotools-0.0.27.dist-info → chemotools-0.0.28.dist-info}/top_level.txt +0 -0
chemotools/scale/point_scaler.py
CHANGED
@@ -114,7 +114,5 @@ class PointScaler(OneToOneFeatureMixin, BaseEstimator, TransformerMixin):
|
|
114
114
|
return X_.reshape(-1, 1) if X_.ndim == 1 else X_
|
115
115
|
|
116
116
|
def _find_index(self, target: float) -> int:
|
117
|
-
if self.wavenumbers is None:
|
118
|
-
return target
|
119
117
|
wavenumbers = np.array(self.wavenumbers)
|
120
118
|
return np.argmin(np.abs(wavenumbers - target))
|
@@ -130,7 +130,5 @@ class RangeCut(OneToOneFeatureMixin, BaseEstimator, TransformerMixin):
|
|
130
130
|
return X_[:, self.start_index_ : self.end_index_]
|
131
131
|
|
132
132
|
def _find_index(self, target: float) -> int:
|
133
|
-
if self.wavenumbers is None:
|
134
|
-
return target
|
135
133
|
wavenumbers = np.array(self.wavenumbers)
|
136
134
|
return np.argmin(np.abs(wavenumbers - target))
|
@@ -2,15 +2,17 @@ chemotools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
2
|
chemotools/baseline/__init__.py,sha256=W61mEZU_9-sVGRkP2MJOIhd6e9KsOS1BYjxm1NOMIyM,373
|
3
3
|
chemotools/baseline/air_pls.py,sha256=qn03l66IrxW7woFbRmRqCmfZHzQ7KKW8A7ogTxTHKo0,5443
|
4
4
|
chemotools/baseline/ar_pls.py,sha256=OY2cpU2X6KIBR9ag3PAJXo_uQbniIV58zbUJxCxvZWs,4736
|
5
|
-
chemotools/baseline/constant_baseline_correction.py,sha256=
|
5
|
+
chemotools/baseline/constant_baseline_correction.py,sha256=97xpKOBOwT5EhrD5tf32ZfkyZpf0_bL-VtyUFng1hn4,4158
|
6
6
|
chemotools/baseline/cubic_spline_correction.py,sha256=PCHqR7TAhbdlTZrxgedlk0PU0kRUwQd_jymh0g-ieo8,3311
|
7
7
|
chemotools/baseline/linear_correction.py,sha256=6Sw2n4QTvIDKWRdJpFD48hMvOEwqbctUAQLF1WwcoXs,3381
|
8
8
|
chemotools/baseline/non_negative.py,sha256=17_82l95U9kgoQ3Pdz3-jGv8B51JzqPdHODt6PegWRw,2864
|
9
9
|
chemotools/baseline/polynomial_correction.py,sha256=caP866fwZb7PASyz6oezgg8hdZtFMT0EimK89TGSTSc,4059
|
10
10
|
chemotools/baseline/subtract_reference.py,sha256=Pht87XadXK0URq2fun66OHaUk_cx56AkF84ta3VJy_8,3441
|
11
|
-
chemotools/datasets/__init__.py,sha256=
|
12
|
-
chemotools/datasets/_base.py,sha256=
|
11
|
+
chemotools/datasets/__init__.py,sha256=ojqxb-C_eDmizwUqVCJ8BqJxwULD7_hWCyVIA1uRO0c,116
|
12
|
+
chemotools/datasets/_base.py,sha256=Z174CaIlpx17Yu8Pg1qZPuHWkS3BYWn7gtOYsoe8zNk,2895
|
13
13
|
chemotools/datasets/data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
14
|
+
chemotools/datasets/data/coffee_labels.csv,sha256=ZXQWQIf8faLHjdnHfRoXfxMR56kq9Q1BGPZBkQyhGlY,487
|
15
|
+
chemotools/datasets/data/coffee_spectra.csv,sha256=VA-sN4u0hC5iALlRxxkj-K87Lz3b3mmUHBJPoDXychI,2206147
|
14
16
|
chemotools/datasets/data/fermentation_hplc.csv,sha256=AMmiFQxwaXrH8aN310-3h1YQDiDrT8JNRv1RDvhEvg4,2140
|
15
17
|
chemotools/datasets/data/fermentation_spectra.csv,sha256=MaaNMQP0lygJgFbEoUX0OUqdA-id8mF5Llvf_vj9tJk,15237508
|
16
18
|
chemotools/datasets/data/train_hplc.csv,sha256=DjtmqiePOWB-F6TsOGFngE1pKyXkb7Xmsi-1CLxsTnE,249
|
@@ -21,7 +23,7 @@ chemotools/derivative/savitzky_golay.py,sha256=fFzQRVGVXQIUkHp1x9dqfLVPlyStubIhS
|
|
21
23
|
chemotools/scale/__init__.py,sha256=HuXy_TktvXLTMWoW0pKhVCzMOkRkMRnvWCGiIKvjvZ8,115
|
22
24
|
chemotools/scale/min_max_scaler.py,sha256=f1bGkODTWGwfnfMfWPimVxIZC3WIikgthQh-zUiaQUU,3123
|
23
25
|
chemotools/scale/norm_scaler.py,sha256=qNs-npf5Jqcp8RYqt88_5-zwd-yIo-J1jItgUTFeozs,2699
|
24
|
-
chemotools/scale/point_scaler.py,sha256=
|
26
|
+
chemotools/scale/point_scaler.py,sha256=LGSmZwuEYLxzVPgH-_aRk9SjOdmyQTxdguqRdBfqCwc,3540
|
25
27
|
chemotools/scatter/__init__.py,sha256=M0_B4hXVoDc2Qx00QreUfhFqPUTs6LbU4CWaFU17hg4,288
|
26
28
|
chemotools/scatter/extended_multiplicative_scatter_correction.py,sha256=J65hyEFBzKNo_35Ta9MKWO35CjTw-8hDbSr8xd8RIfc,6912
|
27
29
|
chemotools/scatter/multiplicative_scatter_correction.py,sha256=MFemiwS-KWFOtlcXVhLnY4mn6QQ8pttuj6UP0rodXEM,5689
|
@@ -35,15 +37,15 @@ chemotools/smooth/whittaker_smooth.py,sha256=OVEYEstsURgkLbjwRiBWeN_XNs_JOFeD60u
|
|
35
37
|
chemotools/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
36
38
|
chemotools/utils/check_inputs.py,sha256=fRAV4HIaGamdj_PNXSNnl7LurXytACNTGO51rhPpMUY,512
|
37
39
|
chemotools/variable_selection/__init__.py,sha256=6gKxCAoGKAOhhTerUyBg_62YKCIr0K4mbDcoDfbMJeA,75
|
38
|
-
chemotools/variable_selection/range_cut.py,sha256=
|
40
|
+
chemotools/variable_selection/range_cut.py,sha256=1uH_nwYXEn_N1NY14n4uXpVvO6VVpM8zHea1cbHyZu4,4141
|
39
41
|
chemotools/variable_selection/select_features.py,sha256=pcoFmGZLUPjtRytGpnqK8YdVj3Z5hwKGSJ10VxCpg58,4164
|
40
42
|
tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
41
43
|
tests/fixtures.py,sha256=Xa-Vd62Kd1fyWg3PLUSP6iIkOK8etrbyOkMJTn3dvX8,1933
|
42
|
-
tests/test_datasets.py,sha256=
|
43
|
-
tests/test_functionality.py,sha256=
|
44
|
+
tests/test_datasets.py,sha256=_3mMDYC-vUnb5BenMqvuhmkHI2PPIdsyq_nNu2ggH20,1055
|
45
|
+
tests/test_functionality.py,sha256=QKfFFy_0XBDH36BK8mnkG0-UIVcPXb9PQgiPmjfJrWA,17629
|
44
46
|
tests/test_sklearn_compliance.py,sha256=-DxSrJEK-sayGTYimTQFa4rJu93PtyBz91a5r5lCNXw,4773
|
45
|
-
chemotools-0.0.
|
46
|
-
chemotools-0.0.
|
47
|
-
chemotools-0.0.
|
48
|
-
chemotools-0.0.
|
49
|
-
chemotools-0.0.
|
47
|
+
chemotools-0.0.28.dist-info/LICENSE,sha256=qtyOy2wDQVX9hxp58h3T-6Lmfv-mSCHoSRkcLUdM9bg,1070
|
48
|
+
chemotools-0.0.28.dist-info/METADATA,sha256=WoCex9zO64rzBxbdK8WIVFE71ICyS1DY1w2CXc0aOvY,5015
|
49
|
+
chemotools-0.0.28.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
|
50
|
+
chemotools-0.0.28.dist-info/top_level.txt,sha256=eNcNcKSdo-1H_2gwSDrS__dr7BM3R73Cnn-pBiW5FEw,17
|
51
|
+
chemotools-0.0.28.dist-info/RECORD,,
|
tests/test_datasets.py
CHANGED
@@ -1,6 +1,19 @@
|
|
1
1
|
import pandas as pd
|
2
2
|
|
3
|
-
from chemotools.datasets import load_fermentation_test, load_fermentation_train
|
3
|
+
from chemotools.datasets import load_coffee, load_fermentation_test, load_fermentation_train
|
4
|
+
|
5
|
+
|
6
|
+
def test_load_coffee():
|
7
|
+
# Arrange
|
8
|
+
|
9
|
+
# Act
|
10
|
+
coffee_spectra, coffee_labels = load_coffee()
|
11
|
+
|
12
|
+
# Assert
|
13
|
+
assert coffee_spectra.shape == (60, 1841)
|
14
|
+
assert coffee_labels.shape == (60, 1)
|
15
|
+
assert isinstance(coffee_spectra, pd.DataFrame)
|
16
|
+
assert isinstance(coffee_labels, pd.DataFrame)
|
4
17
|
|
5
18
|
|
6
19
|
def test_load_fermentation_test():
|
tests/test_functionality.py
CHANGED
@@ -115,6 +115,19 @@ def test_extended_baseline_correction_with_weights():
|
|
115
115
|
assert np.allclose(spectrum_emsc[0], reference, atol=1e-8)
|
116
116
|
|
117
117
|
|
118
|
+
def test_extended_baseline_correction_with_no_reference():
|
119
|
+
# Arrange
|
120
|
+
spectrum = np.array([1.0, 2.0, 3.0, 4.0, 5.0]).reshape(1, -1)
|
121
|
+
|
122
|
+
# Act
|
123
|
+
emsc = ExtendedMultiplicativeScatterCorrection(use_mean=False, use_median=False)
|
124
|
+
|
125
|
+
# Assert
|
126
|
+
with pytest.raises(ValueError):
|
127
|
+
emsc.fit_transform(spectrum)
|
128
|
+
|
129
|
+
|
130
|
+
|
118
131
|
def test_extended_baseline_correction_with_wrong_reference():
|
119
132
|
# Arrange
|
120
133
|
spectrum = np.array([1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0]).reshape(
|
@@ -546,6 +559,18 @@ def test_saviszky_golay_filter_3():
|
|
546
559
|
def test_select_features():
|
547
560
|
# Arrange
|
548
561
|
spectrum = np.array([[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]])
|
562
|
+
|
563
|
+
# Act
|
564
|
+
select_features = SelectFeatures()
|
565
|
+
spectrum_corrected = select_features.fit_transform(spectrum)
|
566
|
+
|
567
|
+
# Assert
|
568
|
+
assert np.allclose(spectrum_corrected[0], spectrum[0], atol=1e-8)
|
569
|
+
|
570
|
+
|
571
|
+
def test_select_features_with_index():
|
572
|
+
# Arrange
|
573
|
+
spectrum = np.array([[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]])
|
549
574
|
expected = np.array([[1, 2, 3, 8, 9, 10]])
|
550
575
|
|
551
576
|
# Act
|
File without changes
|
File without changes
|
File without changes
|