Free Access Week - Data Engineering + BI
Data Engineering and BI courses are free this week!
Free Access Week - Jun 2-8

alkahest (version 1.3.0)

rescale_range: Rescales intensities to have specified minimum and maximum

Description

Rescales intensities to have specified minimum and maximum.

Usage

rescale_range(x, y, ...)

rescale_min(x, y, ...)

rescale_max(x, y, ...)

# S4 method for numeric,numeric rescale_range(x, y, min = 0, max = 1)

# S4 method for ANY,missing rescale_range(x, min = 0, max = 1)

# S4 method for numeric,numeric rescale_min(x, y, min = 0)

# S4 method for ANY,missing rescale_min(x, min = 0)

# S4 method for numeric,numeric rescale_max(x, y, max = 1)

# S4 method for ANY,missing rescale_max(x, max = 1)

Value

Returns a list with two components x and y.

Arguments

x, y

A numeric vector. If y is missing, an attempt is made to interpret x in a suitable way (see grDevices::xy.coords()).

...

Currently not used.

min

A legnth-one numeric vector specifying the output minimum.

max

A legnth-one numeric vector specifying the output maximum.

Author

N. Frerebeau

See Also

Other normalization methods: rescale_area(), rescale_snv(), rescale_total(), rescale_transform()

Examples

Run this code
## gamma-ray spectrometry
data("BEGe")

## Subset from 2.75 to 200 keV
BEGe <- signal_select(BEGe, from = 3, to = 200)

## Plot spectrum
plot(BEGe, type = "l", xlab = "Energy (keV)", ylab = "Count")

## Normalize by area under the curve
BEGe_area <- rescale_area(BEGe)
plot(BEGe_area, type = "l", xlab = "Energy (keV)", ylab = "Count")
integrate_rectangle(BEGe)
integrate_rectangle(BEGe_area)

## Rescale so that intensities sum to 1
BEGe_total <- rescale_total(BEGe, total = 1)
plot(BEGe_total, type = "l", xlab = "Energy (keV)", ylab = "Count")

## Rescale intensities to 0-1
BEGe_range <- rescale_range(BEGe, min = 0, max = 1)
plot(BEGe_range, type = "l", xlab = "Energy (keV)", ylab = "Count")

Run the code above in your browser using DataLab