Skip to content

Commit

Permalink
Update html.py
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasz-migas committed Dec 30, 2024
1 parent 6783aff commit ecb6d40
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/spec_utils/html.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,19 @@ def make_peaks_spectrum(
from koyo.utilities import get_array_window
from plotly.subplots import make_subplots

# get minimum and maximum m/z values
mz_min = min(mz_x.min() for mz_x, _ in spectra.values())
mz_max = max(mz_x.max() for mz_x, _ in spectra.values())

# validate peaks are within the m/z range and if not, exclude them
peaks_, excluded_peaks_ = [], []
for peak in peaks:
if mz_min <= peak <= mz_max:
peaks_.append(peak)
else:
excluded_peaks_.append(peak)
peaks = np.asarray(peaks_)

peaks = np.asarray(peaks)
n_peaks = len(peaks)
n_rows = (n_peaks + n_cols - 1) // n_cols
Expand Down

0 comments on commit ecb6d40

Please sign in to comment.