View source: R/nmr_autophase.R
nmr_autophase | R Documentation |
Use phasing algorithms to rephase data in the spectral domain.
This function may improve autophasing processing from instrument vendors. It
wraps the NMRphasing::NMRphasing()
function, to automatically rephase spectra,
allowing you to choose from a number of algorithms
of which NLS
, MPC_DANM
and SPC_DANM
are the most recent.
Rephasing should happen before any spectra interpolation.
Please use the all_components = TRUE
when calling nmr_read_samples()
in order
to load the complex spectra and fix NMR phasing correctly.
nmr_autophase(
dataset,
method = c("NLS", "MPC_DANM", "MPC_EMP", "SPC_DANM", "SPC_EMP", "SPC_AAM", "SPC_DSM"),
withBC = FALSE,
...
)
dataset |
An nmr_dataset object |
method |
The autophasing method. See |
withBC |
|
... |
Other parameters passed on to |
A (hopefully better phased) nmr_dataset object, with updated real and imaginary parts.
if (requireNamespace("NMRphasing", quietly=TRUE)) {
# Helpers to create a dataset:
lorentzian <- function(x, x0, gamma, A) {
A * (1 / (pi * gamma)) * ((gamma^2) / ((x - x0)^2 + gamma^2))
}
x <- seq(from=1, to=2, length.out = 300)
y <- lorentzian(x, 1.3, 0.01, 1) + lorentzian(x, 1.6, 0.01, 1)
dataset <- new_nmr_dataset(
metadata = list(external = data.frame(NMRExperiment = "10")),
data_fields = list(data_1r = list(y)),
axis = list(list(x))
)
# Autophase, interpolate and plot:
dataset <- nmr_autophase(dataset, method = "NLS")
dataset <- nmr_interpolate_1D(dataset, axis = c(min = 1, max = 2, by = 0.01))
plot(dataset)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.