Skip to content

Commit

Permalink
add highly experimental wrapper for findmfpy
Browse files Browse the repository at this point in the history
  • Loading branch information
leoschwarz committed Jun 27, 2024
1 parent 0cd1101 commit 59aface
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/depiction/spectrum/peak_picking/findmf_peak_picker.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# TODO extremely experimental, not part of pyproject.toml dependencies etc,
# usage not yet recommended!
from __future__ import annotations

from dataclasses import dataclass

import numpy as np
from findmfpy.api import pick_peaks as _pick_peaks
from numpy.typing import NDArray


@dataclass
class FindMFPeakpicker:
resolution: float = 10000.0
width: float = 2.0
int_width: float = 2.0
int_threshold: float = 10.0
area: bool = True
max_peaks: int = 0

def pick_peaks(
self, mz_arr: NDArray[np.float64], int_arr: NDArray[np.float64]
) -> tuple[NDArray[np.float64], NDArray[np.float64]]:
return _pick_peaks(
mz_arr,
int_arr,
resolution=self.resolution,
width=self.width,
int_width=self.int_width,
int_threshold=self.int_threshold,
area=self.area,
max_peaks=self.max_peaks,
)

0 comments on commit 59aface

Please sign in to comment.