Skip to content

Commit 734f071

Browse files
authored
Merge pull request #220 from h2020charisma/tox-pin-versions
Tox pin versions
2 parents 542644e + f22f08a commit 734f071

File tree

5 files changed

+25
-15
lines changed

5 files changed

+25
-15
lines changed

src/ramanchada2/protocols/calibration/calibration_component.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import logging
2+
from typing import Literal
23

34
import matplotlib.pyplot as plt
45
import numpy as np
56
import pandas as pd
67
from matplotlib.axes import Axes
7-
from typing import Literal
88

99
from ramanchada2.misc.plottable import Plottable
1010
from ramanchada2.spectrum import Spectrum

src/ramanchada2/protocols/calibration/calibration_model.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import warnings
33

44
from typing import Dict, Literal
5+
56
import matplotlib.pyplot as plt
67
from matplotlib.axes import Axes
78

src/ramanchada2/protocols/calibration/xcalibration.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
1+
import json
12
import logging
2-
from typing import Literal, Dict
3+
from typing import Dict, Literal
4+
35
import numpy as np
4-
from scipy.interpolate import RBFInterpolator, PchipInterpolator, CubicSpline
56
import pandas as pd
7+
from scipy.interpolate import CubicSpline, PchipInterpolator, RBFInterpolator
8+
9+
from ramanchada2.misc.utils import find_closest_pairs_idx
610

711
from ramanchada2.misc.utils.matchsets import (
812
cost_function_position,
913
match_peaks,
1014
match_peaks_cluster,
1115
)
12-
from ramanchada2.misc.utils import find_closest_pairs_idx
1316
from ramanchada2.spectrum import Spectrum
1417
from .calibration_component import CalibrationComponent
15-
import json
1618

1719
logger = logging.getLogger(__name__)
1820

tests/protocols/test_calibrationmodel.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def __init__(self):
117117
should_fit=fit_peaks,
118118
match_method="cluster",
119119
si_profile=self.si_profile,
120-
interpolator_method="pchip"
120+
interpolator_method="pchip",
121121
)
122122
assert len(self.calmodel.components) == 2
123123
# print(self.calmodel.components[0])
@@ -154,8 +154,8 @@ def test_laser_zeroing(setup_module):
154154
setup_module.spe_sil, spe_units="cm-1"
155155
)
156156
spe_test = spe_sil_calib.trim_axes(
157-
method='x-axis',
158-
boundaries=(si_peak-50, si_peak+50))
157+
method="x-axis", boundaries=(si_peak - 50, si_peak + 50)
158+
)
159159
find_kw = {"wlen": 200, "width": 1, "sharpening": None}
160160
find_kw["prominence"] = (
161161
spe_test.y_noise_MAD() * setup_module.calmodel.prominence_coeff
@@ -193,8 +193,13 @@ def test_laser_zeroing(setup_module):
193193
spe_test_necalibrated_only.plot(
194194
ax=axsifit, label="Si (Ne calibrated only)", fmt=":"
195195
)
196-
axsifit.axvline(x=si_peak_nm, color='black', linestyle=':', linewidth=2,
197-
label="Si peak {:.3f} nm".format(si_peak_nm))
196+
axsifit.axvline(
197+
x=si_peak_nm,
198+
color="black",
199+
linestyle=":",
200+
linewidth=2,
201+
label="Si peak {:.3f} nm".format(si_peak_nm),
202+
)
198203
axsifit.grid()
199204
print(df.sort_values(by="amplitude", ascending=False).head())
200205
plt.grid()
@@ -237,7 +242,9 @@ def compare_calibrated_spe(setup_module, spectra, name="calibration"):
237242
# check if x is monotonically increasing
238243
# assert np.all(np.diff(spe.x) > 0)
239244
assert not np.any(np.isnan(spe.x)), "Array contains NaN values!"
240-
spe_norm = resample_spline(_spe.normalize(strategy="unity_area"), _min, _max, 1000)
245+
spe_norm = resample_spline(
246+
_spe.normalize(strategy="unity_area"), _min, _max, 1000
247+
)
241248
spe_y_original.append(spe_norm.y)
242249
spe_c = setup_module.calmodel.apply_calibration_x(_spe, spe_units="cm-1")
243250
assert not np.any(np.isnan(spe_c.x)), "Array contains NaN values!"

tox.ini

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ commands = coverage erase
4848

4949
[testenv:mypy]
5050
base_python = python3.13
51-
deps = mypy
51+
deps = mypy==1.15.*
5252
commands = mypy src tests
5353

5454
[testenv:black]
5555
base_python = python3.13
56-
deps=black
56+
deps = black==25.1.*
5757
commands =
5858
black \
5959
scripts \
@@ -68,7 +68,7 @@ commands =
6868

6969
[testenv:usort]
7070
base_python = python3.13
71-
deps=usort
71+
deps = usort==1.0.*
7272
commands =
7373
usort format \
7474
scripts \
@@ -86,7 +86,7 @@ commands =
8686

8787
[testenv:flake8]
8888
base_python = python3.13
89-
deps = flake8
89+
deps = flake8==7.3.*
9090
commands = flake8 scripts src tests
9191

9292
[testenv:docs]

0 commit comments

Comments
 (0)