Skip to content

Commit

Permalink
ensure compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
leoschwarz committed Oct 17, 2024
1 parent a5a2935 commit 2554fac
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
6 changes: 4 additions & 2 deletions src/depiction/tools/calibrate/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

from typing import Literal, Annotated

from pydantic import BaseModel, Field
from pydantic import BaseModel, Field, ConfigDict

from depiction.tools.calibrate.spatial_smoothing_config import GaussianSpatialSmoothingConfig, SpatialSmoothingConfig
from depiction.tools.filter_peaks.config import FilterPeaksConfig


class CalibrationRegressShiftConfig(BaseModel):
model_config = ConfigDict(extra="forbid")
calibration_method: Literal["RegressShift"] = "RegressShift"

max_distance: float
Expand Down Expand Up @@ -44,7 +45,8 @@ class CalibrationConstantGlobalShiftConfig(BaseModel):
calibration_method: Literal["ConstantGlobalShift"] = "ConstantGlobalShift"


class CalibrationConfig(BaseModel, use_enum_values=True, validate_default=True):
class CalibrationConfig(BaseModel):
model_config = ConfigDict(extra="forbid", use_enum_values=True, validate_default=True)
method: (
Annotated[
CalibrationRegressShiftConfig
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ calibration:
max_distance_unit: ppm
reg_model_type: linear_siegelslopes
reg_model_unit: mz
input_smoothing_activated: yes
input_smoothing_kernel_size: 5
input_smoothing_kernel_std: 1.0
spatial_smoothing:
type: Gaussian
kernel_size: 5
kernel_std: 1.0
min_points: 3
n_jobs: 10
2 changes: 2 additions & 0 deletions src/depiction_targeted_preproc/pipeline_config/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ class PipelineArtifact(str, Enum):
# TODO we have some redundancy in the peak picker allowing filtering... it should be removed there, since sometimes you
# might want peak filtering without peak picking -> TODO create task
class PipelineParametersPreset(Model, use_enum_values=True, validate_default=True):
model_config = ConfigDict(extra="forbid")

baseline_correction: BaselineCorrectionConfig | None
filter_peaks: FilterPeaksConfig | None
calibration: CalibrationConfig | None
Expand Down

0 comments on commit 2554fac

Please sign in to comment.