chemotools 0.1.11__py3-none-any.whl → 0.1.16__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/augmentation/_index_shift.py +2 -2
- chemotools-0.1.16.dist-info/METADATA +104 -0
- {chemotools-0.1.11.dist-info → chemotools-0.1.16.dist-info}/RECORD +5 -5
- {chemotools-0.1.11.dist-info → chemotools-0.1.16.dist-info}/WHEEL +1 -1
- chemotools-0.1.11.dist-info/METADATA +0 -105
- {chemotools-0.1.11.dist-info → chemotools-0.1.16.dist-info/licenses}/LICENSE +0 -0
@@ -193,7 +193,7 @@ class IndexShift(TransformerMixin, OneToOneFeatureMixin, BaseEstimator):
|
|
193
193
|
if pad_left:
|
194
194
|
points = x[: pad_length + 1] # Take first pad_length+1 points
|
195
195
|
x_coords = np.arange(len(points))
|
196
|
-
slope, intercept, _
|
196
|
+
slope, intercept, *_ = stats.linregress(x_coords, points)
|
197
197
|
|
198
198
|
# Generate new points using linear regression
|
199
199
|
new_x = np.arange(-pad_length, 0)
|
@@ -202,7 +202,7 @@ class IndexShift(TransformerMixin, OneToOneFeatureMixin, BaseEstimator):
|
|
202
202
|
else:
|
203
203
|
points = x[-pad_length - 1 :] # Take last pad_length+1 points
|
204
204
|
x_coords = np.arange(len(points))
|
205
|
-
slope, intercept, _
|
205
|
+
slope, intercept, *_ = stats.linregress(x_coords, points)
|
206
206
|
|
207
207
|
# Generate new points using linear regression
|
208
208
|
new_x = np.arange(len(points), len(points) + pad_length)
|
@@ -0,0 +1,104 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: chemotools
|
3
|
+
Version: 0.1.16
|
4
|
+
Summary: chemotools: A Python Package that Integrates Chemometrics and scikit-learn
|
5
|
+
Author: Pau Cabaneros
|
6
|
+
License-Expression: MIT
|
7
|
+
License-File: LICENSE
|
8
|
+
Requires-Python: >=3.10
|
9
|
+
Requires-Dist: numpy<3,>=2.0.0
|
10
|
+
Requires-Dist: pandas<3,>=2.0.0
|
11
|
+
Requires-Dist: polars<2,>=1.17.0
|
12
|
+
Requires-Dist: pyarrow<21,>=18
|
13
|
+
Requires-Dist: scikit-learn<2,>=1.4.0
|
14
|
+
Provides-Extra: dev
|
15
|
+
Requires-Dist: mypy<2,>=1.13.0; extra == 'dev'
|
16
|
+
Requires-Dist: pandas-stubs<3,>=2.2.3.241126; extra == 'dev'
|
17
|
+
Requires-Dist: pytest-cov>=6.3.0; extra == 'dev'
|
18
|
+
Requires-Dist: pytest<9,>=8.3.0; extra == 'dev'
|
19
|
+
Requires-Dist: ruff<0.9,>=0.8.0; extra == 'dev'
|
20
|
+
Requires-Dist: scipy-stubs<2,>=1.15.1.0; extra == 'dev'
|
21
|
+
Description-Content-Type: text/markdown
|
22
|
+
|
23
|
+

|
24
|
+
|
25
|
+
# chemotools
|
26
|
+
|
27
|
+
|
28
|
+
[](https://pypi.org/project/chemotools)
|
29
|
+
[](https://pypi.org/project/chemotools)
|
30
|
+
[](https://github.com/paucablop/chemotools/blob/main/LICENSE)
|
31
|
+
[](https://codecov.io/github/paucablop/chemotools)
|
32
|
+
[](https://pepy.tech/project/chemotools)
|
33
|
+
[](https://doi.org/10.21105/joss.06802)
|
34
|
+
|
35
|
+
---
|
36
|
+
|
37
|
+
`chemotools` is a Python library that brings **chemometric preprocessing tools** into the [`scikit-learn`](https://scikit-learn.org/) ecosystem.
|
38
|
+
|
39
|
+
It provides modular transformers for spectral data, designed to plug seamlessly into your ML workflows.
|
40
|
+
|
41
|
+
## Features
|
42
|
+
|
43
|
+
- Preprocessing for spectral data (baseline correction, smoothing, scaling, derivatization, scatter correction).
|
44
|
+
- Fully compatible with `scikit-learn` pipelines and transformers.
|
45
|
+
- Simple, modular API for flexible workflows.
|
46
|
+
- Open-source, actively maintained, and published on [PyPI](https://pypi.org/project/chemotools/) and [Conda](https://anaconda.org/conda-forge/chemotools).
|
47
|
+
|
48
|
+
## Installation
|
49
|
+
|
50
|
+
Install from PyPI:
|
51
|
+
|
52
|
+
```bash
|
53
|
+
pip install chemotools
|
54
|
+
````
|
55
|
+
|
56
|
+
Install from Conda:
|
57
|
+
|
58
|
+
```bash
|
59
|
+
conda install -c conda-forge chemotools
|
60
|
+
```
|
61
|
+
|
62
|
+
## Usage
|
63
|
+
|
64
|
+
Example: preprocessing pipeline with scikit-learn:
|
65
|
+
|
66
|
+
```python
|
67
|
+
from sklearn.preprocessing import StandardScaler
|
68
|
+
from sklearn.pipeline import make_pipeline
|
69
|
+
|
70
|
+
from chemotools.baseline import AirPls
|
71
|
+
from chemotools.scatter import MultiplicativeScatterCorrection
|
72
|
+
|
73
|
+
preprocessing = make_pipeline(
|
74
|
+
AirPls(),
|
75
|
+
MultiplicativeScatterCorrection(),
|
76
|
+
StandardScaler(with_std=False),
|
77
|
+
)
|
78
|
+
|
79
|
+
spectra_transformed = preprocessing.fit_transform(spectra)
|
80
|
+
```
|
81
|
+
|
82
|
+
➡️ See the [documentation](https://paucablop.github.io/chemotools/) for full details.
|
83
|
+
|
84
|
+
## Development
|
85
|
+
|
86
|
+
This project uses [uv](https://github.com/astral-sh/uv) for dependency management and [Task](https://taskfile.dev) to simplify common development workflows.
|
87
|
+
You can get started quickly by using the predefined [Taskfile](./Taskfile.yml), which provides handy shortcuts such as:
|
88
|
+
|
89
|
+
```bash
|
90
|
+
task install # install all dependencies
|
91
|
+
task check # run formatting, linting, typing, and tests
|
92
|
+
task coverage # run tests with coverage reporting
|
93
|
+
task build # build the package for distribution
|
94
|
+
```
|
95
|
+
|
96
|
+
## Contributing
|
97
|
+
|
98
|
+
Contributions are welcome!
|
99
|
+
Check out the [contributing guide](CONTRIBUTING.md) and the [project board](https://github.com/users/paucablop/projects/4).
|
100
|
+
|
101
|
+
## License
|
102
|
+
|
103
|
+
Released under the [MIT License](LICENSE).
|
104
|
+
|
@@ -4,7 +4,7 @@ chemotools/augmentation/_add_noise.py,sha256=fkTJfIYtZXezcjy6Vz8asIhpBoVp4oaIifp
|
|
4
4
|
chemotools/augmentation/_baseline_shift.py,sha256=kIlYvmKS9pu9vh_-eZ7PSHPuH_58V9mgYbSJt6Gq3BA,3476
|
5
5
|
chemotools/augmentation/_fractional_shift.py,sha256=dJ0Vuc-U02HhjKkOwc48qnOksZYgbHwL2ko7tWCZTQU,6916
|
6
6
|
chemotools/augmentation/_gaussian_broadening.py,sha256=dJsPlTKqpecKaCDU3vOvedIb-t_HyCkQprxNv0DmYZQ,4236
|
7
|
-
chemotools/augmentation/_index_shift.py,sha256=
|
7
|
+
chemotools/augmentation/_index_shift.py,sha256=NeN9Nc212wIF4R1dSoWFIrSuP3OWO1GPTPJ_Ql_SKzw,6894
|
8
8
|
chemotools/augmentation/_spectrum_scale.py,sha256=hMsmzXpssbI7tGm_YnQn9wjbByso3CgVxd3Hs8kfLS8,3442
|
9
9
|
chemotools/baseline/__init__.py,sha256=VzoblGg8Hx_FkTc_n7a-ZjGvtKP8JE_NwJKWenGFQkM,584
|
10
10
|
chemotools/baseline/_air_pls.py,sha256=eotXuIEsus7Z-c17oLx8UbiwOHM7DzQJ6rruHnwCGPQ,5067
|
@@ -56,7 +56,7 @@ chemotools/smooth/_median_filter.py,sha256=9ndTJCwrZirWlvDNldiigMddy79KIGq9OwwYN
|
|
56
56
|
chemotools/smooth/_savitzky_golay_filter.py,sha256=27iFUWxdL9_7oZabR0R5L0ZTpBmYfVUjx2XCTukihBE,3509
|
57
57
|
chemotools/smooth/_whittaker_smooth.py,sha256=lpLAyf4GdyDW4ulT1nyEoK6xQEl2cVUKquawQdGWbHU,3571
|
58
58
|
chemotools/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
59
|
-
chemotools-0.1.
|
60
|
-
chemotools-0.1.
|
61
|
-
chemotools-0.1.
|
62
|
-
chemotools-0.1.
|
59
|
+
chemotools-0.1.16.dist-info/METADATA,sha256=s4iSyrriFOkMSpSZYX96bH-Nj99mxbwwMXwCm3okZWk,3600
|
60
|
+
chemotools-0.1.16.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
61
|
+
chemotools-0.1.16.dist-info/licenses/LICENSE,sha256=qtyOy2wDQVX9hxp58h3T-6Lmfv-mSCHoSRkcLUdM9bg,1070
|
62
|
+
chemotools-0.1.16.dist-info/RECORD,,
|
@@ -1,105 +0,0 @@
|
|
1
|
-
Metadata-Version: 2.3
|
2
|
-
Name: chemotools
|
3
|
-
Version: 0.1.11
|
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
|
8
|
-
Classifier: License :: OSI Approved :: MIT License
|
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,<21)
|
18
|
-
Requires-Dist: scikit-learn (>=1.4.0,<2.0.0)
|
19
|
-
Description-Content-Type: text/markdown
|
20
|
-
|
21
|
-

|
22
|
-
|
23
|
-
|
24
|
-
[](https://pypi.org/project/chemotools)
|
25
|
-
[](https://pypi.org/project/chemotools)
|
26
|
-
[](https://github.com/paucablop/chemotools/blob/main/LICENSE)
|
27
|
-
[](https://codecov.io/github/paucablop/chemotools)
|
28
|
-
[](https://pepy.tech/project/chemotools)
|
29
|
-
[](https://doi.org/10.21105/joss.06802)
|
30
|
-
|
31
|
-
|
32
|
-
# __chemotools__
|
33
|
-
|
34
|
-
Welcome to Chemotools, a Python package that integrates chemometrics with Scikit-learn.
|
35
|
-
|
36
|
-
## Note
|
37
|
-
|
38
|
-
Since I released Chemotools, I have received a fantastic response from the community. I am really happy for the interest in the project 🤗. This also means that I have received a lot of good feedback and suggestions for improvements. I have been intensively working on releasing new versions of Chemotools to address the feedback and suggestions. If you use Chemotools, __make sure you are using the latest version__ (see installation), which will be aligned with the documentation.
|
39
|
-
|
40
|
-
👉👉 Check the [latest version](https://pypi.org/project/chemotools/) and make sure you don't miss out on cool new features.
|
41
|
-
|
42
|
-
👉👉 Check the [documentation](https://paucablop.github.io/chemotools/) for a full description on how to use chemotools.
|
43
|
-
|
44
|
-
## Description
|
45
|
-
|
46
|
-
Chemotools is a Python package that provides a collection of preprocessing tools and utilities for working with spectral data. It is built on top of popular scientific libraries and is designed to be highly modular, easy to use, and compatible with Scikit-learn transformers.
|
47
|
-
|
48
|
-
If you are interested in learning more about chemotools, please visit the [documentation](https://paucablop.github.io/chemotools/) page.
|
49
|
-
|
50
|
-
Benefits:
|
51
|
-
- Provides a collection of preprocessing tools and utilities for working with spectral data
|
52
|
-
- Highly modular and compatible with Scikit-learn transformers
|
53
|
-
- Can perform popular preprocessing tasks such as baseline correction, smoothing, scaling, derivatization, and scattering correction
|
54
|
-
- Open source and available on PyPI
|
55
|
-
|
56
|
-
Applications:
|
57
|
-
- Analyzing and processing spectral data in chemistry, biology, and other fields
|
58
|
-
- Developing machine learning models for predicting properties or classifying samples based on spectral data
|
59
|
-
- Teaching and learning about chemometrics and data preprocessing in Python
|
60
|
-
|
61
|
-
## Installation
|
62
|
-
|
63
|
-
Chemotools is distributed via PyPI and can be easily installed using pip:
|
64
|
-
|
65
|
-
```bash
|
66
|
-
pip install chemotools
|
67
|
-
```
|
68
|
-
|
69
|
-
Upgrading to the latest version is as simple as:
|
70
|
-
|
71
|
-
```bash
|
72
|
-
pip install chemotools --upgrade
|
73
|
-
```
|
74
|
-
|
75
|
-
## Usage
|
76
|
-
|
77
|
-
Chemotools is designed to be used in conjunction with Scikit-learn. It follows the same API as other Scikit-learn transformers, so you can easily integrate it into your existing workflow. For example, you can use chemotools to build pipelines that include transformers from chemotools and Scikit-learn:
|
78
|
-
|
79
|
-
```python
|
80
|
-
from sklearn.preprocessing import StandardScaler
|
81
|
-
from sklearn.pipeline import make_pipeline
|
82
|
-
|
83
|
-
from chemotools.baseline import AirPls
|
84
|
-
from chemotools.scatter import MultiplicativeScatterCorrection
|
85
|
-
|
86
|
-
preprocessing = make_pipeline(AirPls(), MultiplicativeScatterCorrection(), StandardScaler(with_std=False))
|
87
|
-
spectra_transformed = preprocessing.fit_transform(spectra)
|
88
|
-
```
|
89
|
-
|
90
|
-
Check the [documentation](https://paucablop.github.io/chemotools/) for more information on how to use chemotools.
|
91
|
-
|
92
|
-
|
93
|
-
## Contributing
|
94
|
-
|
95
|
-
We welcome contributions to Chemotools from anyone interested in improving the package. Whether you have ideas for new features, bug reports, or just want to help improve the code, we appreciate your contributions! You are also welcome to see the [Project Board](https://github.com/users/paucablop/projects/4) to see what we are currently working on.
|
96
|
-
|
97
|
-
To contribute to Chemotools, please follow the [contributing guidelines](CONTRIBUTING.md).
|
98
|
-
|
99
|
-
## License
|
100
|
-
|
101
|
-
This package is distributed under the MIT license. See the [LICENSE](LICENSE) file for more information.
|
102
|
-
|
103
|
-
## Credits
|
104
|
-
|
105
|
-
AirPLS baseline correction is based on the implementation by [Zhang et al.](https://pubs.rsc.org/is/content/articlelanding/2010/an/b922045c). The current implementation is based on the Python implementation by [zmzhang](https://github.com/zmzhang/airPLS).
|
File without changes
|