Skip to content

Commit

Permalink
add dummy calibration
Browse files Browse the repository at this point in the history
  • Loading branch information
leoschwarz committed Sep 5, 2024
1 parent c48922e commit a65e29d
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/depiction/calibration/spectrum/calibration_method_dummy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from depiction.calibration.calibration_method import CalibrationMethod
from numpy.typing import NDArray
from xarray import DataArray


class CalibrationMethodDummy(CalibrationMethod):
"""Returns the input data and creates some dummy coefficients to ensure compatibility."""

def extract_spectrum_features(self, peak_mz_arr: NDArray[float], peak_int_arr: NDArray[float]) -> DataArray:
return DataArray([0], dims=["c"])

def preprocess_image_features(self, all_features: DataArray) -> DataArray:
return all_features

def fit_spectrum_model(self, features: DataArray) -> DataArray:
return features

def apply_spectrum_model(
self, spectrum_mz_arr: NDArray[float], spectrum_int_arr: NDArray[float], model_coef: DataArray
) -> tuple[NDArray[float], NDArray[float]]:
return spectrum_mz_arr, spectrum_int_arr

def __repr__(self) -> str:
return f"{self.__class__.__name__}()"

0 comments on commit a65e29d

Please sign in to comment.