Skip to content

Commit e6f1735

Browse files
authored
Fix: Replace deprecated np.round_ with np.round function (#76)
* Fix: Replace deprecated np.round_ with np.round function * Fix: Replace deprecated np.round_ with np.round and fix style issue
1 parent 5cb1297 commit e6f1735

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

spectrum_utils/spectrum.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def intensity(self) -> np.ndarray:
7575
def round(
7676
self, decimals: int = 0, combine: str = "sum"
7777
) -> "MsmsSpectrumJit":
78-
mz_round = np.round_(self._mz, decimals, np.empty_like(self._mz))
78+
mz_round = np.round(self._mz, decimals=decimals)
7979
mz_unique = np.unique(mz_round)
8080
if len(mz_unique) == len(mz_round):
8181
self._mz = mz_unique

tests/spectrum_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def test_mz_array():
4949
mz = np.random.uniform(100, 1400, num_peaks).tolist()
5050
intensity = np.random.lognormal(0, 1, num_peaks)
5151
spec = spectrum.MsmsSpectrum("test_spectrum", 500, 2, mz, intensity)
52-
assert type(spec.mz) == np.ndarray
52+
assert isinstance(spec.mz, np.ndarray)
5353
with pytest.raises(AttributeError):
5454
spec.mz = np.random.uniform(100, 1400, num_peaks)
5555

@@ -59,7 +59,7 @@ def test_intensity_array():
5959
mz = np.random.uniform(100, 1400, num_peaks)
6060
intensity = np.random.lognormal(0, 1, num_peaks).tolist()
6161
spec = spectrum.MsmsSpectrum("test_spectrum", 500, 2, mz, intensity)
62-
assert type(spec.intensity) == np.ndarray
62+
assert isinstance(spec.intensity, np.ndarray)
6363
with pytest.raises(AttributeError):
6464
spec.intensity = np.random.lognormal(0, 1, num_peaks)
6565

0 commit comments

Comments
 (0)