chemotools 0.1.5__py3-none-any.whl → 0.1.7__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.
Files changed (50) hide show
  1. chemotools/augmentation/__init__.py +10 -0
  2. chemotools/augmentation/baseline_shift.py +23 -15
  3. chemotools/augmentation/exponential_noise.py +24 -15
  4. chemotools/augmentation/index_shift.py +104 -16
  5. chemotools/augmentation/normal_noise.py +24 -14
  6. chemotools/augmentation/spectrum_scale.py +24 -15
  7. chemotools/augmentation/uniform_noise.py +26 -14
  8. chemotools/baseline/__init__.py +13 -1
  9. chemotools/baseline/_air_pls.py +16 -14
  10. chemotools/baseline/_ar_pls.py +17 -17
  11. chemotools/baseline/_constant_baseline_correction.py +19 -16
  12. chemotools/baseline/_cubic_spline_correction.py +17 -8
  13. chemotools/baseline/_linear_correction.py +18 -10
  14. chemotools/baseline/_non_negative.py +14 -8
  15. chemotools/baseline/_polynomial_correction.py +19 -11
  16. chemotools/baseline/_subtract_reference.py +17 -9
  17. chemotools/datasets/__init__.py +2 -0
  18. chemotools/datasets/_base.py +3 -3
  19. chemotools/derivative/__init__.py +3 -1
  20. chemotools/derivative/_norris_william.py +14 -8
  21. chemotools/derivative/_savitzky_golay.py +25 -21
  22. chemotools/feature_selection/__init__.py +2 -0
  23. chemotools/feature_selection/_index_selector.py +18 -17
  24. chemotools/feature_selection/_range_cut.py +9 -7
  25. chemotools/scale/__init__.py +2 -0
  26. chemotools/scale/_min_max_scaler.py +14 -8
  27. chemotools/scale/_norm_scaler.py +14 -8
  28. chemotools/scale/_point_scaler.py +18 -10
  29. chemotools/scatter/__init__.py +11 -2
  30. chemotools/scatter/_extended_multiplicative_scatter_correction.py +33 -29
  31. chemotools/scatter/_multiplicative_scatter_correction.py +33 -18
  32. chemotools/scatter/_robust_normal_variate.py +14 -8
  33. chemotools/scatter/_standard_normal_variate.py +14 -8
  34. chemotools/smooth/__init__.py +3 -1
  35. chemotools/smooth/_mean_filter.py +14 -8
  36. chemotools/smooth/_median_filter.py +31 -9
  37. chemotools/smooth/_savitzky_golay_filter.py +20 -9
  38. chemotools/smooth/_whittaker_smooth.py +20 -11
  39. {chemotools-0.1.5.dist-info → chemotools-0.1.7.dist-info}/METADATA +18 -17
  40. chemotools-0.1.7.dist-info/RECORD +51 -0
  41. {chemotools-0.1.5.dist-info → chemotools-0.1.7.dist-info}/WHEEL +1 -2
  42. chemotools/utils/check_inputs.py +0 -14
  43. chemotools-0.1.5.dist-info/RECORD +0 -58
  44. chemotools-0.1.5.dist-info/top_level.txt +0 -2
  45. tests/__init__.py +0 -0
  46. tests/fixtures.py +0 -89
  47. tests/test_datasets.py +0 -111
  48. tests/test_functionality.py +0 -777
  49. tests/test_sklearn_compliance.py +0 -277
  50. {chemotools-0.1.5.dist-info → chemotools-0.1.7.dist-info}/LICENSE +0 -0
@@ -1,12 +1,12 @@
1
+ from typing import Literal
2
+
1
3
  import numpy as np
2
4
  from scipy.ndimage import median_filter
3
5
  from sklearn.base import BaseEstimator, TransformerMixin, OneToOneFeatureMixin
4
- from sklearn.utils.validation import check_is_fitted
5
-
6
- from chemotools.utils.check_inputs import check_input
6
+ from sklearn.utils.validation import check_is_fitted, validate_data
7
7
 
8
8
 
9
- class MedianFilter(OneToOneFeatureMixin, BaseEstimator, TransformerMixin):
9
+ class MedianFilter(TransformerMixin, OneToOneFeatureMixin, BaseEstimator):
10
10
  """
11
11
  A transformer that calculates the median filter of the input data.
12
12
 
@@ -27,7 +27,21 @@ class MedianFilter(OneToOneFeatureMixin, BaseEstimator, TransformerMixin):
27
27
  transform(X, y=0, copy=True)
28
28
  Transform the input data by calculating the median filter.
29
29
  """
30
- def __init__(self, window_size: int = 3, mode: str = 'nearest') -> None:
30
+
31
+ def __init__(
32
+ self,
33
+ window_size: int = 3,
34
+ mode: Literal[
35
+ "reflect",
36
+ "constant",
37
+ "nearest",
38
+ "mirror",
39
+ "wrap",
40
+ "grid-constant",
41
+ "grid-mirror",
42
+ "grid-wrap",
43
+ ] = "nearest",
44
+ ) -> None:
31
45
  self.window_size = window_size
32
46
  self.mode = mode
33
47
 
@@ -49,8 +63,9 @@ class MedianFilter(OneToOneFeatureMixin, BaseEstimator, TransformerMixin):
49
63
  The fitted transformer.
50
64
  """
51
65
  # Check that X is a 2D array and has only finite values
52
- X = self._validate_data(X)
53
-
66
+ X = validate_data(
67
+ self, X, y="no_validation", ensure_2d=True, reset=True, dtype=np.float64
68
+ )
54
69
  return self
55
70
 
56
71
  def transform(self, X: np.ndarray, y=None) -> np.ndarray:
@@ -74,8 +89,15 @@ class MedianFilter(OneToOneFeatureMixin, BaseEstimator, TransformerMixin):
74
89
  check_is_fitted(self, "n_features_in_")
75
90
 
76
91
  # Check that X is a 2D array and has only finite values
77
- X = check_input(X)
78
- X_ = X.copy()
92
+ X_ = validate_data(
93
+ self,
94
+ X,
95
+ y="no_validation",
96
+ ensure_2d=True,
97
+ copy=True,
98
+ reset=False,
99
+ dtype=np.float64,
100
+ )
79
101
 
80
102
  if X_.shape[1] != self.n_features_in_:
81
103
  raise ValueError(
@@ -1,12 +1,12 @@
1
+ from typing import Literal
2
+
1
3
  import numpy as np
2
4
  from scipy.signal import savgol_filter
3
5
  from sklearn.base import BaseEstimator, TransformerMixin, OneToOneFeatureMixin
4
- from sklearn.utils.validation import check_is_fitted
5
-
6
- from chemotools.utils.check_inputs import check_input
6
+ from sklearn.utils.validation import check_is_fitted, validate_data
7
7
 
8
8
 
9
- class SavitzkyGolayFilter(OneToOneFeatureMixin, BaseEstimator, TransformerMixin):
9
+ class SavitzkyGolayFilter(TransformerMixin, OneToOneFeatureMixin, BaseEstimator):
10
10
  """
11
11
  A transformer that calculates the Savitzky-Golay filter of the input data.
12
12
 
@@ -34,7 +34,10 @@ class SavitzkyGolayFilter(OneToOneFeatureMixin, BaseEstimator, TransformerMixin)
34
34
  """
35
35
 
36
36
  def __init__(
37
- self, window_size: int = 3, polynomial_order: int = 1, mode: str = "nearest"
37
+ self,
38
+ window_size: int = 3,
39
+ polynomial_order: int = 1,
40
+ mode: Literal["mirror", "constant", "nearest", "wrap", "interp"] = "nearest",
38
41
  ) -> None:
39
42
  self.window_size = window_size
40
43
  self.polynomial_order = polynomial_order
@@ -58,8 +61,9 @@ class SavitzkyGolayFilter(OneToOneFeatureMixin, BaseEstimator, TransformerMixin)
58
61
  The fitted transformer.
59
62
  """
60
63
  # Check that X is a 2D array and has only finite values
61
- self._validate_data(X)
62
-
64
+ X = validate_data(
65
+ self, X, y="no_validation", ensure_2d=True, reset=True, dtype=np.float64
66
+ )
63
67
  return self
64
68
 
65
69
  def transform(self, X: np.ndarray, y=None) -> np.ndarray:
@@ -83,8 +87,15 @@ class SavitzkyGolayFilter(OneToOneFeatureMixin, BaseEstimator, TransformerMixin)
83
87
  check_is_fitted(self, "n_features_in_")
84
88
 
85
89
  # Check that X is a 2D array and has only finite values
86
- X = check_input(X)
87
- X_ = X.copy()
90
+ X_ = validate_data(
91
+ self,
92
+ X,
93
+ y="no_validation",
94
+ ensure_2d=True,
95
+ copy=True,
96
+ reset=False,
97
+ dtype=np.float64,
98
+ )
88
99
 
89
100
  if X_.shape[1] != self.n_features_in_:
90
101
  raise ValueError(
@@ -2,17 +2,17 @@ import numpy as np
2
2
  from scipy.sparse import csc_matrix, eye, diags
3
3
  from scipy.sparse.linalg import spsolve
4
4
  from sklearn.base import BaseEstimator, TransformerMixin, OneToOneFeatureMixin
5
- from sklearn.utils.validation import check_is_fitted
5
+ from sklearn.utils.validation import (
6
+ check_is_fitted,
7
+ validate_data,
8
+ ) # This code is adapted from the following source:
6
9
 
7
- from chemotools.utils.check_inputs import check_input
8
-
9
- # This code is adapted from the following source:
10
- # Z.-M. Zhang, S. Chen, and Y.-Z. Liang,
11
- # Baseline correction using adaptive iteratively reweighted penalized least squares.
10
+ # Z.-M. Zhang, S. Chen, and Y.-Z. Liang,
11
+ # Baseline correction using adaptive iteratively reweighted penalized least squares.
12
12
  # Analyst 135 (5), 1138-1146 (2010).
13
13
 
14
14
 
15
- class WhittakerSmooth(OneToOneFeatureMixin, BaseEstimator, TransformerMixin):
15
+ class WhittakerSmooth(TransformerMixin, OneToOneFeatureMixin, BaseEstimator):
16
16
  """
17
17
  A transformer that calculates the Whittaker smooth of the input data.
18
18
 
@@ -32,6 +32,7 @@ class WhittakerSmooth(OneToOneFeatureMixin, BaseEstimator, TransformerMixin):
32
32
  transform(X, y=0, copy=True)
33
33
  Transform the input data by calculating the Whittaker smooth.
34
34
  """
35
+
35
36
  def __init__(
36
37
  self,
37
38
  lam: float = 1e2,
@@ -58,8 +59,9 @@ class WhittakerSmooth(OneToOneFeatureMixin, BaseEstimator, TransformerMixin):
58
59
  The fitted transformer.
59
60
  """
60
61
  # Check that X is a 2D array and has only finite values
61
- X = self._validate_data(X)
62
-
62
+ X = validate_data(
63
+ self, X, y="no_validation", ensure_2d=True, reset=True, dtype=np.float64
64
+ )
63
65
  return self
64
66
 
65
67
  def transform(self, X: np.ndarray, y=None) -> np.ndarray:
@@ -83,8 +85,15 @@ class WhittakerSmooth(OneToOneFeatureMixin, BaseEstimator, TransformerMixin):
83
85
  check_is_fitted(self, "n_features_in_")
84
86
 
85
87
  # Check that X is a 2D array and has only finite values
86
- X = check_input(X)
87
- X_ = X.copy()
88
+ X_ = validate_data(
89
+ self,
90
+ X,
91
+ y="no_validation",
92
+ ensure_2d=True,
93
+ copy=True,
94
+ reset=False,
95
+ dtype=np.float64,
96
+ )
88
97
 
89
98
  # Check that the number of features is the same as the fitted data
90
99
  if X_.shape[1] != self.n_features_in_:
@@ -1,23 +1,22 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: chemotools
3
- Version: 0.1.5
4
- Summary: Package to integrate chemometrics in scikit-learn pipelines
5
- Home-page: https://github.com/paucablop/chemotools
6
- Author: Pau Cabaneros Lopez
7
- Author-email: pau.cabaneros@gmail.com
8
- Project-URL: Bug Tracker, https://github.com/paucablop/chemotools/issues/
9
- Classifier: Programming Language :: Python :: 3
3
+ Version: 0.1.7
4
+ Summary: chemotools: A Python Package that Integrates Chemometrics and scikit-learn
5
+ License: MIT
6
+ Author: Pau Cabaneros
7
+ Requires-Python: >=3.10,<4.0
10
8
  Classifier: License :: OSI Approved :: MIT License
11
- Classifier: Operating System :: OS Independent
12
- Requires-Python: >=3.9
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Programming Language :: Python :: 3.10
11
+ Classifier: Programming Language :: Python :: 3.11
12
+ Classifier: Programming Language :: Python :: 3.12
13
+ Classifier: Programming Language :: Python :: 3.13
14
+ Requires-Dist: numpy (>=2.0.0,<3.0.0)
15
+ Requires-Dist: pandas (>=2.0.0,<3.0.0)
16
+ Requires-Dist: polars (>=1.17.0,<2.0.0)
17
+ Requires-Dist: pyarrow (>=18.0.0,<19.0.0)
18
+ Requires-Dist: scikit-learn (>=1.4.0,<2.0.0)
13
19
  Description-Content-Type: text/markdown
14
- License-File: LICENSE
15
- Requires-Dist: numpy
16
- Requires-Dist: pandas
17
- Requires-Dist: polars
18
- Requires-Dist: pyarrow
19
- Requires-Dist: scipy
20
- Requires-Dist: scikit-learn >=1.4.0
21
20
 
22
21
  ![chemotools](assets/images/logo_pixel.png)
23
22
 
@@ -27,6 +26,8 @@ Requires-Dist: scikit-learn >=1.4.0
27
26
  [![pypi](https://img.shields.io/pypi/l/chemotools)](https://github.com/paucablop/chemotools/blob/main/LICENSE)
28
27
  [![codecov](https://codecov.io/github/paucablop/chemotools/branch/main/graph/badge.svg?token=D7JUJM89LN)](https://codecov.io/github/paucablop/chemotools)
29
28
  [![Downloads](https://static.pepy.tech/badge/chemotools)](https://pepy.tech/project/chemotools)
29
+ [![DOI](https://joss.theoj.org/papers/10.21105/joss.06802/status.svg)](https://doi.org/10.21105/joss.06802)
30
+
30
31
 
31
32
  # __chemotools__
32
33
 
@@ -0,0 +1,51 @@
1
+ chemotools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ chemotools/augmentation/__init__.py,sha256=xIUoWov_aluoW5L3zpVAahyPdkWA5erApW-duzdE_9A,385
3
+ chemotools/augmentation/baseline_shift.py,sha256=kIlYvmKS9pu9vh_-eZ7PSHPuH_58V9mgYbSJt6Gq3BA,3476
4
+ chemotools/augmentation/exponential_noise.py,sha256=fhZ4zQGGqmW-OiSu388th6IhgXrFj1xOguqKYAgj8Y4,3348
5
+ chemotools/augmentation/index_shift.py,sha256=w1maDHGLAKSiGAQ8c9yYHofs_PJnxeN0nB1RU-pINcE,6042
6
+ chemotools/augmentation/normal_noise.py,sha256=-se2Xv1pAWt9HY7H5yC4XlxRArPKZWGeTy2MdyN4lBE,3318
7
+ chemotools/augmentation/spectrum_scale.py,sha256=hMsmzXpssbI7tGm_YnQn9wjbByso3CgVxd3Hs8kfLS8,3442
8
+ chemotools/augmentation/uniform_noise.py,sha256=8a-AYzEDIkLckL6FK2i8mr_jXnQGcFaKXh_roGCICaQ,3456
9
+ chemotools/baseline/__init__.py,sha256=VzoblGg8Hx_FkTc_n7a-ZjGvtKP8JE_NwJKWenGFQkM,584
10
+ chemotools/baseline/_air_pls.py,sha256=eotXuIEsus7Z-c17oLx8UbiwOHM7DzQJ6rruHnwCGPQ,5067
11
+ chemotools/baseline/_ar_pls.py,sha256=Cl0tN0DGQA8JpnbIge4cBqT7aGQ7yltppYEDI6tWqiM,4385
12
+ chemotools/baseline/_constant_baseline_correction.py,sha256=2ARXIma3m_He5KJs0t0Bz3m0Hd7CNHDR4Dd4XfjMWgs,3893
13
+ chemotools/baseline/_cubic_spline_correction.py,sha256=Qr8jLwAM4JIcD-8G6BBU2vLSLyi44iHiIpJrHyZ6qJE,3432
14
+ chemotools/baseline/_linear_correction.py,sha256=jYUy1q5hlBIhoQr5yPWbqr65pTK8NCVPdJdjVg1SFtg,3258
15
+ chemotools/baseline/_non_negative.py,sha256=0Huq4fKAzAoX9nr6Fk-Awx5xBqmah4jTcn0TY31FJQc,2741
16
+ chemotools/baseline/_polynomial_correction.py,sha256=jzoTyj5a9dHBtefTKVer8CVpCwWqV25Ruj7mq7Ra_PI,4005
17
+ chemotools/baseline/_subtract_reference.py,sha256=B92DAYJmJR5VtWTM7Q6_orvIl2xaadmvbGr1r_ZJALA,3379
18
+ chemotools/datasets/__init__.py,sha256=WcchczWPH-A22DmYEnz2-u8A6vfVviJ6tOCBB0zaIAU,196
19
+ chemotools/datasets/_base.py,sha256=g_-R6c9WI5lt_j40FgA_mvEFzFHM9eGW6hj9d1e29P4,4883
20
+ chemotools/datasets/data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
21
+ chemotools/datasets/data/coffee_labels.csv,sha256=ZXQWQIf8faLHjdnHfRoXfxMR56kq9Q1BGPZBkQyhGlY,487
22
+ chemotools/datasets/data/coffee_spectra.csv,sha256=VA-sN4u0hC5iALlRxxkj-K87Lz3b3mmUHBJPoDXychI,2206147
23
+ chemotools/datasets/data/fermentation_hplc.csv,sha256=AMmiFQxwaXrH8aN310-3h1YQDiDrT8JNRv1RDvhEvg4,2140
24
+ chemotools/datasets/data/fermentation_spectra.csv,sha256=MaaNMQP0lygJgFbEoUX0OUqdA-id8mF5Llvf_vj9tJk,15237508
25
+ chemotools/datasets/data/train_hplc.csv,sha256=DjtmqiePOWB-F6TsOGFngE1pKyXkb7Xmsi-1CLxsTnE,249
26
+ chemotools/datasets/data/train_spectra.csv,sha256=iVF19W52NHlbqq8BbLomn8n47kSPT0QxJv7wtQX4yjQ,203244
27
+ chemotools/derivative/__init__.py,sha256=FkckdzO30jrRWPGpIU3cfnaTtxPtNT5Tb2G9F9PmVTw,134
28
+ chemotools/derivative/_norris_william.py,sha256=rMY_yntpiB5fbSM1tPph4AaGmF1k-HqJp7o48ijePBs,4958
29
+ chemotools/derivative/_savitzky_golay.py,sha256=CuCrKoLmrB1YmJ4ihIykgkL3tO3frqkStMogtsVhO3A,3632
30
+ chemotools/feature_selection/__init__.py,sha256=1_i28hIxijjwhMypTy1w2fLbzXXVkKD5IYzzY8ZSuHw,117
31
+ chemotools/feature_selection/_index_selector.py,sha256=lNTP2b7P3doWl30KiAr3Xd2HOMxeUmj24MuqoXl4Voc,3556
32
+ chemotools/feature_selection/_range_cut.py,sha256=lVVVC30ZsK2z9jsDGb_z6l8Ty2I89yM05_dIDbMP73Q,3564
33
+ chemotools/scale/__init__.py,sha256=eztqcHg-TKE1Rr0N9ArfytHk8teuqVfi4SZi2DS96vc,175
34
+ chemotools/scale/_min_max_scaler.py,sha256=YvqRkV2pXu-viQrpjzWcp9KmSSCYSoubSnrZHRLqgKQ,3011
35
+ chemotools/scale/_norm_scaler.py,sha256=CHWSir2q-pL1hxzw_ZB45yi4mw-SkJ4YOa1CUL4nm2I,2568
36
+ chemotools/scale/_point_scaler.py,sha256=je-vomAk7g3Q7yxmisQK4-3ndKEKI2wDwLrUiNuwzzA,3505
37
+ chemotools/scatter/__init__.py,sha256=ftyC_MGurzxpWMie8WlFDGh5ylalK2K3aCSN4qUzQAw,459
38
+ chemotools/scatter/_extended_multiplicative_scatter_correction.py,sha256=2OitT0QBYepvigmfmfpGWOLjq9y3iycOdTt-WhqLNhs,6801
39
+ chemotools/scatter/_multiplicative_scatter_correction.py,sha256=XKa19Vk7F6-JxWPMIt7qmxdySdbliAVJwsKwPhY02O0,6097
40
+ chemotools/scatter/_robust_normal_variate.py,sha256=nPfcvjHEpwkcSCjdvD86WN9q2wVMCeZ2Z8wMzcBpM3Y,3110
41
+ chemotools/scatter/_standard_normal_variate.py,sha256=22mJzbbZoXQY-_hHAhGO0vzfYwr3oMqaR6xPjJryHtk,2582
42
+ chemotools/smooth/__init__.py,sha256=G8JvAoBK9d18-k6XgukqN6dbJP-dsEgeDdbKbZdCIkA,265
43
+ chemotools/smooth/_mean_filter.py,sha256=KVAqOzYWv-SnDX2HD3zLWSSDNePi2Zy3EV9NwIX2H38,2827
44
+ chemotools/smooth/_median_filter.py,sha256=9ndTJCwrZirWlvDNldiigMddy79KIGq9OwwYNSXaw14,3111
45
+ chemotools/smooth/_savitzky_golay_filter.py,sha256=27iFUWxdL9_7oZabR0R5L0ZTpBmYfVUjx2XCTukihBE,3509
46
+ chemotools/smooth/_whittaker_smooth.py,sha256=lpLAyf4GdyDW4ulT1nyEoK6xQEl2cVUKquawQdGWbHU,3571
47
+ chemotools/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
48
+ chemotools-0.1.7.dist-info/LICENSE,sha256=qtyOy2wDQVX9hxp58h3T-6Lmfv-mSCHoSRkcLUdM9bg,1070
49
+ chemotools-0.1.7.dist-info/METADATA,sha256=cLjx8z4fGKdTHdIyDZ1VGd6WgXX-WlXtw9OwqaYm0Fo,5239
50
+ chemotools-0.1.7.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
51
+ chemotools-0.1.7.dist-info/RECORD,,
@@ -1,5 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.42.0)
2
+ Generator: poetry-core 2.0.1
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
-
@@ -1,14 +0,0 @@
1
- from sklearn.utils.validation import check_array
2
-
3
-
4
- def check_input(X, y=None):
5
- # Check that X is a 2D array and has only finite values
6
- X = check_array(X, ensure_2d=True, force_all_finite=True)
7
-
8
- # Check that y is None or a 1D array of the same length as X
9
- if y is not None:
10
- y = y.reshape(-1, 1) if y.ndim == 1 else y
11
- y = check_array(y, force_all_finite=True)
12
- if len(y) != X.shape[0]:
13
- raise ValueError("y must have the same number of samples as X")
14
- return X
@@ -1,58 +0,0 @@
1
- chemotools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- chemotools/augmentation/__init__.py,sha256=LiYw-QE-cxiYY0ua4SOgL0sC_-uAjkykkcj7gRP8Mic,246
3
- chemotools/augmentation/baseline_shift.py,sha256=Zs0-3zHWaK26f2qGBRRMxA-q6FPxPG00g-8sHe61UAc,3213
4
- chemotools/augmentation/exponential_noise.py,sha256=X2HTpL9zoiu0cFq3VsTxS3x_IO_tA_DF2vJyKgh4_UA,3082
5
- chemotools/augmentation/index_shift.py,sha256=7ujZ_sz4mWEUJMDCHyaLxhTZ5-_K3nQPwtk6y6SLR9Q,3198
6
- chemotools/augmentation/normal_noise.py,sha256=NmzTuIJKyk6tfDJgmeX9iAzsKlJJk3984tS8nLLG9dg,3051
7
- chemotools/augmentation/spectrum_scale.py,sha256=WgMw_bCxWbyAYgYBO3q4PbbzcTDyBvVD73kxPfj3cdY,3174
8
- chemotools/augmentation/uniform_noise.py,sha256=szGhk9T7SDe_6v5N8n8ztf7lxHVMiqqzrgL0JGHystw,3175
9
- chemotools/baseline/__init__.py,sha256=LFhsmzqv9RYxDS5-vK9jIf3ArNUSZ6yOF4SeUyVF6iA,381
10
- chemotools/baseline/_air_pls.py,sha256=bYAjemEWZr7oiYJegO0r5gtO16zr0BdJYjmEikA1yBc,5116
11
- chemotools/baseline/_ar_pls.py,sha256=tZi-89GMIStZUufz9AXVHU6TC1J6fAX4M1rAaIqgSvE,4431
12
- chemotools/baseline/_constant_baseline_correction.py,sha256=oxxzgCtnSHTEb9QczrxsmcHLtvCoKj6IQrH4M_5yNfw,3898
13
- chemotools/baseline/_cubic_spline_correction.py,sha256=pHpRdD6oVnn4BRg9CumlPJdAikG076kGjCU8mkMNpgw,3187
14
- chemotools/baseline/_linear_correction.py,sha256=DJow940emZQdcAKpCrkp7l5wyTYURLkr-hhHU6Pzlgw,3022
15
- chemotools/baseline/_non_negative.py,sha256=SyiS_-cfnypLXY3gC80oo7doqXUlHAAgmwrkRN4iNX8,2536
16
- chemotools/baseline/_polynomial_correction.py,sha256=0w9qA_w5dc9IIv5KMmAOZ06hWDuk-uyealsTaZX2qgw,3749
17
- chemotools/baseline/_subtract_reference.py,sha256=vfre6Z-bgDCwwl3VnpahmGJTBFJVK9HGBrUsjfl2O9o,3135
18
- chemotools/datasets/__init__.py,sha256=ojqxb-C_eDmizwUqVCJ8BqJxwULD7_hWCyVIA1uRO0c,116
19
- chemotools/datasets/_base.py,sha256=ftAmf2jHWUW_YQobXCsIFC617PeXwsmZIwAgab9EvL8,4890
20
- chemotools/datasets/data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
21
- chemotools/datasets/data/coffee_labels.csv,sha256=ZXQWQIf8faLHjdnHfRoXfxMR56kq9Q1BGPZBkQyhGlY,487
22
- chemotools/datasets/data/coffee_spectra.csv,sha256=VA-sN4u0hC5iALlRxxkj-K87Lz3b3mmUHBJPoDXychI,2206147
23
- chemotools/datasets/data/fermentation_hplc.csv,sha256=AMmiFQxwaXrH8aN310-3h1YQDiDrT8JNRv1RDvhEvg4,2140
24
- chemotools/datasets/data/fermentation_spectra.csv,sha256=MaaNMQP0lygJgFbEoUX0OUqdA-id8mF5Llvf_vj9tJk,15237508
25
- chemotools/datasets/data/train_hplc.csv,sha256=DjtmqiePOWB-F6TsOGFngE1pKyXkb7Xmsi-1CLxsTnE,249
26
- chemotools/datasets/data/train_spectra.csv,sha256=iVF19W52NHlbqq8BbLomn8n47kSPT0QxJv7wtQX4yjQ,203244
27
- chemotools/derivative/__init__.py,sha256=a9RAUYDG4C8VNJBbirRCpslKjEcKfRxUtSa39c3gp1s,86
28
- chemotools/derivative/_norris_william.py,sha256=NKmuo95vNWHQOdcww7APU9Z4s1wWExIRaj9O2Xrx8Bs,4753
29
- chemotools/derivative/_savitzky_golay.py,sha256=5At4sexJH0RvjkrvVfJvhIfaxXD3vE4Ozq1VClb3qlU,3417
30
- chemotools/feature_selection/__init__.py,sha256=p47SuyI7jMpV7kiaAsv2hA20smKf5Yo6447LfrNdDhY,76
31
- chemotools/feature_selection/_index_selector.py,sha256=2z2aAyMUOuP7x1n19RV5JGf6ZcM3mtJZby8tEgBOix4,3379
32
- chemotools/feature_selection/_range_cut.py,sha256=ikWW9FhsbyzijSUYTcx048eOyK65mdbfOuFRF_Ee3rk,3424
33
- chemotools/scale/__init__.py,sha256=CQPUPx-8pUeHHbN9p5smFro3xtl_UEE0YeXHLVd7Lfk,118
34
- chemotools/scale/_min_max_scaler.py,sha256=-Wnr7zW-zmW6nR5J5yPdBm1KNuQDa9w27Un7rAr-s8E,2806
35
- chemotools/scale/_norm_scaler.py,sha256=bjMg1-x2I1xZmmbIgl4vXZZweJV-w3Euta0KGff_2Gk,2363
36
- chemotools/scale/_point_scaler.py,sha256=u2QELIHF35TReMk3RzXliacNPEAZJmVrjjJy9Rmn1q0,3256
37
- chemotools/scatter/__init__.py,sha256=-Zs5HBpPL3NaO25n8gh0JZI8f5z88cnt-kVFYT3s3a8,292
38
- chemotools/scatter/_extended_multiplicative_scatter_correction.py,sha256=SbTEMOPl3oWrzqIvYeVLrFhJKgPH9Ra32RO7OvzLJ00,6692
39
- chemotools/scatter/_multiplicative_scatter_correction.py,sha256=ZQaypqJhjmqSqW_f7SB_8qJxaHax1Jmz3hAs5fOves4,5547
40
- chemotools/scatter/_robust_normal_variate.py,sha256=DXHTVGx7rXRwoi-DDULN1CjA4gKv8dQDQ8giJ9X3oZs,2905
41
- chemotools/scatter/_standard_normal_variate.py,sha256=Q4Cr8aMp5u9pOSDFKM7NIRU5BSRbY7C2A_kDeNcOl4I,2377
42
- chemotools/smooth/__init__.py,sha256=x-QksF-Z_TIIRDR1EZMf44G0K1Fn7plofsufyaIwuvw,180
43
- chemotools/smooth/_mean_filter.py,sha256=D-v_GaNgAWxb2NTESVmAcSi-Nqw045hCvJRKLb5ksuc,2622
44
- chemotools/smooth/_median_filter.py,sha256=tDp_8JK2n9yVKeznf47vaYs8UTOt3D3p1f6PJpZpqy4,2638
45
- chemotools/smooth/_savitzky_golay_filter.py,sha256=gNIu7drl-Drb5WK0gBRlLu7AY_JHDIiiEDAEEAZJ8M4,3192
46
- chemotools/smooth/_whittaker_smooth.py,sha256=w9ZecU3A2SM0cWSGGGmYutE0KGpNgzln7w7ocao3nnU,3353
47
- chemotools/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
48
- chemotools/utils/check_inputs.py,sha256=fRAV4HIaGamdj_PNXSNnl7LurXytACNTGO51rhPpMUY,512
49
- tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
50
- tests/fixtures.py,sha256=Xa-Vd62Kd1fyWg3PLUSP6iIkOK8etrbyOkMJTn3dvX8,1933
51
- tests/test_datasets.py,sha256=ZdyjSJVX-iJyz8SoRgFfRLP9-ajNEyqWxs00ZfIv0eo,2712
52
- tests/test_functionality.py,sha256=v8dH7TPA2D-5byl1nwpPW9ejx1Fzd5QsKuQQ4aouCjo,21707
53
- tests/test_sklearn_compliance.py,sha256=CRB_0X9HRGj0pOpUCmiSHwJkCsVB-yK_apsyUONmfmw,5856
54
- chemotools-0.1.5.dist-info/LICENSE,sha256=qtyOy2wDQVX9hxp58h3T-6Lmfv-mSCHoSRkcLUdM9bg,1070
55
- chemotools-0.1.5.dist-info/METADATA,sha256=s3KJEhQ3jgq6DPl7PW5Hl3x9f5kKyCDi-Cedon48DDA,5071
56
- chemotools-0.1.5.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
57
- chemotools-0.1.5.dist-info/top_level.txt,sha256=eNcNcKSdo-1H_2gwSDrS__dr7BM3R73Cnn-pBiW5FEw,17
58
- chemotools-0.1.5.dist-info/RECORD,,
@@ -1,2 +0,0 @@
1
- chemotools
2
- tests
tests/__init__.py DELETED
File without changes
tests/fixtures.py DELETED
@@ -1,89 +0,0 @@
1
- import numpy as np
2
- import os
3
- import pytest
4
-
5
-
6
- test_directory = os.path.dirname(os.path.abspath(__file__))
7
-
8
- path_to_resources = os.path.join(test_directory, "resources")
9
-
10
-
11
- @pytest.fixture
12
- def spectrum() -> np.ndarray:
13
- return [
14
- np.loadtxt(
15
- os.path.join(path_to_resources, "spectrum.csv"), delimiter=","
16
- ).tolist()
17
- ]
18
-
19
-
20
- @pytest.fixture
21
- def spectrum_arpls() -> np.ndarray:
22
- return [
23
- np.loadtxt(
24
- os.path.join(path_to_resources, "spectrum_arpls.csv"), delimiter=","
25
- ).tolist()
26
- ]
27
-
28
-
29
- @pytest.fixture
30
- def reference_airpls() -> np.ndarray:
31
- return [
32
- np.loadtxt(
33
- os.path.join(path_to_resources, "reference_airpls.csv"), delimiter=","
34
- ).tolist()
35
- ]
36
-
37
-
38
- @pytest.fixture
39
- def reference_arpls() -> np.ndarray:
40
- return [
41
- np.loadtxt(
42
- os.path.join(path_to_resources, "reference_arpls.csv"), delimiter=","
43
- ).tolist()
44
- ]
45
-
46
-
47
- @pytest.fixture
48
- def reference_msc_mean() -> np.ndarray:
49
- return [
50
- np.loadtxt(
51
- os.path.join(path_to_resources, "reference_msc_mean.csv"), delimiter=","
52
- ).tolist()
53
- ]
54
-
55
-
56
- @pytest.fixture
57
- def reference_msc_median() -> np.ndarray:
58
- return [
59
- np.loadtxt(
60
- os.path.join(path_to_resources, "reference_msc_median.csv"), delimiter=","
61
- ).tolist()
62
- ]
63
-
64
-
65
- @pytest.fixture
66
- def reference_sg_15_2() -> np.ndarray:
67
- return [
68
- np.loadtxt(
69
- os.path.join(path_to_resources, "reference_sg_15_2.csv"), delimiter=","
70
- ).tolist()
71
- ]
72
-
73
-
74
- @pytest.fixture
75
- def reference_snv() -> np.ndarray:
76
- return [
77
- np.loadtxt(
78
- os.path.join(path_to_resources, "reference_snv.csv"), delimiter=","
79
- ).tolist()
80
- ]
81
-
82
-
83
- @pytest.fixture
84
- def reference_whitakker() -> np.ndarray:
85
- return [
86
- np.loadtxt(
87
- os.path.join(path_to_resources, "reference_whitakker.csv"), delimiter=","
88
- ).tolist()
89
- ]
tests/test_datasets.py DELETED
@@ -1,111 +0,0 @@
1
- import pandas as pd
2
- import polars as pl
3
- import pytest
4
-
5
- from chemotools.datasets import (
6
- load_coffee,
7
- load_fermentation_test,
8
- load_fermentation_train,
9
- )
10
-
11
-
12
- def test_load_coffee_pandas():
13
- # Arrange
14
-
15
- # Act
16
- coffee_spectra, coffee_labels = load_coffee()
17
-
18
- # Assert
19
- assert coffee_spectra.shape == (60, 1841)
20
- assert coffee_labels.shape == (60, 1)
21
- assert isinstance(coffee_spectra, pd.DataFrame)
22
- assert isinstance(coffee_labels, pd.DataFrame)
23
-
24
-
25
- def test_load_coffee_polars():
26
- # Arrange
27
-
28
- # Act
29
- coffee_spectra, coffee_labels = load_coffee(set_output="polars")
30
-
31
- # Assert
32
- assert coffee_spectra.shape == (60, 1841)
33
- assert coffee_labels.shape == (60, 1)
34
- assert isinstance(coffee_spectra, pl.DataFrame)
35
- assert isinstance(coffee_labels, pl.DataFrame)
36
-
37
-
38
- def test_load_coffee_exception():
39
- # Arrange
40
-
41
- # Act and Assert
42
- with pytest.raises(ValueError):
43
- coffee_spectra, coffee_labels = load_coffee(set_output="plars")
44
-
45
-
46
- def test_load_fermentation_test_pandas():
47
- # Arrange
48
-
49
- # Act
50
- test_spectra, test_hplc = load_fermentation_test()
51
-
52
- # Assert
53
- assert test_spectra.shape == (1629, 1047)
54
- assert test_hplc.shape == (34, 6)
55
- assert isinstance(test_spectra, pd.DataFrame)
56
- assert isinstance(test_hplc, pd.DataFrame)
57
-
58
-
59
- def test_load_fermentation_test_polars():
60
- # Arrange
61
-
62
- # Act
63
- test_spectra, test_hplc = load_fermentation_test(set_output="polars")
64
-
65
- # Assert
66
- assert test_spectra.shape == (1629, 1047)
67
- assert test_hplc.shape == (34, 6)
68
- assert isinstance(test_spectra, pl.DataFrame)
69
- assert isinstance(test_hplc, pl.DataFrame)
70
-
71
-
72
- def test_load_fermentation_test_exception():
73
- # Arrange
74
-
75
- # Act and Assert
76
- with pytest.raises(ValueError):
77
- test_spectra, test_hplc = load_fermentation_test(set_output="plars")
78
-
79
-
80
- def test_load_fermentation_train_pandas():
81
- # Arrange
82
-
83
- # Act
84
- train_spectra, train_hplc = load_fermentation_train()
85
-
86
- # Assert
87
- assert train_spectra.shape == (21, 1047)
88
- assert train_hplc.shape == (21, 1)
89
- assert isinstance(train_spectra, pd.DataFrame)
90
- assert isinstance(train_hplc, pd.DataFrame)
91
-
92
-
93
- def test_load_fermentation_train_polars():
94
- # Arrange
95
-
96
- # Act
97
- train_spectra, train_hplc = load_fermentation_train(set_output="polars")
98
-
99
- # Assert
100
- assert train_spectra.shape == (21, 1047)
101
- assert train_hplc.shape == (21, 1)
102
- assert isinstance(train_spectra, pl.DataFrame)
103
- assert isinstance(train_hplc, pl.DataFrame)
104
-
105
-
106
- def test_load_fermentation_train_exception():
107
- # Arrange
108
-
109
- # Act and Assert
110
- with pytest.raises(ValueError):
111
- train_spectra, train_hplc = load_fermentation_train(set_output="plars")