Top-Hat Morphological Baseline Correction
Source:R/baseline-extended.R
step_measure_baseline_tophat.Rdstep_measure_baseline_tophat() creates a specification of a recipe step
that applies top-hat morphological baseline correction.
Usage
step_measure_baseline_tophat(
recipe,
measures = NULL,
half_window = 50L,
role = NA,
trained = FALSE,
skip = FALSE,
id = recipes::rand_id("measure_baseline_tophat")
)Arguments
- recipe
A recipe object.
- measures
An optional character vector of measure column names.
- half_window
Half-window size for the structuring element. Default is 50.
- role
Not used.
- trained
Logical indicating if the step has been trained.
- skip
Logical. Should the step be skipped when baking?
- id
Unique step identifier.
Details
The top-hat transform is a morphological operation that extracts bright features (peaks) from a dark background. It is computed as the difference between the original signal and its morphological opening.
This is effective for chromatography with sharp, well-defined peaks on a smooth baseline.
See also
Other measure-baseline:
step_measure_baseline_airpls(),
step_measure_baseline_als(),
step_measure_baseline_arpls(),
step_measure_baseline_auto(),
step_measure_baseline_custom(),
step_measure_baseline_gpc(),
step_measure_baseline_minima(),
step_measure_baseline_morph(),
step_measure_baseline_poly(),
step_measure_baseline_py(),
step_measure_baseline_rf(),
step_measure_baseline_rolling(),
step_measure_baseline_snip(),
step_measure_detrend()
Examples
library(recipes)
rec <- recipe(water + fat + protein ~ ., data = meats_long) |>
update_role(id, new_role = "id") |>
step_measure_input_long(transmittance, location = vars(channel)) |>
step_measure_baseline_tophat(half_window = 30) |>
prep()