Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Replace deprecated np.round_ with np.round function #76

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion spectrum_utils/spectrum.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def intensity(self) -> np.ndarray:
def round(
self, decimals: int = 0, combine: str = "sum"
) -> "MsmsSpectrumJit":
mz_round = np.round_(self._mz, decimals, np.empty_like(self._mz))
mz_round = np.round(self._mz, decimals=decimals)
mz_unique = np.unique(mz_round)
if len(mz_unique) == len(mz_round):
self._mz = mz_unique
Expand Down
4 changes: 2 additions & 2 deletions tests/spectrum_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def test_mz_array():
mz = np.random.uniform(100, 1400, num_peaks).tolist()
intensity = np.random.lognormal(0, 1, num_peaks)
spec = spectrum.MsmsSpectrum("test_spectrum", 500, 2, mz, intensity)
assert type(spec.mz) == np.ndarray
assert isinstance(spec.mz, np.ndarray)
with pytest.raises(AttributeError):
spec.mz = np.random.uniform(100, 1400, num_peaks)

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

Expand Down
Loading