Title: | Processing and Analysis of Electron Paramagnetic Resonance Data and Spectra in Chemistry |
---|---|
Description: | Processing, analysis and plottting of Electron Paramagnetic Resonance (EPR) spectra in chemistry. Even though the package is mainly focused on continuous wave (CW) EPR/ENDOR, many functions may be also used for the integrated forms of 1D PULSED EPR spectra. It is able to find the most important spectral characteristics like g-factor, linewidth, maximum of derivative or integral intensities and single/double integrals. This is especially important in spectral (time) series consisting of many EPR spectra like during variable temperature experiments, electrochemical or photochemical radical generation and/or decay. Package also enables processing of data/spectra for the analytical (quantitative) purposes. Namely, how many radicals or paramagnetic centers can be found in the analyte/sample. The goal is to evaluate rate constants, considering different kinetic models, to describe the radical reactions. The key feature of the package resides in processing of the universal ASCII text formats (such as '.txt', '.csv' or '.asc') from scratch. No proprietary formats are used (except the MATLAB EasySpin outputs) and in such respect the package is in accordance with the FAIR data principles. Upon 'reading' (also providing automatic procedures for the most common EPR spectrometers) the spectral data are transformed into the universal R 'data frame' format. Subsequently, the EPR spectra can be visualized and are fully consistent either with the 'ggplot2' package or with the interactive formats based on 'plotly'. Additionally, simulations and fitting of the isotropic EPR spectra are also included in the package. Advanced simulation parameters provided by the MATLAB-EasySpin toolbox and results from the quantum chemical calculations like g-factor and hyperfine splitting/coupling constants (a/A) can be compared and summarized in table-format in order to analyze the EPR spectra by the most effective way. |
Authors: | Ján Tarábek [aut, cre] |
Maintainer: | Ján Tarábek <[email protected]> |
License: | GPL (>= 3) + file LICENSE |
Version: | 0.1.12 |
Built: | 2025-02-06 06:14:34 UTC |
Source: | https://github.com/jatanrt/eprscope |
Converting hyperfine coupling constants (HFCCs, values in
MHz
)
into hyperfine splitting ones (HFSCs, values in
mT
).
convert_A_MHz_2a(A.MHz, g.val = 2.0023193)
convert_A_MHz_2a(A.MHz, g.val = 2.0023193)
A.MHz |
Numeric value/vector, corresponding to HFCCs in |
g.val |
Numeric value/vector, corresponding to actual |
Conversion done according to following relation:
where corresponds to Planck's constant and
to Bohr's magneton.
Both latter are obtained by
constans::syms$h
and constants::syms$mub
, respectively,
using the constants package (see syms
).
Conversion is suitable for the EPR simulations and/or ENDOR.
Numeric value/vector corresponding to HFSCs () in
mT
.
Other Conversions and Corrections:
convert_B()
,
convert_a_mT_2A()
,
convert_time2var()
,
correct_time_Exp_Specs()
convert_A_MHz_2a(A.MHz = 16) # convert_A_MHz_2a(20,2.0059) # convert_A_MHz_2a(4,g.val = 2.0036)
convert_A_MHz_2a(A.MHz = 16) # convert_A_MHz_2a(20,2.0059) # convert_A_MHz_2a(4,g.val = 2.0036)
Converting hyperfine splitting constants (HFSCs, values in
mT
)
into hyperfine coupling ones (HFCCs, values in
MHz
).
convert_a_mT_2A(a.mT, g.val = 2.0023193)
convert_a_mT_2A(a.mT, g.val = 2.0023193)
a.mT |
Numeric value/vector of HFSCs in |
g.val |
Numeric value/vector, corresponding to actual |
Conversion done according to following relation:
where corresponds to Planck's constant and
to Bohr's magneton.
Both latter are obtained by
constans::syms$h
and constants::syms$mub
, respectively,
using the constants package (see syms
).
Conversion is suitable for the EPR simulations and/or ENDOR.
Numeric value/vector corresponding to HFCCs () in
MHz
.
Other Conversions and Corrections:
convert_A_MHz_2a()
,
convert_B()
,
convert_time2var()
,
correct_time_Exp_Specs()
convert_a_mT_2A(a.mT = 0.5) # convert_a_mT_2A(0.6,2.0059) # convert_a_mT_2A(0.15,g.val = 2.00036)
convert_a_mT_2A(a.mT = 0.5) # convert_a_mT_2A(0.6,2.0059) # convert_a_mT_2A(0.15,g.val = 2.00036)
Conversion of magnetic flux density/field (B) values depending on the input and the required output units.
convert_B(B.val, B.unit, B.2unit)
convert_B(B.val, B.unit, B.2unit)
B.val |
Numeric value/vector, corresponding to input value(s) of magnetic flux density. |
B.unit |
Character string, referring to input magnetic flux density units.
Usually |
B.2unit |
Character string, referring to output magnetic flux density units.
Usually |
Numeric value or vector as a result of the B conversion. Depending on the output
unit (B.2unit
) the values are rounded to:
7 decimal places
4 decimal places
3 decimal places
Other Conversions and Corrections:
convert_A_MHz_2a()
,
convert_a_mT_2A()
,
convert_time2var()
,
correct_time_Exp_Specs()
## simple conversion: convert_B(B.val = 3500,B.unit = "G",B.2unit = "T") # ## conversion of B.seq vector with the Sweep Width = 100 G ## and the central field 3496 G : B.seq <- seq(3496-100/2,3496+100/2,length.out = 1024) Bnew <- convert_B(B.seq,B.unit = "G",B.2unit = "mT") head(as.matrix(Bnew),n = 20)
## simple conversion: convert_B(B.val = 3500,B.unit = "G",B.2unit = "T") # ## conversion of B.seq vector with the Sweep Width = 100 G ## and the central field 3496 G : B.seq <- seq(3496-100/2,3496+100/2,length.out = 1024) Bnew <- convert_B(B.seq,B.unit = "G",B.2unit = "mT") head(as.matrix(Bnew),n = 20)
into Variable Linearly Depending on
.Conversion of time () into variable (
) which is linearly changed on time.
convert_time2var( time.vals, time.unit = "s", var0, var.switch = NULL, var.rate, var.rate.unit = "s^{-1}" )
convert_time2var( time.vals, time.unit = "s", var0, var.switch = NULL, var.rate, var.rate.unit = "s^{-1}" )
time.vals |
Numeric value or vector, corresponding to time (points) where the variable |
time.unit |
Character string, time unit defined by |
var0 |
Numeric, the initial value (ALSO WITH NEGATIVE SIGN, if required, e.g. negative electrochemical potential). |
var.switch |
Numeric, the switching point |
var.rate |
Numeric, corresponding to rate of linear |
var.rate.unit |
Character string, corresponding to |
The linear time change of can be expressed like
This is especially suitable for time conversion of EPR time series experiments
(see e.g. readEPR_Exp_Specs_kin
) simultaneously performed either during
electrochemical/voltammetric or variable temperature experiment. When cyclic series experiment
is performed (e.g. cyclic voltammetry), that value depends on the switching one,
like =>
where the , corresponding to
, are the quantities
at the turning point( see also
var.switch
argument).
Numeric value or vector of the variable such as electrochemical potential or temperature, linearly changing on time.
Other Conversions and Corrections:
convert_A_MHz_2a()
,
convert_B()
,
convert_a_mT_2A()
,
correct_time_Exp_Specs()
## calculate potential after 30 s, starting from 200 mV ## into cathodic direction (reduction) by 5 mV s^{-1} convert_time2var(30,var0 = 0.2,var.rate = - 0.005) # ## heating sample after 5 min starting from 293 K ## by the temperature rate of 4 K min^{-1} convert_time2var(5, time.unit = "min", var0 = 293, var.rate = 4, var.rate.unit = "min^{-1}") # ## create/evaluate vector containing the applied ## cell potential (in V) from the simultaneously ## performed electrochemical oxidation experiment ## (e.g. cyclic voltammetry from -0.1V to 0.45V and back ## to -0.1V). Time series vector is labeled as "time_s". time_s <- seq(0,360,by = 18) E_V <- convert_time2var(time.vals = time_s, var0 = -0.1, var.switch = 0.45, var.rate = 0.003) ## preview as.matrix(E_V)
## calculate potential after 30 s, starting from 200 mV ## into cathodic direction (reduction) by 5 mV s^{-1} convert_time2var(30,var0 = 0.2,var.rate = - 0.005) # ## heating sample after 5 min starting from 293 K ## by the temperature rate of 4 K min^{-1} convert_time2var(5, time.unit = "min", var0 = 293, var.rate = 4, var.rate.unit = "min^{-1}") # ## create/evaluate vector containing the applied ## cell potential (in V) from the simultaneously ## performed electrochemical oxidation experiment ## (e.g. cyclic voltammetry from -0.1V to 0.45V and back ## to -0.1V). Time series vector is labeled as "time_s". time_s <- seq(0,360,by = 18) E_V <- convert_time2var(time.vals = time_s, var0 = -0.1, var.switch = 0.45, var.rate = 0.003) ## preview as.matrix(E_V)
Providing more accurate time for EPR spectral line/spectrum appearance. It assumes
that the middle (or
,
...etc.) of the EPR spectrum
is set as the CF (
central field
) for the spectrum sweep.
correct_time_Exp_Specs(time.s, Nscans, sweep.time.s)
correct_time_Exp_Specs(time.s, Nscans, sweep.time.s)
time.s |
Numeric value/vector/column in |
Nscans |
Numeric, number of accumulations (number of scans usually denoted as |
sweep.time.s |
Numeric, time (in |
The actual time at the middle/crossing point is different from that recorder by the EPR acquisition software, see below. This is especially important in determining the kinetics of radical generation or decay. Time is recorded according to the following scheme, where "^v" in the scheme denotes the derivative form of an EPR spectrum:
EPR Spectr. | EPR Spectr. | ||||
t[1] |
------^v------> | t[2] -delay |
----> | t[2] |
------^v-------> ... |
N_scans *swt |
delay |
N_scans *swt
|
The recorded times are: t[1]
,t[2]
,t[3]
,...
and the N_scans
corresponds to number of scans
, swt
to sweep time
for the individual scan. These parameters can be obtained by the readEPR_params_slct_kin
or other functions which can read the instrumental parameter files.
Numeric value/vector, corresponding to time at which the middle (-axis) of EPR
spectrum/spectra were recorded during the kinetic measurements (e.g. radical formation,
stability, electrochemical and/or photochemical measurements).
Other Conversions and Corrections:
convert_A_MHz_2a()
,
convert_B()
,
convert_a_mT_2A()
,
convert_time2var()
## 12 s recorded by spectrometer, 6 accumulations by the sweep time of 6 s correct_time_Exp_Specs(12,Nscans = 6,6)
## 12 s recorded by spectrometer, 6 accumulations by the sweep time of 6 s correct_time_Exp_Specs(12,Nscans = 6,6)
Creating files and folders for the basic Quarto project having
the structure shown in Details
and corresponding to reproducible report in EPR.
The main .qmd
("quarto markdown") file, wd.subdir.name.qmd
, is editable
(so do the additional files as well) and used for rendering. The latter can be done directly within
the RStudio IDE (by activating
the Render
button and selecting the desired output format
like .html
,.pdf
or .docx
).
Alternatively, the rendering can be also performed
in the terminal
or R console. The .pdf
format requires
one of the distributions:
{tinytex}
(R package),
Live or
.
The complete, above-described, R-environmental setup is also available
at Posit Cloud.
create_qmdReport_proj( title = "Project Report", path_to_wd = ".", wd.subdir.name = "Project_Report", citation.style = NULL, Rproj.init = TRUE, git.init = FALSE )
create_qmdReport_proj( title = "Project Report", path_to_wd = ".", wd.subdir.name = "Project_Report", citation.style = NULL, Rproj.init = TRUE, git.init = FALSE )
title |
Character string, corresponding to title of the report like the default one:
|
path_to_wd |
Character string, setting up the path for working directory,
i.e. the parent one, where the project with |
wd.subdir.name |
Character string, pointing to |
citation.style |
Character string, referring to citation style used for |
Rproj.init |
Logical, whether to initiate the newly created repository/directory as
R-project
when working in RStudio. Therefore, default: |
git.init |
Logical, if |
In order to support reproducible research workflow (see References
) in EPR from scratch,
a central data hub (repository/directory) with a well-defined structure must be available.
The one, presented below, is created using the essential dir.create
and file.create
file-folder R-management functions. For several files
(like wd.subdir.name.qmd
, header.tex
, title.tex
, styles.scss
and _quarto.yml
) customized templates (stored under /extdata/_extensions
) are used.
Remaining wd.subdir.name.bib
and README.Rmd
files are generated "ab initio".
The wd.subdir.name
is everywhere replaced by the actual character string defined
by the argument of the same name. Therefore, if we take the default string like "Project_Report",
file/directory names turn into Project_Report/Project_Report.ext
(.ext
.qmd
, .bib
,...etc). Prior to rendering,
you may provide information about the author like name:
, email:
,
orcid:
and affiliations name:
and url:
, directly within the main .qmd
file.
The .bib
file is already pre-populated by one example, actually corresponding to {eprscope}
package citation. The .bib
reference/citation database/file can be extended and organized
by the online service called CiteDrive, which can be also used
as a web clipper for your references/citations,
please refer to the available browser extensions.
path_to_wd
|
|
|—– wd.subdir.name
|
|
|—– wd.subdir.name.qmd
..."dynamic" document, main file for the entire
|
data processing and analysis workflow
|
|
|—– header.tex
...file to set up the .qmd
(.tex
)
|
==> .pdf
conversion, usually containing additional
|
packages and visual setup for the .pdf
output
|
|
|—– title.tex
...file for setting up the title and authors
|
in the .pdf
output
|
|
|—– styles.scss
...style sheet to set up visual style
|
of the .html
output format
|
|
|—– wd.subdir.name.bib
...bibliographic file database of all
|
reference-list entries related to the project report
|
|
|—– README.Rmd
...general documentation for the entire project/repository
|
|
|—– _quarto.yml
...setup for the main wd.subdir.name.qmd
file,
|
providing different format outputs (.html
,.pdf
,.docx
)
|
|
|—– Input_Data
|
|
|
|
|
|—– EPR_RAW
|
|
|
|
|
|
|
|
|—–...folder dedicated for all raw files from EPR spectrometer,
|
|
like .dsc/.DSC/.par
, .DTA
, .YGF
|
|
|
|
|
|—– EPR_ASCII
|
|
|
|
|
|
|
|
|—–...folder dedicated to all additional text files from EPR spectrometer,
|
|
like .txt
, .csv
, .asc
|
|
|
|
|
|—– EasySpin_Simulations
|
|
|
|
|
|
|
|
|—–...folder dedicated for output files from the EasySpin
(-MATLAB),
|
|
like .mat
or .txt
corresponding to EPR simulated spectral data
|
|
|—– _output
|
|
|—– Figures
|
|
|—– Tables
|
|
|—–...+ .html
,.pdf
,.docx
formats and supporting files
of the report, these are created by rendering the main
wd.subdir.name.qmd
file (they are not present after
the project is created)
Rendering of the wd.subdir.name.qmd
into different formats (.html
,.pdf
,
.docx
) is provided by the open-source scientific and technical publishing system
(based on pandoc), called Quarto (Allaire JJ et al. (2024) in the References
).
The main .qmd
file represents a "dynamic" document, combining
text, code (besides R, also other
programming languages like Python, Julia or Observable can be used as well) and outputs
(usually, figures and/or tables). Upon rendering, they are nicely combined into shareable above-listed
report formats stored under the _output
. Among them, the .html
output possesses
a distinctive position, because it preserves the structure of interactive EPR spectra or tables
(see e.g. plot_EPR_Specs3D_interact
or readEPR_params_tabs
).
File-Folder structure, presented above, is flexible and customizable to meet the user's needs,
right after its creation by the actual function. For such purpose, please consult
the Quarto documentation as well.
File-folder structure ("tree") for the basic Quarto reproducible report in R, which may be used for data processing and analysis in Electron Paramagnetic Resonance (EPR).
Alston JM, Rick JA (2021). “A Beginner's Guide to Conducting Reproducible Research”, Bull. Ecol. Soc. Am., 102(2), e01801–14, https://doi.org/10.1002/bes2.1801.
Gandrud C (2020). Reproducible Research with R and RStudio, 3rd edition, Chapman and Hall/CRC. ISBN 978-0-429-03185-4, https://doi.org/10.1201/9780429031854.
National Academies of Sciences, Engineering, and Medicine, Policy and Global Affairs, Committee on Science, Engineering, Medicine, and Public Policy, Board on Research Data and Information, Division on Engineering and Physical Sciences, Committee on Applied and Theoretical Statistics, Board on Mathematical Sciences and Analytics, Division on Earth and Life Studies, Nuclear and Radiation Studies Board, Division of Behavioral and Social Sciences and Education, Committee on National Statistics, Board on Behavioral, Cognitive, and Sensory Sciences, Committee on Reproducibility and Replicability in Science (2019). “Reproducibility and Replicability in Science: Understanding Reproducibility and Replicability”, https://www.ncbi.nlm.nih.gov/books/NBK547546/, National Academies Press (US).
Allaire JJ, Teague C, Scheidegger C, Xie Y, Dervieux C (2024). Quarto. https://doi.org/10.5281/zenodo.5960048, v1.5, https://github.com/quarto-dev/quarto-cli.
## Not run: ## creating reproducible report structure ## with the default parameters create_qmdReport_proj() # ## creating report with the specified citation style (ACS) ## and with versioning controlled by the `git` within ## the RStudio (Rproj.init = TRUE) create_qmdReport_proj( citation.style = "https://www.zotero.org/styles/american-chemical-society", git.init = TRUE ) ## End(Not run)
## Not run: ## creating reproducible report structure ## with the default parameters create_qmdReport_proj() # ## creating report with the specified citation style (ACS) ## and with versioning controlled by the `git` within ## the RStudio (Rproj.init = TRUE) create_qmdReport_proj( citation.style = "https://www.zotero.org/styles/american-chemical-society", git.init = TRUE ) ## End(Not run)
{rcdk}
Defined by SMILES or SDFDrawing a molecular structure based on rcdk package and using SMILES or SDF input data. This function is inspired by the Edgardo Rivera-Delgado article.
draw_molecule_by_rcdk( molecule, type = "smiles", mol.label = NULL, mol.label.color = "black", mol.label.xy.posit = c(8.2, 1.2), sma = NULL, annotate = "off", style = "cow", abbr = "off", suppressh = TRUE, ... )
draw_molecule_by_rcdk( molecule, type = "smiles", mol.label = NULL, mol.label.color = "black", mol.label.xy.posit = c(8.2, 1.2), sma = NULL, annotate = "off", style = "cow", abbr = "off", suppressh = TRUE, ... )
molecule |
Character input string => either SMILES strings (in case
of |
|||||||||||||
type |
Character string referred to the original molecular type input =>
either |
|||||||||||||
mol.label |
Character string, pointing to name of the molecule/compound, e.g.
|
|||||||||||||
mol.label.color |
Character string, pointing to displayed font color of the chemical structure
label. Default: |
|||||||||||||
mol.label.xy.posit |
Numeric vector of two values, matching the |
|||||||||||||
sma |
Character string, allowing to highlight sub-structures using
|
|||||||||||||
annotate |
Character string, whether to display ( |
|||||||||||||
style |
Character string, denoting the plotting style like =>
Default: |
|||||||||||||
abbr |
Character string, which controls how the structure is displayed. Following options
can be set => |
|||||||||||||
suppressh |
Logical, denoting whether to suppress displaying of the hydrogen atoms.
The |
|||||||||||||
... |
additional options/arguments for the |
Graphics/Figure object with molecular structure.
Other Visualizations and Graphics:
plot_EPR_Specs()
,
plot_EPR_Specs2D_interact()
,
plot_EPR_Specs3D_interact()
,
plot_EPR_Specs_integ()
,
plot_EPR_present_interact()
,
plot_labels_xyz()
,
plot_layout2D_interact()
,
plot_theme_In_ticks()
,
plot_theme_NoY_ticks()
,
plot_theme_Out_ticks()
,
present_EPR_Sim_Spec()
## draw N,N,N',N'-tetramethyl-p-phenylenediamine based ## on the `smiles` code character with highlighting ## the "C(aromatic)--N" bond draw_molecule_by_rcdk("CN(C)C1=C([H])C([H])=C(N(C)C)C([H])=C1[H]", type = "smiles", sma = "cN") # ## draw N,N,N',N'-tetramethyl-p-phenylenediamine (TMPD) radical ## cation based on the `smiles` code character, with hydrogen atoms ## and molecule name label = "TMPD^(+.)" draw_molecule_by_rcdk("CN(C)[C+]1C([H])=C([H])[C.]([N](C)C)C([H])=C1[H]", type = "smiles", mol.label = expression(TMPD^+.), mol.label.color = "blue", suppressh = FALSE) # ## draw N,N,N',N'-tetramethyl-p-phenylenediamine based ## on the `sdf` file path ("TMPD.sdf") with "color on black" ## style + atom numbering draw_molecule_by_rcdk(molecule = load_data_example("TMPD.sdf"), type = "sdf", annotate = "number", style = "cob")
## draw N,N,N',N'-tetramethyl-p-phenylenediamine based ## on the `smiles` code character with highlighting ## the "C(aromatic)--N" bond draw_molecule_by_rcdk("CN(C)C1=C([H])C([H])=C(N(C)C)C([H])=C1[H]", type = "smiles", sma = "cN") # ## draw N,N,N',N'-tetramethyl-p-phenylenediamine (TMPD) radical ## cation based on the `smiles` code character, with hydrogen atoms ## and molecule name label = "TMPD^(+.)" draw_molecule_by_rcdk("CN(C)[C+]1C([H])=C([H])[C.]([N](C)C)C([H])=C1[H]", type = "smiles", mol.label = expression(TMPD^+.), mol.label.color = "blue", suppressh = FALSE) # ## draw N,N,N',N'-tetramethyl-p-phenylenediamine based ## on the `sdf` file path ("TMPD.sdf") with "color on black" ## style + atom numbering draw_molecule_by_rcdk(molecule = load_data_example("TMPD.sdf"), type = "sdf", annotate = "number", style = "cob")
)Calculating the peak-to-peak
(distance between the x-axis
projection of "min" and "max" derivative intensities) linewidth of an EPR/ENDOR spectrum.
eval_DeltaXpp_Spec( data.spectr, x = "B_mT", Intensity = "dIepr_over_dB", xlim = NULL )
eval_DeltaXpp_Spec( data.spectr, x = "B_mT", Intensity = "dIepr_over_dB", xlim = NULL )
data.spectr |
EPR/ENDOR spectrum data frame object with magnetic flux density B (in |
x |
Character string, pointing to name of the |
Intensity |
Character string, pointing to name of the |
xlim |
Numeric vector, corresponding to lower and upper limit of the selected x-region,
such as |
Numeric value difference of the x
-axis quantity like B,g,RF (the absolute value),
corresponding to minimum
and maximum
of the derivative intensity (dIepr_over_dB
)
in EPR/ENDOR spectrum.
Other Evaluations:
eval_FWHMx_Spec()
,
eval_extremeX_Spec()
,
eval_gFactor()
,
eval_gFactor_Spec()
,
eval_interval_cnfd_tVec()
,
eval_kinR_Eyring_GHS()
,
eval_nu_ENDOR()
,
eval_peakPick_Spec()
## loading the aminoxyl radical CW EPR spectrum: aminoxyl.data.path <- load_data_example(file = "Aminoxyl_radical_a.txt") aminoxyl.data <- readEPR_Exp_Specs(aminoxyl.data.path, qValue = 2100) # ## evaluation of the central linewidth (∆Bpp in `mT`): eval_DeltaXpp_Spec(aminoxyl.data, xlim = c(348.345,350.450)) # ## plot interactive spectrum plot_EPR_Specs2D_interact(aminoxyl.data) # ## the linewidth ∆Bpp (in `mT`) may be directly ## checked from the interactive spectrum above ## as a difference between the minimum and maximum ## of the `dIepr_over_dB` central line intensity: 349.648-349.107 # ## loading the perinaphthenyl (PNT) CW ENDOR spectrum: pnt.endor.data.path <- load_data_example(file = "PNT_ENDOR_a.txt") pnt.endor.data <- readEPR_Exp_Specs(pnt.endor.data.path, col.names = c("index", "RF_MHz", "dIepr_over_dB"), x.unit = "MHz") # ## evaluation of the fourth linewidth (∆freq.(pp) ## in `MHz`) in the ENDOR spectrum: eval_DeltaXpp_Spec(pnt.endor.data, x = "RF_MHz", xlim = c(22.38,24.54) ) # ## plot interactive ENDOR spectrum: plot_EPR_Specs2D_interact(pnt.endor.data, x = "RF_MHz", x.unit = "MHz") # ## the linewidth (∆freq.(pp) in `MHz`) may be ## directly checked from the previous interactive ## CW ENDOR spectrum as a difference between ## the minimum and maximum of the `dIepr_over_dB` ## of the 4th line intensity: 23.42-23.30
## loading the aminoxyl radical CW EPR spectrum: aminoxyl.data.path <- load_data_example(file = "Aminoxyl_radical_a.txt") aminoxyl.data <- readEPR_Exp_Specs(aminoxyl.data.path, qValue = 2100) # ## evaluation of the central linewidth (∆Bpp in `mT`): eval_DeltaXpp_Spec(aminoxyl.data, xlim = c(348.345,350.450)) # ## plot interactive spectrum plot_EPR_Specs2D_interact(aminoxyl.data) # ## the linewidth ∆Bpp (in `mT`) may be directly ## checked from the interactive spectrum above ## as a difference between the minimum and maximum ## of the `dIepr_over_dB` central line intensity: 349.648-349.107 # ## loading the perinaphthenyl (PNT) CW ENDOR spectrum: pnt.endor.data.path <- load_data_example(file = "PNT_ENDOR_a.txt") pnt.endor.data <- readEPR_Exp_Specs(pnt.endor.data.path, col.names = c("index", "RF_MHz", "dIepr_over_dB"), x.unit = "MHz") # ## evaluation of the fourth linewidth (∆freq.(pp) ## in `MHz`) in the ENDOR spectrum: eval_DeltaXpp_Spec(pnt.endor.data, x = "RF_MHz", xlim = c(22.38,24.54) ) # ## plot interactive ENDOR spectrum: plot_EPR_Specs2D_interact(pnt.endor.data, x = "RF_MHz", x.unit = "MHz") # ## the linewidth (∆freq.(pp) in `MHz`) may be ## directly checked from the previous interactive ## CW ENDOR spectrum as a difference between ## the minimum and maximum of the `dIepr_over_dB` ## of the 4th line intensity: 23.42-23.30
Evaluation of the transferred charge and the corresponding number of electrons
from chronoamperogram related to electrochemical
experiment, performed simultaneously with the EPR time series measurement or independently of the latter.
To acquire charge, the input vs
relation (coming from the
data.at
) is integrated by the pracma::cumtrapz
function.
Prior to integration a capacitive current correction must be done, especially if it is relatively
high in comparison to faradaic one. Afterwards,
the number of electrons is calculated by Faraday's law (see details). The output plot can be visualized
either as vs
(time) or as
vs
(potential, if available in the input
data.at
).
eval_ECh_QNe_chronoamp( data.at, time = "time_s", time.unit = "s", tlim = NULL, Current = "I_A", Current.unit = "A", E = NULL, E.unit = NULL, ref.electrode = NULL, Ne.output = TRUE, separate.plots = FALSE )
eval_ECh_QNe_chronoamp( data.at, time = "time_s", time.unit = "s", tlim = NULL, Current = "I_A", Current.unit = "A", E = NULL, E.unit = NULL, ref.electrode = NULL, Ne.output = TRUE, separate.plots = FALSE )
data.at |
Data frame (table) object, including required columns like |
time |
Character string, pointing to |
time.unit |
Character string, pointing to |
tlim |
Numeric vector of the |
Current |
Character string, indicating the |
Current.unit |
Character string, pointing to |
E |
Character string, referring to |
E.unit |
Character string, setting the potential unit (see |
ref.electrode |
Character string, corresponding to reference electrode notiation/label, e.g.
|
Ne.output |
Logical. Should be the number of transferred electrons ( |
separate.plots |
Logical. By default, both relations: |
When quantitative EPR is carried out along with electrochemistry simultaneously,
one can easily compare the number of radicals with the number of transferred electrons.
Number of radicals () are evaluated from quantitative measurements (see also
quantify_EPR_Abs
), whereas number of transferred electrons () is related
to charge (
), according to:
where stands for the Avogadro's number and
for the Faraday's constants.
Both are obtained by the
constans::syms$na
and the constants::syms$f
, respectively,
using the constants package
(see syms
). If both numbers match (),
it reveals the presence of one-electron oxidation/reduction, while different numbers may point
to a more complex mechanism (such as comproportionation, follow-up reactions, multiple electron transfer).
List containing the following elements, depending on separate.plots
:
If separate.plots = FALSE
Original data.at
data frame object with the following additional
columns/variables: Q_C
(charge in coulombs), Q_mC
(charge in millicoulombs,
if the maximum charge ) and
Ne
(number of transferred
electrons, if Ne.output = TRUE
).
Side-by-side plot object (list) of vs
as well as
vs
.
If separate.plots = TRUE
Original data.at
data frame object with the following additional
columns/variables: Q_C
(charge in coulombs), Q_mC
(charge in millicoulombs,
if the maximum charge ) and
Ne
(number of transferred
electrons, if Ne.output = TRUE
).
Plot object (list) of vs
.
Plot object (list) of vs
.
Bard AJ, Faulkner LR, White HS (2022). Electrochemical methods: Fundamentals and Applications, 3rd edition, John Wiley and Sons, Inc., ISBN 978-1-119-33405-7, https://www.wiley.com/en-us/9781119334064.
Pingarrón JM, Labuda J, Barek J, Brett CMA, Camões MF, Fojta M, Hibbert DB (2020). “Terminology of Electrochemical Methods of Analysis (IUPAC Recommendations 2019).” Pure Appl. Chem., 92(4), 641–694, https://doi.org/10.1515/pac-2018-0109.
Neudeck A, Petr A, Dunsch L (1999). “The redox mechanism of Polyaniline Studied by Simultaneous ESR–UV–vis Spectroelectrochemistry.” Synth. Met., 107(3), 143–158, https://doi.org/10.1016/S0379-6779(99)00135-6.
Hans W. Borchers (2023). pracma: Practical Numerical Math Functions. R package version 2.4.4, https://cran.r-project.org/web/packages/pracma/index.html.
Other EPR Spectroelectrochemistry:
plot_ECh_VoC_amperogram()
## loading package built-in example file => ## `.txt` file generated by the IVIUM potentiostat software triarylamine.path.cv <- load_data_example(file = "Triarylamine_ECh_CV_ivium.txt") ## the data frame contains following variables: ## time, desired potential, current and the actual/applied ## potential triarylamine.data.cv <- data.table::fread(file = triarylamine.path.cv, skip = 2, col.names = c("time_s", "E_V_des", # desired potential "I_A", "E_V_app") # applied potential ) # ## simple chronoamperogram plot plot_ECh_VoC_amperogram(data.vat = triarylamine.data.cv, x = "time_s", x.unit = "s", Current = "I_A", Current.unit = "A", ticks = "in" ) # ## transferred charge and the number of electrons ## with default parameters triarylamine.data.QNe <- eval_ECh_QNe_chronoamp(data.at = triarylamine.data.cv) # ## data frame preview triarylamine.data.QNe$df # ## graphical representation triarylamine.data.QNe$plot
## loading package built-in example file => ## `.txt` file generated by the IVIUM potentiostat software triarylamine.path.cv <- load_data_example(file = "Triarylamine_ECh_CV_ivium.txt") ## the data frame contains following variables: ## time, desired potential, current and the actual/applied ## potential triarylamine.data.cv <- data.table::fread(file = triarylamine.path.cv, skip = 2, col.names = c("time_s", "E_V_des", # desired potential "I_A", "E_V_app") # applied potential ) # ## simple chronoamperogram plot plot_ECh_VoC_amperogram(data.vat = triarylamine.data.cv, x = "time_s", x.unit = "s", Current = "I_A", Current.unit = "A", ticks = "in" ) # ## transferred charge and the number of electrons ## with default parameters triarylamine.data.QNe <- eval_ECh_QNe_chronoamp(data.at = triarylamine.data.cv) # ## data frame preview triarylamine.data.QNe$df # ## graphical representation triarylamine.data.QNe$plot
Finding the x
positions like B (in mT
or G
)), g (unitless)
or RF (in MHz
) of the intensity minimum or maximum within the selected region
of an EPR/ENDOR spectrum. In terms of extremes, If one wants to perform peak picking of an EPR/ENDOR spectrum,
the eval_peakPick_Spec
function can be applied.
eval_extremeX_Spec( data.spectr, x = "B_mT", Intensity = "dIepr_over_dB", xlim = NULL, extreme = "max" )
eval_extremeX_Spec( data.spectr, x = "B_mT", Intensity = "dIepr_over_dB", xlim = NULL, extreme = "max" )
data.spectr |
EPR/ENDOR spectrum data frame object with magnetic flux density B (in |
x |
Character string, pointing to name of the |
Intensity |
Character string, pointing to name of the |
xlim |
Numeric vector, corresponding to lower and upper limit of the selected x-region,
such as |
extreme |
Character string with only two values allowed: |
Numeric value of x
-axis variable like B,g,RF, corresponding
to Intensity
minimum
or its maximum
, within the EPR/ENDOR spectrum or its integrated form.
Other Evaluations:
eval_DeltaXpp_Spec()
,
eval_FWHMx_Spec()
,
eval_gFactor()
,
eval_gFactor_Spec()
,
eval_interval_cnfd_tVec()
,
eval_kinR_Eyring_GHS()
,
eval_nu_ENDOR()
,
eval_peakPick_Spec()
## loading TMPD built-in example file: tmpd.data.file.path <- load_data_example(file = "TMPD_specelchem_accu_b.asc") ## reading data: tmpd.data.file <- readEPR_Exp_Specs(path_to_ASC = tmpd.data.file.path, col.names = c("B_G", "dIepr_over_dB"), qValue = 3500, norm.vec.add = 20, origin = "winepr") # ## finding maximum and minimum `B` within the entire ## spectral (`B`) range: eval_extremeX_Spec(data.spectr = tmpd.data.file) # eval_extremeX_Spec(data.spectr = tmpd.data.file, extreme = "min") # ## both values can be checked by the interactive ## spectrum: plot_EPR_Specs2D_interact(tmpd.data.file)
## loading TMPD built-in example file: tmpd.data.file.path <- load_data_example(file = "TMPD_specelchem_accu_b.asc") ## reading data: tmpd.data.file <- readEPR_Exp_Specs(path_to_ASC = tmpd.data.file.path, col.names = c("B_G", "dIepr_over_dB"), qValue = 3500, norm.vec.add = 20, origin = "winepr") # ## finding maximum and minimum `B` within the entire ## spectral (`B`) range: eval_extremeX_Spec(data.spectr = tmpd.data.file) # eval_extremeX_Spec(data.spectr = tmpd.data.file, extreme = "min") # ## both values can be checked by the interactive ## spectrum: plot_EPR_Specs2D_interact(tmpd.data.file)
Finding the full width at half-maximum (FWHM) height of the EPR integrated spectrum/intensity.
For such purpose, the EPR spectrum must be available in single integrated form (common absorption-like spectrum).
If this is not the case, the derivative EPR spectrum (with the intensity dIepr_over_dB
)
can be integrated by the eval_integ_EPR_Spec
. The FWHM is evaluated as a difference
between the points ( and
) having the intensity
closest to the intensity maximum/2 corresponding to one individual EPR line/peak defined
by the
xlim
argument.
eval_FWHMx_Spec( data.spectr.integ, x = "B_G", Intensity = "single_Integ", xlim = NULL )
eval_FWHMx_Spec( data.spectr.integ, x = "B_G", Intensity = "single_Integ", xlim = NULL )
data.spectr.integ |
Data frame object, containing |
x |
Character string, pointing to name of the |
Intensity |
Character string, pointing to name of the |
xlim |
Numeric vector, corresponding to lower and upper limit of the selected x-region,
e.g. |
Numeric value of the FWHM, directly from EPR spectrum, depending on the x
variable =>
either in mT
/G
or unitless in case if g-factor is presented on abscissa.
Other Evaluations:
eval_DeltaXpp_Spec()
,
eval_extremeX_Spec()
,
eval_gFactor()
,
eval_gFactor_Spec()
,
eval_interval_cnfd_tVec()
,
eval_kinR_Eyring_GHS()
,
eval_nu_ENDOR()
,
eval_peakPick_Spec()
## simulation of the phenalenyl/perinaphthenyl (PNT) radical ## in integrated form: pnt.sim.integ.iso <- eval_sim_EPR_iso(g = 2.0027, instrum.params = c(Bcf = 3500, # central field Bsw = 100, # sweep width Npoints = 4096, mwGHz = 9.8), # MW Freq. in GHz B.unit = "G", nuclear.system = list( list("1H",3,5.09), # 3 x A(1H) = 5.09 MHz list("1H",6,17.67) # 6 x A(1H) = 17.67 MHz ), lineSpecs.form = "integrated", lineGL.DeltaB = list(0.54,NULL), # Gauss. FWHM in G Intensity.sim = "single_Integ" ) # ## FWHM of one of the central ## lines/peaks (`xlim = c(3494,3496.5)`) ## from the simulated spectral data: eval_FWHMx_Spec(pnt.sim.integ.iso$df, x = "Bsim_G", Intensity = "single_Integ", xlim = c(3494,3496.5) ) # ## interactive plot of the above-simulated ## EPR spectrum in order to check the values: plot_EPR_Specs2D_interact(pnt.sim.integ.iso$df, x = "Bsim_G", x.unit = "G", Intensity = "single_Integ", lineSpecs.form = "integrated" )
## simulation of the phenalenyl/perinaphthenyl (PNT) radical ## in integrated form: pnt.sim.integ.iso <- eval_sim_EPR_iso(g = 2.0027, instrum.params = c(Bcf = 3500, # central field Bsw = 100, # sweep width Npoints = 4096, mwGHz = 9.8), # MW Freq. in GHz B.unit = "G", nuclear.system = list( list("1H",3,5.09), # 3 x A(1H) = 5.09 MHz list("1H",6,17.67) # 6 x A(1H) = 17.67 MHz ), lineSpecs.form = "integrated", lineGL.DeltaB = list(0.54,NULL), # Gauss. FWHM in G Intensity.sim = "single_Integ" ) # ## FWHM of one of the central ## lines/peaks (`xlim = c(3494,3496.5)`) ## from the simulated spectral data: eval_FWHMx_Spec(pnt.sim.integ.iso$df, x = "Bsim_G", Intensity = "single_Integ", xlim = c(3494,3496.5) ) # ## interactive plot of the above-simulated ## EPR spectrum in order to check the values: plot_EPR_Specs2D_interact(pnt.sim.integ.iso$df, x = "Bsim_G", x.unit = "G", Intensity = "single_Integ", lineSpecs.form = "integrated" )
-factorCalculation of -factor according to fundamental formula (see
Value
).
The magnetic flux density (B.val
) and microwave frequency (nu.val
,)
can be defined, having the common units like
G
(Gauss) mT
(millitesla) or T
(tesla) as well as GHz
or Hz
.
eval_gFactor(nu.val, nu.unit = "GHz", B.val, B.unit = "mT")
eval_gFactor(nu.val, nu.unit = "GHz", B.val, B.unit = "mT")
nu.val |
Numeric, microwave Frequency value. |
nu.unit |
Character string, frequency unit defined by |
B.val |
Numeric, magnetic flux density value. |
B.unit |
Character string, magnetic flux density unit in |
-Value from
. Physical constants (
and
) are taken from constants
package by the
syms
.
Other Evaluations:
eval_DeltaXpp_Spec()
,
eval_FWHMx_Spec()
,
eval_extremeX_Spec()
,
eval_gFactor_Spec()
,
eval_interval_cnfd_tVec()
,
eval_kinR_Eyring_GHS()
,
eval_nu_ENDOR()
,
eval_peakPick_Spec()
eval_gFactor(9.8020458, nu.unit = "GHz", 350.214, B.unit = "mT") # eval_gFactor(nu.val = 9.8020458e+9, nu.unit = "Hz", B.val = 3502.14, B.unit = "G") # eval_gFactor(9.5421,"GHz",0.333251,"T")
eval_gFactor(9.8020458, nu.unit = "GHz", 350.214, B.unit = "mT") # eval_gFactor(nu.val = 9.8020458e+9, nu.unit = "Hz", B.val = 3502.14, B.unit = "G") # eval_gFactor(9.5421,"GHz",0.333251,"T")
-factor from Quantum Chemical Computational OutputIn the Gaussian and ORCA outputs, the -value (its 3 principal components) is presented in the form
of differences from the
(
of the free electron). Therefore, the function takes these values
to calculate the entire
-factor components or parses the corresponding
-mean value
from the outputs.
eval_gFactor_QCHcomp(path_to_QCHoutput, mean = TRUE, origin = "gaussian")
eval_gFactor_QCHcomp(path_to_QCHoutput, mean = TRUE, origin = "gaussian")
path_to_QCHoutput |
Character string, corresponding to path of "Gaussian" or "ORCA" output text files
including all |
mean |
Logical, whether to calculate the |
origin |
Character string, pointing to origin of the EPR calculation parameters <=> which
software package was used. Only two values are available => |
Numeric mean -factor value from the principal difference (from
) components
calculated by the QCH method (e.g. by DFT) or numeric vector with the principal
-components
if
mean = FALSE
.
Other Evaluations and Quantum Chemistry:
rearrange_aAiso_QCHcomp()
,
rearrange_aAiso_QCHorgau()
## built-in package file example and path: gauss.file.path <- load_data_example(file = "TMPDAradCatEPRa.inp.log.zip") gauss.file <- unzip(gauss.file.path) ## g_iso-value calculation from Gaussian output file: eval_gFactor_QCHcomp(gauss.file)
## built-in package file example and path: gauss.file.path <- load_data_example(file = "TMPDAradCatEPRa.inp.log.zip") gauss.file <- unzip(gauss.file.path) ## g_iso-value calculation from Gaussian output file: eval_gFactor_QCHcomp(gauss.file)
-factor ("Position") from EPR Spectrum/DataCalculation of g-value according to fundamental formula, see eval_gFactor
.
-related magnetic flux density (like
or
)
is directly taken from the EPR spectrum. If positive and negative derivative intensities of the spectral
line are similar and their distance from the middle point of the spectrum equals,
the
should be considered. Otherwise, the
must be taken
into account. In case of integrated EPR spectrum/data, the
is used for
the
-value calculation.
eval_gFactor_Spec( data.spectr, nu.GHz, B.unit = "G", B = "B_G", Intensity = "dIepr_over_dB", lineSpecs.form = "derivative", Blim = NULL, iso = TRUE )
eval_gFactor_Spec( data.spectr, nu.GHz, B.unit = "G", B = "B_G", Intensity = "dIepr_over_dB", lineSpecs.form = "derivative", Blim = NULL, iso = TRUE )
data.spectr |
Spectrum data frame object where the magnetic flux density (in |
nu.GHz |
Numeric value, microwave frequency in |
B.unit |
Character string, denoting the magnetic flux density unit e.g. |
B |
Character string, pointing to magnetic flux density |
Intensity |
Character string, pointing to |
lineSpecs.form |
Character string, describing either |
Blim |
Numeric vector, magnetic flux density in |
iso |
Logical, whether to calculate the |
Numeric -value ('iso' = 'isotropic') or
,
from the EPR spectrum, according to
.
Other Evaluations:
eval_DeltaXpp_Spec()
,
eval_FWHMx_Spec()
,
eval_extremeX_Spec()
,
eval_gFactor()
,
eval_interval_cnfd_tVec()
,
eval_kinR_Eyring_GHS()
,
eval_nu_ENDOR()
,
eval_peakPick_Spec()
## load package built-in EPR spectral data example: data.file.path <- load_data_example(file = "TMPD_specelchem_accu_b.asc") data.epr <- readEPR_Exp_Specs(path_to_ASC = data.file.path, col.names = c("B_G", "dIepr_over_dB"), qValue = 3500, origin = "winepr") # ## g_iso calculation from EPR spectrum/data: eval_gFactor_Spec(data.spectr = data.epr, nu.GHz = 9.814155, B.unit = "mT", B = "B_mT", Blim = c(349.677, 350.457))
## load package built-in EPR spectral data example: data.file.path <- load_data_example(file = "TMPD_specelchem_accu_b.asc") data.epr <- readEPR_Exp_Specs(path_to_ASC = data.file.path, col.names = c("B_G", "dIepr_over_dB"), qValue = 3500, origin = "winepr") # ## g_iso calculation from EPR spectrum/data: eval_gFactor_Spec(data.spectr = data.epr, nu.GHz = 9.814155, B.unit = "mT", B = "B_mT", Blim = c(349.677, 350.457))
Evaluates integrals of EPR spectra (based on the pracma::cumtrapz
function)
depending on input data => either corresponding to derivative
or single integrated
EPR signal form, with the option to correct the single integral baseline
by the polynomial fit of the poly.degree
level. For EPR time/temperature/...etc spectral series,
(data frame must be available in tidy/long table format),
there is an option to integrate all EPR spectra literally in one step (see also Examples
),
similarly to function available in acquisition/processing software at EPR spectrometers.
eval_integ_EPR_Spec( data.spectr, B = "B_G", B.unit = "G", Intensity = "dIepr_over_dB", lineSpecs.form = "derivative", Blim = NULL, correct.integ = FALSE, BpeaKlim = NULL, poly.degree = NULL, sigmoid.integ = FALSE, output.vecs = FALSE )
eval_integ_EPR_Spec( data.spectr, B = "B_G", B.unit = "G", Intensity = "dIepr_over_dB", lineSpecs.form = "derivative", Blim = NULL, correct.integ = FALSE, BpeaKlim = NULL, poly.degree = NULL, sigmoid.integ = FALSE, output.vecs = FALSE )
data.spectr |
Spectrum data frame/table object with magnetic flux density (in |
B |
Character string, pointing to magnetic flux density column header (in the original
|
B.unit |
Character string pointing to unit of magnetic flux density, which
is to be presented on |
Intensity |
Character string, pointing to column name of either derivative
(e.g. |
lineSpecs.form |
Character string, describing either |
Blim |
Numeric vector, magnetic flux density in |
correct.integ |
Logical, whether to correct the integral by baseline polynomial model fit.
Default: |
BpeaKlim |
Numeric vector, magnetic flux density in |
poly.degree |
Numeric, degree of the polynomial function used to fit baseline under the single
integrated curve of the original EPR spectrum (see also |
sigmoid.integ |
Logical, whether to involve (column in data frame) double integral or single
integral (if the |
output.vecs |
Logical, whether the "integral" columns are presented within the original |
The relative error of the cumulative trapezoidal (cumtrapz
) function is minimal,
usually falling into the range of or even lower, depending on the spectral
data resolution (see Epperson JF (2013) and Seeburger P (2023) in the
References
).
Therefore, the better the resolution, the more accurate the integral. If the initial EPR spectrum displays low
signal-to-noise ratio, the integral often looses its sigmoid-shape
and thus, the EPR spectrum has to be either simulated (see also vignette("functionality")
)
or smoothed by the smooth_EPR_Spec_by_npreg
, prior to integration. Afterwards,
integrals are evaluated from the simulated or smoothed EPR spectra.
For the purpose of quantitative analysis, the integrals are evaluated using the B.units = "G"
(see Arguments). Hence, depending on -unit (
G
or mT
or T
) each resulting integral
column have to be optionally (in case of mT
or T
) multiplied by the factor of 10
or 10000
,
respectively, because and
.
Such corrections are already included in the function/script.
Instead of "double integral/integ." the term "sigmoid integral/integ." is used. "Double integral"
in the case of originally single integrated EPR spectrum (see
data.spectr
and Intensity
) is confusing. In such case, the EPR spectrum is integrated just once.
The integration results may be divided into following types, depending on the above-described
arguments. Generally, they are either data frames, including the original data and the integrals
(output.vecs = FALSE
) or vectors/vectors list, corresponding to individual baseline
corrected/uncorrected integrals (output.vecs = TRUE
). This is especially useful
for spectral (time) series EPR data, which can be handily processed
by the group_by
using the
pipe
operators (%>%
).
Data frame/table, including EPR spectral data (general Intensity
(integrated or derivative) vs ) as well as its corresponding
single
(column single_Integ
) integral. This is the case if only a single
uncorrected integral is required.
Data frame/table with single integral/intensity already corrected by a certain degree
of polynomial baseline (fitted to experimental baseline without peak). Single integrals
are related either to derivative or already integrated EPR spectra where corrected
integral column header is denoted as single_Integ_correct
. This is the case
if correct.integ = TRUE
and sigmoid.integ = FALSE
+ output.vecs = FALSE
.
Data frame with single
and double/sigmoid
integral column/variable
(sigmoid_Integ
), essential for the quantitative analysis. For such case it applies:
output.vecs = FALSE
and correct.integ = FALSE
.
Data frame in case of correct.integ = TRUE
, sigmoid.integ = TRUE
and output.vecs = FALSE
. It contains the original data frame columns + corrected
single integral (single_Integ_correct
) and double/sigmoid integral
(sigmoid_Integ
) which is evaluated from the baseline corrected single one.
Therefore, such double/sigmoid integral is suitable for the accurate determination
of radical (paramagnetic centers) amount.
Numeric vector, corresponding to baseline uncorrected/corrected single integral
in case of sigmoid.integ = FALSE
+ output.vecs = TRUE
.
List of numeric vectors corresponding to:
Corrected or uncorrected single integral (in case of derivative form),
depending on the correct.integ
argument.
Double integral (in case of derivative form) or single integral (in case of integrated spectral form) for quantitative analysis.
Weber RT (2011). Xenon User's Guide. Bruker BioSpin Manual Version 1.3, Software Version 1.1b50.
Hans W. Borchers (2023). pracma: Practical Numerical Math Functions. R package version 2.4.4, https://cran.r-project.org/web/packages/pracma/index.html.
Seeburger P (2023). “Numerical Integration - Midpoint, Trapezoid, Simpson's rule”, http://tinyurl.com/trapz-integral.
Svirin A (2023). “Calculus, Integration of Functions-Trapezoidal Rule”, https://math24.net/trapezoidal-rule.html.
Epperson JF (2013). An Introduction to Numerical Methods and Analysis. Wiley and Sons, ISBN 978-1-118-36759-9, https://books.google.cz/books?id=310lAgAAQBAJ.
Other Evaluations and Quantification:
eval_kinR_EPR_modelFit()
,
eval_kinR_ODE_model()
,
quantify_EPR_Abs()
,
quantify_EPR_Norm_const()
## loading the built-in package example ## time series EPR spectra: triarylamine.decay.series.dsc.path <- load_data_example(file = "Triarylamine_radCat_decay_series.DSC") triarylamine.decay.series.asc.path <- load_data_example(file = "Triarylamine_radCat_decay_series.zip") unzip(triarylamine.decay.series.asc.path, exdir = tempdir() ) ## loading the kinetics: triarylamine.decay.series.data <- readEPR_Exp_Specs_kin(name.root = "Triarylamine_radCat_decay_series", dir_ASC = tempdir(), dir_dsc_par = system.file("extdata", package = "eprscope") ) # ## select the first spectrum triarylamine.decay.series.data1st <- triarylamine.decay.series.data$df %>% dplyr::filter(time_s == triarylamine.decay.series.data$time[1]) # ## integrate the first spectrum with default arguments triarylamine.decay.data1st.integ01 <- eval_integ_EPR_Spec(triarylamine.decay.series.data1st) # ## data frame preview head(triarylamine.decay.data1st.integ01) # ## integration (including baseline correction) ## of the 1st spectrum from the series triarylamine.decay.data1st.integ02 <- eval_integ_EPR_Spec(triarylamine.decay.series.data1st, ## limits obtained from interactive spectrum: BpeaKlim = c(3471.5,3512.5), Blim = c(3425,3550), correct.integ = TRUE, poly.degree = 3, sigmoid.integ = TRUE ) # ## data frame preview head(triarylamine.decay.data1st.integ02) # ## plot the single integrated EPR spectrum, ## including baseline correction plot_EPR_Specs(triarylamine.decay.data1st.integ02, x = "B_G", x.unit = "G", Intensity = "single_Integ_correct", lineSpecs.form = "integrated" ) # ## plot, corresponding to double/sigmoid integral, ## which is related to corrected single integral plot_EPR_Specs(triarylamine.decay.data1st.integ02, x = "B_G", x.unit = "G", Intensity = "sigmoid_Integ", lineSpecs.form = "integrated" ) # ## vectorized output of the uncorrected `sigmoid_integral` triarylamine.decay.data1st.integ03 <- eval_integ_EPR_Spec(triarylamine.decay.series.data1st, sigmoid.integ = TRUE, output.vecs = TRUE)[["sigmoid"]] # ## preview of the first 6 values triarylamine.decay.data1st.integ03[1:6] # ## incorporation of vectorized integration into ## data "pipe" ("%>%") `dplyr` processing of EPR spectral ## time series, creating column with `sigmoid` integral ## where its corresponding single integral (intensity) ## has undergone a baseline correction, finally the max. value ## of all sigmoid integrals along with the time is ## summarized in data frame for quantitative kinetic analysis triarylamine.decay.data.integs <- triarylamine.decay.series.data$df %>% dplyr::group_by(time_s) %>% dplyr::filter(dplyr::between(B_G,3425,3550)) %>% dplyr::mutate(sigmoid_Integ = eval_integ_EPR_Spec(dplyr::pick(B_G,dIepr_over_dB), correct.integ = TRUE, BpeaKlim = c(3471.5,3512.5), poly.degree = 3, sigmoid.integ = TRUE, output.vecs = TRUE)$sigmoid ) %>% dplyr::summarize(Area = max(sigmoid_Integ)) ## in such case `Blim` range is not defined by `eval_integ_EPR_Spec`, ## the `Blim = NULL` and `dplyr::between()` must be set !!! # ## preview of the final data frame head(triarylamine.decay.data.integs) # ## preview of the simple plot ggplot2::ggplot(triarylamine.decay.data.integs) + ggplot2::geom_point(ggplot2::aes(x = time_s,y = Area)) # ## this does not correspond to example ## in `eval_kinR_EPR_modelFit`, `eval_kin_EPR_ODE_model` ## or in `plot_theme_NoY_ticks` based on the same input data, ## as those `Area` vs `time` relations were evaluated using ## the simulated EPR spectra (see also `vignette("datasets")`) # ## Not run: ## Similar to previous data processing, creating both: corrected ## single integral + sigmoid integral for each time within the spectral ## series. Sigmoid integral was evalutated from the single one by ## `cumtrapz()` function from `pracma` package and finally re-scaled. triarylamine.decay.data.integs <- triarylamine.decay.series.data$df %>% dplyr::group_by(time_s) %>% eval_integ_EPR_Spec(correct.integ = TRUE, Blim = c(3425,3550), BpeaKlim = c(3472.417,3505.5), poly.degree = 3) %>% dplyr::group_by(time_s) %>% dplyr::mutate(sigmoid_Integ = pracma::cumtrapz(B_G,single_Integ_correct)[,1]) %>% dplyr::mutate(sigmoid_Integ_correct = abs(min(sigmoid_Integ) - sigmoid_Integ)) ## End(Not run)
## loading the built-in package example ## time series EPR spectra: triarylamine.decay.series.dsc.path <- load_data_example(file = "Triarylamine_radCat_decay_series.DSC") triarylamine.decay.series.asc.path <- load_data_example(file = "Triarylamine_radCat_decay_series.zip") unzip(triarylamine.decay.series.asc.path, exdir = tempdir() ) ## loading the kinetics: triarylamine.decay.series.data <- readEPR_Exp_Specs_kin(name.root = "Triarylamine_radCat_decay_series", dir_ASC = tempdir(), dir_dsc_par = system.file("extdata", package = "eprscope") ) # ## select the first spectrum triarylamine.decay.series.data1st <- triarylamine.decay.series.data$df %>% dplyr::filter(time_s == triarylamine.decay.series.data$time[1]) # ## integrate the first spectrum with default arguments triarylamine.decay.data1st.integ01 <- eval_integ_EPR_Spec(triarylamine.decay.series.data1st) # ## data frame preview head(triarylamine.decay.data1st.integ01) # ## integration (including baseline correction) ## of the 1st spectrum from the series triarylamine.decay.data1st.integ02 <- eval_integ_EPR_Spec(triarylamine.decay.series.data1st, ## limits obtained from interactive spectrum: BpeaKlim = c(3471.5,3512.5), Blim = c(3425,3550), correct.integ = TRUE, poly.degree = 3, sigmoid.integ = TRUE ) # ## data frame preview head(triarylamine.decay.data1st.integ02) # ## plot the single integrated EPR spectrum, ## including baseline correction plot_EPR_Specs(triarylamine.decay.data1st.integ02, x = "B_G", x.unit = "G", Intensity = "single_Integ_correct", lineSpecs.form = "integrated" ) # ## plot, corresponding to double/sigmoid integral, ## which is related to corrected single integral plot_EPR_Specs(triarylamine.decay.data1st.integ02, x = "B_G", x.unit = "G", Intensity = "sigmoid_Integ", lineSpecs.form = "integrated" ) # ## vectorized output of the uncorrected `sigmoid_integral` triarylamine.decay.data1st.integ03 <- eval_integ_EPR_Spec(triarylamine.decay.series.data1st, sigmoid.integ = TRUE, output.vecs = TRUE)[["sigmoid"]] # ## preview of the first 6 values triarylamine.decay.data1st.integ03[1:6] # ## incorporation of vectorized integration into ## data "pipe" ("%>%") `dplyr` processing of EPR spectral ## time series, creating column with `sigmoid` integral ## where its corresponding single integral (intensity) ## has undergone a baseline correction, finally the max. value ## of all sigmoid integrals along with the time is ## summarized in data frame for quantitative kinetic analysis triarylamine.decay.data.integs <- triarylamine.decay.series.data$df %>% dplyr::group_by(time_s) %>% dplyr::filter(dplyr::between(B_G,3425,3550)) %>% dplyr::mutate(sigmoid_Integ = eval_integ_EPR_Spec(dplyr::pick(B_G,dIepr_over_dB), correct.integ = TRUE, BpeaKlim = c(3471.5,3512.5), poly.degree = 3, sigmoid.integ = TRUE, output.vecs = TRUE)$sigmoid ) %>% dplyr::summarize(Area = max(sigmoid_Integ)) ## in such case `Blim` range is not defined by `eval_integ_EPR_Spec`, ## the `Blim = NULL` and `dplyr::between()` must be set !!! # ## preview of the final data frame head(triarylamine.decay.data.integs) # ## preview of the simple plot ggplot2::ggplot(triarylamine.decay.data.integs) + ggplot2::geom_point(ggplot2::aes(x = time_s,y = Area)) # ## this does not correspond to example ## in `eval_kinR_EPR_modelFit`, `eval_kin_EPR_ODE_model` ## or in `plot_theme_NoY_ticks` based on the same input data, ## as those `Area` vs `time` relations were evaluated using ## the simulated EPR spectra (see also `vignette("datasets")`) # ## Not run: ## Similar to previous data processing, creating both: corrected ## single integral + sigmoid integral for each time within the spectral ## series. Sigmoid integral was evalutated from the single one by ## `cumtrapz()` function from `pracma` package and finally re-scaled. triarylamine.decay.data.integs <- triarylamine.decay.series.data$df %>% dplyr::group_by(time_s) %>% eval_integ_EPR_Spec(correct.integ = TRUE, Blim = c(3425,3550), BpeaKlim = c(3472.417,3505.5), poly.degree = 3) %>% dplyr::group_by(time_s) %>% dplyr::mutate(sigmoid_Integ = pracma::cumtrapz(B_G,single_Integ_correct)[,1]) %>% dplyr::mutate(sigmoid_Integ_correct = abs(min(sigmoid_Integ) - sigmoid_Integ)) ## End(Not run)
Calculation of the mean value and its confidence limits (according to Student's t-distribution), corresponding to data frame column or vector, characterizing dispersion of the individual values such as double integrals in quantitative EPR analysis, g-values or linewidths.
eval_interval_cnfd_tVec(data.vec.col, level.cnfd = 0.95, separate = TRUE)
eval_interval_cnfd_tVec(data.vec.col, level.cnfd = 0.95, separate = TRUE)
data.vec.col |
Numeric vector (pointing to column) of interest (within a data frame) to calculate the confidence interval or uncertainty (margin of error). |
level.cnfd |
Numeric (floating) value, corresponding to confidence level (default:
|
separate |
Logical, whether to separate the mean value and the uncertainty (margin of error),
corresponding to non-negative right/left confidence limit of the mean. If |
The confidence interval evaluation suggests that values/observations obey two-tailed Student's t-distribution,
which for number of observations approaches the normal
-distribution.
Evaluation of the confidence interval and/or its limits can be well documented on
-factor series example:
where is the mean value and the
corresponds to the quantile
of the t-distribution having the significance level of
(
,
see the
level.cnfd
argument) and the degrees of freedom . Finally, the
represents
the sample standard deviation, defined by the following relation (regarding the
-value series example):
which is computed by the sd
function. The above-mentioned -quantile is actually calculated
by the
stats::qt
. Alternatively, one could also evaluate confidence
interval by the one sample t.test
for a certain level of confidence, giving a descriptive output
with statistical characteristics.
Named vector of (mean) value
and uncertaity
or
format depending on the
separate
argument, where the uncertainty actually represents non-negative
limit for the mean (one side of the confidence interval not including the mean value).
Miller JN, Miller JC, Miller RD (2018). Statistics and Chemometrics for Analytical Chemistry, 7th edition, Pearson Education. ISBN 978-1-292-18674-0, https://elibrary.pearson.de/book/99.150005/9781292186726.
Hayes A, Moller-Trane R, Jordan D, Northrop P, Lang MN, Zeileis A (2022). distributions3: Probability Distributions as S3 Objects. https://github.com/alexpghayes/distributions3, https://alexpghayes.github.io/distributions3/, see also Vignette: t-confidence interval for a mean, https://alexpghayes.github.io/distributions3/articles/one-sample-t-confidence-interval.html.
National Institute of Standards and Technology (NIST) (2012). “Confidence Limits for the Mean”, https://www.itl.nist.gov/div898/handbook/eda/section3/eda352.htm.
Kaleta J, Tarábek J, Akdag A, Pohl R, Michl J (2012). “The 16 CB11(CH3)n(CD3)12–N• Radicals with 5-Fold Substitution Symmetry: Spin Density Distribution in CB11Me12•”, Inorg. Chem., 51(20), 10819–10824, https://doi.org/10.1021/ic301236s.
Curley JP, Milewski TM (2020). “PSY317L Guidebook - Confidence Intervals”, https://bookdown.org/curleyjp0/psy317l_guides5/confidence-intervals.html.
Goodson DZ (2011). Mathematical Methods for Physical and Analytical Chemistry, 1st edition, John Wiley and Sons, Inc. ISBN 978-0-470-47354-2, https://onlinelibrary.wiley.com/doi/book/10.1002/9781118135204.
Other Evaluations:
eval_DeltaXpp_Spec()
,
eval_FWHMx_Spec()
,
eval_extremeX_Spec()
,
eval_gFactor()
,
eval_gFactor_Spec()
,
eval_kinR_Eyring_GHS()
,
eval_nu_ENDOR()
,
eval_peakPick_Spec()
## double integral/intensity values ## coming from several experiments: di.vec <- c(0.025,0.020,0.031,0.022,0.035) # ## evaluation of the confidence interval ## in different formats: eval_interval_cnfd_tVec(di.vec) # eval_interval_cnfd_tVec(di.vec, level.cnfd = 0.95, separate = FALSE)
## double integral/intensity values ## coming from several experiments: di.vec <- c(0.025,0.020,0.031,0.022,0.035) # ## evaluation of the confidence interval ## in different formats: eval_interval_cnfd_tVec(di.vec) # eval_interval_cnfd_tVec(di.vec, level.cnfd = 0.95, separate = FALSE)
Fitting of the integrals/areas/concentration/...etc. vs time relation (either from experiment
or from integration of the EPR spectral time series) in order to find the kinetic parameters
(like rate constant, as well as (partial) reaction order(s)) of proposed radical reaction.
Reaction model is taken from the
eval_kinR_ODE_model
, while the optimization/fitting
is provided by the differential Levenberg-Marquardt optimization method, nls.lm
.
Because the radical concentration is directly proportional to the EPR spectrum (double)
integral (see the quantify_EPR_Abs
), for a quick evaluation and/or comparison of different
kinetic data, it is possible to obtain the rate constants () by the integrals/areas vs time fit.
Therefore, the unit of
is expressed in terms of
as well as in units of integrals/areas,
e.g.
procedure defined unit
(see p.d.u.),
depending on the order of reaction (see the params.guess
argument).
eval_kinR_EPR_modelFit( data.qt.expr, time.unit = "s", time = "time_s", qvarR = "Area", model.react = "(r=1)R --> [k1] B", elementary.react = TRUE, params.guess = c(qvar0R = 0.001, k1 = 0.001), params.guess.lower = NULL, params.guess.upper = NULL, fit.kin.method = "diff-levenmarq", solve.ode.method = "lsoda", time.frame.model = 2, time.correct = FALSE, path_to_dsc_par = NULL, origin = NULL, ... )
eval_kinR_EPR_modelFit( data.qt.expr, time.unit = "s", time = "time_s", qvarR = "Area", model.react = "(r=1)R --> [k1] B", elementary.react = TRUE, params.guess = c(qvar0R = 0.001, k1 = 0.001), params.guess.lower = NULL, params.guess.upper = NULL, fit.kin.method = "diff-levenmarq", solve.ode.method = "lsoda", time.frame.model = 2, time.correct = FALSE, path_to_dsc_par = NULL, origin = NULL, ... )
data.qt.expr |
A data frame object, containing the concentrations/integral intensities/areas under
the EPR spectra calculated using the experimental data as well as time column. These two essential
columns are described by character strings like those below (see arguments |
|||||||||||||||||
time.unit |
Character string, corresponding to time unit like |
|||||||||||||||||
time |
Character string, pointing to |
|||||||||||||||||
qvarR |
Character string, pointing to |
|||||||||||||||||
model.react |
Character string, denoting a specific radical (
Couple of examples are also given in |
|||||||||||||||||
elementary.react |
Logical, if the model reaction should be considered as the elementary one,
i.e. the stoichiometric coefficients equal to the partial reaction orders. Such reaction proceeds without
identifiable intermediate species forming. Default: |
|||||||||||||||||
params.guess |
Named vector, initial values of |
|||||||||||||||||
params.guess.lower |
Numeric vector of lower bounds on each parameter in |
|||||||||||||||||
params.guess.upper |
Numeric vector of upper bounds on each parameter in |
|||||||||||||||||
fit.kin.method |
Character string, pointing to optimization/fitting method. So far,
the default one ( |
|||||||||||||||||
solve.ode.method |
Character string, setting up the integrator (the |
|||||||||||||||||
time.frame.model |
Numeric value, corresponding to interval time resolution, i.e. the smallest time difference
between two consecutive points. The number of points is thus defined by the
This argument is required to numerically solve the kinetic differential equations by the |
|||||||||||||||||
time.correct |
Logical, if time of recorded series of the EPR spectra needs to be corrected.
Default: |
|||||||||||||||||
path_to_dsc_par |
Character string, path (also provided by the |
|||||||||||||||||
origin |
Character string, corresponding to software which was used to acquire the EPR spectra,
essential to load the parameters by the |
|||||||||||||||||
... |
additional arguments for |
List with the following components is available:
Data frame object with the variables/columns such as time
,
experimental quantitative variable like sigmoid_Integ
(sigmoid integral) or Area
,
concentration c_M
or number of radicals of the relevant EPR spectrum; the corresponding
quantitative variable fitted
vector values as well as residual vector (experiment - kinetic model)
related to the qvarR
argument.
Plot object Quantitative variable vs Time with the experimental data and the corresponding fit.
GGplot2 object (related to simple residual analysis), including
two main plots: Q-Q plot and residuals vs predicted qvarR
from the kinetic model.
Data frame object containing the optimized (best fit) parameter values (Estimates
),
their corresponding standard errors
, t-
as well as p-values
.
Total number of evaluations/iterations before the best fit is found.
Minimum sum of residual squares after N.evals
.
Vector, corresponding to residual sum of squares at each iteration/evaluation.
Mullen KM, Elzhov TV, Spiess A, Bolker B (2023). “minpack.lm.” https://github.com/cran/minpack.lm.
Gavin HP (2024). “The Levenberg-Marquardt algorithm for nonlinear least squares curve-fitting problems.” Department of civil and environmental engineering, Duke University, https://people.duke.edu/~hpgavin/ce281/lm.pdf.
Other Evaluations and Quantification:
eval_integ_EPR_Spec()
,
eval_kinR_ODE_model()
,
quantify_EPR_Abs()
,
quantify_EPR_Norm_const()
## loading example data (incl. `Area` and `time` variables) ## from Xenon: decay of a triarylamine radical cation ## after its generation by electrochemical oxidation triaryl_radCat_path <- load_data_example(file = "Triarylamine_radCat_decay_a.txt") ## corresponding data (double integrated ## EPR spectrum = `Area` vs `time`) triaryl_radCat_data <- readEPR_Exp_Specs(triaryl_radCat_path, header = TRUE, fill = TRUE, select = c(3,7), col.names = c("time_s","Area"), x.unit = "s", x.id = 1, Intensity.id = 2, qValue = 1700, data.structure = "others") %>% na.omit() ## data preview head(triaryl_radCat_data) # ## loading the `.DSC` file triaryl_radCat_dsc_path <- load_data_example(file = "Triarylamine_radCat_decay_a.DSC") # ## fit previous data by second order kinetics, ## where the `model.react` is considered as an elementary ## step (`time.correct` of the CW-sweeps is included (`TRUE`)) triaryl_model_kin_fit_01 <- eval_kinR_EPR_modelFit(data.qt.expr = triaryl_radCat_data, model.react = "(r=2)R --> [k1] B", elementary.react = TRUE, params.guess = c(qvar0R = 0.019, k1 = 0.04 ), time.correct = TRUE, path_to_dsc_par = triaryl_radCat_dsc_path, origin = "xenon") ## data frame preview head(triaryl_model_kin_fit_01$df) # ## plot preview triaryl_model_kin_fit_01$plot # ## coefficients/parameters table preview triaryl_model_kin_fit_01$df.coeffs # ## convergence preview triaryl_model_kin_fit_01$N.converg # ## simple residual analysis plots ## showing the random pattern, which indicates that ## kinetic model provides a decent fit to the data + ## normal quantile (Q-Q) plot, indicating that residuals ## are normally distributed triaryl_model_kin_fit_01$plot.ra # ## take the same experimental data and perform fit ## by first order kinetics where the `model.react` ## is considered as an elementary step ## (`time.correct` of the CW-sweeps is included (`TRUE`)) triaryl_model_kin_fit_02 <- eval_kinR_EPR_modelFit(data.qt.expr = triaryl_radCat_data, model.react = "(r=1)R --> [k1] B", elementary.react = TRUE, params.guess = c(qvar0R = 0.019, k1 = 0.0002 ), time.correct = TRUE, path_to_dsc_par = triaryl_radCat_dsc_path, origin = "xenon") ## plot preview triaryl_model_kin_fit_02$plot # ## coefficients/parameters table preview triaryl_model_kin_fit_02$df.coeffs
## loading example data (incl. `Area` and `time` variables) ## from Xenon: decay of a triarylamine radical cation ## after its generation by electrochemical oxidation triaryl_radCat_path <- load_data_example(file = "Triarylamine_radCat_decay_a.txt") ## corresponding data (double integrated ## EPR spectrum = `Area` vs `time`) triaryl_radCat_data <- readEPR_Exp_Specs(triaryl_radCat_path, header = TRUE, fill = TRUE, select = c(3,7), col.names = c("time_s","Area"), x.unit = "s", x.id = 1, Intensity.id = 2, qValue = 1700, data.structure = "others") %>% na.omit() ## data preview head(triaryl_radCat_data) # ## loading the `.DSC` file triaryl_radCat_dsc_path <- load_data_example(file = "Triarylamine_radCat_decay_a.DSC") # ## fit previous data by second order kinetics, ## where the `model.react` is considered as an elementary ## step (`time.correct` of the CW-sweeps is included (`TRUE`)) triaryl_model_kin_fit_01 <- eval_kinR_EPR_modelFit(data.qt.expr = triaryl_radCat_data, model.react = "(r=2)R --> [k1] B", elementary.react = TRUE, params.guess = c(qvar0R = 0.019, k1 = 0.04 ), time.correct = TRUE, path_to_dsc_par = triaryl_radCat_dsc_path, origin = "xenon") ## data frame preview head(triaryl_model_kin_fit_01$df) # ## plot preview triaryl_model_kin_fit_01$plot # ## coefficients/parameters table preview triaryl_model_kin_fit_01$df.coeffs # ## convergence preview triaryl_model_kin_fit_01$N.converg # ## simple residual analysis plots ## showing the random pattern, which indicates that ## kinetic model provides a decent fit to the data + ## normal quantile (Q-Q) plot, indicating that residuals ## are normally distributed triaryl_model_kin_fit_01$plot.ra # ## take the same experimental data and perform fit ## by first order kinetics where the `model.react` ## is considered as an elementary step ## (`time.correct` of the CW-sweeps is included (`TRUE`)) triaryl_model_kin_fit_02 <- eval_kinR_EPR_modelFit(data.qt.expr = triaryl_radCat_data, model.react = "(r=1)R --> [k1] B", elementary.react = TRUE, params.guess = c(qvar0R = 0.019, k1 = 0.0002 ), time.correct = TRUE, path_to_dsc_par = triaryl_radCat_dsc_path, origin = "xenon") ## plot preview triaryl_model_kin_fit_02$plot # ## coefficients/parameters table preview triaryl_model_kin_fit_02$df.coeffs
Finding the temperature-dependence of a rate constant () related to the elementary radical reaction, using the essential
transition state theory (TST). The activation parameters, such as
and
are obtained by the non-linear fit (see the general
nls
R function) of the Eyring expression
(its non-linear form, see Details
) on the original vs
relation (please,
refer to the
data.kvT
argument). The latter can be acquired by the eval_kinR_EPR_modelFit
from sigmoid-integrals of the EPR spectra recorded at different temperatures. Finally, the activation Gibbs energy
() is calculated, using the optimized
and
,
for each temperature in the series.
eval_kinR_Eyring_GHS( data.kvT, rate.const, rate.const.unit = "s^{-1}", Temp, Temp.unit = "K", transmiss.coeff = 1, fit.method = "default" )
eval_kinR_Eyring_GHS( data.kvT, rate.const, rate.const.unit = "s^{-1}", Temp, Temp.unit = "K", transmiss.coeff = 1, fit.method = "default" )
data.kvT |
Data frame object, which must include two essential columns: rate constant ( |
rate.const |
Character string, pointing to rate constant column header in the actual |
rate.const.unit |
Character string, referring to rate constant unit. This has to be specified using
the |
Temp |
Character string, pointing to temperature column header within the original |
Temp.unit |
Character string, corresponding to temperature unit related to |
transmiss.coeff |
Numeric value, corresponding to probability that the activated complex is transformed into products.
Default: |
fit.method |
Character string, corresponding to method applied to fit the theoretical Eyring relation
(by optimizing the activation parameters, see |
The basic assumption of the Transition State Theory (TST) is the existence of activated state/complex, formed
by the collision of reactant molecules, which does not actually lead to reaction products directly. The activated state (AS)
is formed as highly energized, and therefore as an unstable intermediate, decomposing into products of the reaction.
Accordingly, the reaction rate is given by the rate of its decomposition. Additional important assumption for TST
is the presence of pre-equilibrium (characterized by the constant) of the reactants with
the activated complex (AC). Because the latter is not stable, it dissociates with motion along the corresponding
bond-stretching coordinate. For this reason, the rate constant (
) must be related to the associated vibration
frequency (
). Thus, every time, if the AC is formed, the
of AC-dissociation
actually equals to
. Nevertheless, it is possible that the AC will revert back to reactants and therefore,
only a fraction of ACs will lead to product(s). Such situation is reflected by the transmission coefficient
(see also the argument
transmiss.coeff
), where .
According to statistical thermodynamics, the equilibrium constant can be expressed by the partition function ()
of the reactants and that of the AC. By definition, each
corresponds to ratio of total number of particles
to the number of particles in the ground state. In essence, it is the measure of degree to which the particles
are spread out (partitioned among) over the energy levels. Therefore, taking into account the energies of a harmonic quantum
oscillator vibrating along the reaction coordinate as well as partition functions of the AC and those of the reactants,
the rate constant can be expressed as follows (see e.g. Ptáček P, Šoukal F, Opravil T (2018) in the
References
):
where the and
are the Boltzmann and Planck constants, respectively,
corresponds
to temperature and finally, the
represents the equilibrium constant including the partition functions
of reactants and that of the AC. In order to evaluate the AC partition function, its structure must be known.
However, often, due to the lack of structural information, it is difficult (if not impossible) to evaluate
the corresponding
. Therefore, considering the equilibrium between the reactants and the AC,
one may express the
in terms of Gibbs activation energy (
),
because
and thus the Eyring equation reads:
where is the universal gas constant and the upper index
denotes the standard molar state (see IUPAC (2019) in the
References
). Previous formula is applied
as a model to fit the experimental (see the argument
data.kvT
) relation, where both
the and the
(in the graphical output, are also denoted as
and
, respectively) are optimized using the
fit.method
(by the nls
function). In the first approach, both latter are considered as temperature independent
within the selected temperature range. Often, the Eyring equation is not applied in the original form,
however in the linearized one. Nevertheless, the latter is not recommended as a model for fitting the experimental
(see also Lente G, Fábián I, Poë AJ (2005) in the
References
). The reason inherits in the misinterpretation
of the extrapolation to (or
) by which the
is obtained and thus it is unreliable. Accordingly, the original exponential Eyring form is recommended
as a model to fit the experimental
.
The
-unit depends on the molecularity of the reaction,
please also refer to the
rate.const.unit
argument. Therefore, the left hand site of the Eyring equation above
must be multiplied by the standard molar concentration :
where the goes through stoichiometric coefficients (including the negative sign for reactants)
of the AC formation reaction (therefore the index
is used), i.e. for the bi-molecular reaction,
the sum results in
-1
, however for the mono-molecular one, the sum results in 0
.
While the transition state theory (TST) is a helpful tool to get information about the mechanism of an elementary reaction, it has some limitations, particularly for radical reactions. Couple of them are listed below.
One should be very careful if applied to elementary steps in a multistep reaction kinetics (like
consecutive reactions, example shown in eval_kinR_ODE_model
). If the intermediate (e.g. in the consecutive
reaction mechanism) possesses a short life-time, the TST probably fails.
For very fast reactions the assumed equilibrium between the reactants and the AC won't be reached.
Therefore, the spin trapping reactions, which s may actually fall into the order
of
(or oven higher, see Kemp TJ (1999) in the
References
)
should be taken with extreme caution in terms of TST.
Formation of AC in TST is based on classical mechanics, that is molecules/atoms will only collide,
having enough energy (to form the AC), otherwise reaction does not occur. Whereas, taking into account the quantum
mechanical principle, molecules/atoms with any finite energy may (with a certain probability) tunnel across
the energy barrier. Such effect will be less probable for high energy barriers, however e.g. for radical-radical
recombination, where the barriers are typically very low, the tunneling probability is high and TST may fail.
In addition, such reactions proceed relatively fast and therefore the TST (Eyring fit) can also strongly bias
the activation parameters. This type of reactions may also exhibit negative vs
dependence
(see Wardlaw DM and Marcus RA (1986) in the
References
).
As a result of the Eyring-relation fit, list with the following components is available:
Data frame, including the original data.kvT
+ the column of ,
with the name of
DeltaG_active_kJ_per_mol
, as well as fitted
/predicted values of the rate constant
and finally, the corresponding residuals.
Data frame including temperature (in the same region like in the original data.kvT
,
however with the resolution of 1024 points) and the corresponding .fitted
, according to
Eyring model.
Static ggplot2-based object/list, showing graphical representation of the non-linear fit, together with the Eyring equation.
GGplot2 object (related to simple residual analysis), including
two main plots: Q-Q plot and residuals vs predicted/fitted vs
from the Eyring fit.
Data frame object, containing the optimized (best fit) parameter values (Estimates
),
their corresponding standard errors
, t-
as well as p-values
for both
and
.
List, containing fitting/optimization characteristics like number of evaluations/iterations
(N.evals
); character denoting the (un)successful convergence (message
)
and finally, standard deviation of the residuals (residual.sd
), which is defined as:
where is the number of observations and
is the number of optimized parameters.
Therefore, the smaller the
residual.sd
, the better the Eyring-relation fit.
Engel T, Reid P (2013). Physical Chemistry, 3rd Edition, Pearson Education, ISBN 978-0-321-81200-1, https://elibrary.pearson.de/book/99.150005/9781292035444.
Ptáček P, Šoukal F, Opravil T (2018). "Introduction to the Transition State Theory", InTech., https://doi.org/10.5772/intechopen.78705.
International Union of Pure and Applied Chemistry (IUPAC) (2019). “Transition State Theory”, https://goldbook.iupac.org/terms/view/T06470.
Anslyn EV, Dougherty DA (2006). Modern Physical Organic Chemistry, University Science Books, ISBN 978-1-891-38931-3, https://uscibooks.aip.org/books/modern-physical-organic-chemistry/.
Lente G, Fábián I, Poë AJ (2005). "A common Misconception about the Eyring Equation", New J. Chem., 29(6), 759–760, https://doi.org/10.1039/B501687H.
Kemp TJ (1999), "Kinetic Aspects of Spin Trapping", Progress in Reaction Kinetics, 24(4), 287-358, https://doi.org/10.3184/007967499103165102.
Wardlaw DM and Marcus RA (1986), "Unimolecular reaction rate theory for transition states of any looseness. 3. Application to methyl radical recombination", J. Phys. Chem., 90(21), 5383-5393, https://doi.org/10.1021/j100412a098.
Other Evaluations:
eval_DeltaXpp_Spec()
,
eval_FWHMx_Spec()
,
eval_extremeX_Spec()
,
eval_gFactor()
,
eval_gFactor_Spec()
,
eval_interval_cnfd_tVec()
,
eval_nu_ENDOR()
,
eval_peakPick_Spec()
## demonstration on raw data, presented ## in https://www.rsc.org/suppdata/nj/b5/b501687h/b501687h.pdf ## considering reaction H+ + (S2O6)2- <==> SO2 + (HSO4)- kinet.test.data <- data.frame(k_per_M_per_s = c(9.54e-7,1.91e-6,3.76e-6, 7.33e-6,1.38e-5,2.56e-5, 4.71e-5,8.43e-5,1.47e-4), T_oC = c(50,55,60,65,70, 75,80,85,90) ) activ.kinet.test.data <- eval_kinR_Eyring_GHS( data.kvT = kinet.test.data, rate.const = "k_per_M_per_s", rate.const.unit = "M^{-1}~s^{-1}", Temp = "T_oC", Temp.unit = "oC" ) # ## preview of the original data ## + ∆G (activated) + fitted + residuals activ.kinet.test.data$df # ## preview of the non-linear fit plot activ.kinet.test.data$plot # ## preview of the optimized (activated) ## ∆S and ∆H parameters activ.kinet.test.data$df.coeffs.HS # ## compare values with those presented in ## https://www.rsc.org/suppdata/nj/b5/b501687h/b501687h.pdf ## ∆S = (7.2 +- 1.1) kJ/mol*K & ∆H = (118.80 +- 0.41) kJ/mol # ## preview of the new `.fitted` data frame activ.kinet.test.data$df.fit # ## preview of the convergence measures activ.kinet.test.data$converg
## demonstration on raw data, presented ## in https://www.rsc.org/suppdata/nj/b5/b501687h/b501687h.pdf ## considering reaction H+ + (S2O6)2- <==> SO2 + (HSO4)- kinet.test.data <- data.frame(k_per_M_per_s = c(9.54e-7,1.91e-6,3.76e-6, 7.33e-6,1.38e-5,2.56e-5, 4.71e-5,8.43e-5,1.47e-4), T_oC = c(50,55,60,65,70, 75,80,85,90) ) activ.kinet.test.data <- eval_kinR_Eyring_GHS( data.kvT = kinet.test.data, rate.const = "k_per_M_per_s", rate.const.unit = "M^{-1}~s^{-1}", Temp = "T_oC", Temp.unit = "oC" ) # ## preview of the original data ## + ∆G (activated) + fitted + residuals activ.kinet.test.data$df # ## preview of the non-linear fit plot activ.kinet.test.data$plot # ## preview of the optimized (activated) ## ∆S and ∆H parameters activ.kinet.test.data$df.coeffs.HS # ## compare values with those presented in ## https://www.rsc.org/suppdata/nj/b5/b501687h/b501687h.pdf ## ∆S = (7.2 +- 1.1) kJ/mol*K & ∆H = (118.80 +- 0.41) kJ/mol # ## preview of the new `.fitted` data frame activ.kinet.test.data$df.fit # ## preview of the convergence measures activ.kinet.test.data$converg
Theoretical quantitative kinetic profiles (such as concentration/amount/integral intensity) as well as comparison with the experimental data for various predefined model reactions involving radical(s) (labeled as "R"). Profiles are evaluated by the numeric solution of rate equations by the Ordinary Differential Equations (ODE from desolve R package). This function is inspired by the R-bloggers article.
eval_kinR_ODE_model( model.react = "(r=1)R --> [k1] B", model.expr.diff = FALSE, elementary.react = TRUE, kin.params = c(k1 = 0.001, qvar0R = 0.02), time.unit = "s", time.interval.model = c(0, 1800), time.frame.model = 2, solve.ode.method = "lsoda", data.qt.expr = NULL, time.expr = NULL, qvar.expr = NULL, ... )
eval_kinR_ODE_model( model.react = "(r=1)R --> [k1] B", model.expr.diff = FALSE, elementary.react = TRUE, kin.params = c(k1 = 0.001, qvar0R = 0.02), time.unit = "s", time.interval.model = c(0, 1800), time.frame.model = 2, solve.ode.method = "lsoda", data.qt.expr = NULL, time.expr = NULL, qvar.expr = NULL, ... )
model.react |
Character string, denoting a specific radical (
Couple of examples are also given in |
|||||||||||||||||
model.expr.diff |
Logical, difference between the integral intensities/areas under the EPR spectra calculated
using the experimental data and those generated by the model. By default the argument
is FALSE and it is ONLY ACTIVATED ( |
|||||||||||||||||
elementary.react |
Logical, if the model reaction should be considered as the elementary one,
i.e. the stoichiometric coefficients equal to the partial reaction orders. Such reaction proceeds without
identifiable intermediate species forming. Default: |
|||||||||||||||||
kin.params |
Named numeric vector, containing rate constants as well as initial radical
or other reactant/product concentration/integral intensities/areas...etc. Therefore, a general
The |
|||||||||||||||||
time.unit |
Character string, corresponding to time unit like |
|||||||||||||||||
time.interval.model |
Numeric vector, including two values: starting and final time/termination
of the model reaction (e.g. |
|||||||||||||||||
time.frame.model |
Numeric value, corresponding to interval time resolution, i.e. the smallest time difference
between two consecutive points. The number of points is thus defined by the
This argument is required to numerically solve the kinetic differential equations by the |
|||||||||||||||||
solve.ode.method |
Character string, setting up the integrator (the |
|||||||||||||||||
data.qt.expr |
A data frame object, containing the concentrations/integral intensities/areas under
the EPR spectra calculated using the experimental data as well as time column. These two essential
column headers are described by the character strings like those below |
|||||||||||||||||
time.expr |
Character string, pointing to |
|||||||||||||||||
qvar.expr |
Character string, pointing to |
|||||||||||||||||
... |
additional arguments passed to the ODE (see also |
According to IUPAC (2019), see als the References
, the rate of a chemical reaction
with the radicals () involved (refer to the example in
model.react
argument)
is expressed via the time change of extent of the reaction ():
where are the stoichiometric coefficients. At constant volume (
) conditions
(or if volume changes are negligible) the amount (
in mole) of reactant/product
can be replaced by its corresponding concentration (
). Such reaction rate
(expressed in moles per unit volume and per second) is function of temperature (
),
pressure (
) as well as that of concentration of reactants/products.
For the reaction example shown above it applies (for radical
):
This is called rate law, where is the rate constant and its pressure dependence is usually
small and therefore can be ignored, in the first approach. Coefficients
and
,
in general, correspond to fitting parameters, coming from experimental relation of the reaction
rate and the concentration of reactants/products. These coefficients are called partial reaction orders
or
PROs
and their sum represents total order of the reaction. If the kinetic equation,
for the reaction, corresponds to its stoichiometry, the reaction is described as the elementary
one. In EPR Spectroscopy the number of radicals is directly proportional to (double) integral
of the radical EPR spectrum (see also quantify_EPR_Abs
). Therefore, for a quick evaluation
or and/or comparison of different kinetic data, one can also obtain the rate constant
from the area/integral vs time fit onto the experimental EPR spectral time series outputs
(see also the eval_kinR_EPR_modelFit
).
Accordingly, the "R" concentration (or number of radicals/V) can be replaced by the corresponding integral.
For such a purpose a more general quantitative variable () is defined.
However, in such case the unit of
must be expressed accordingly (see the
kin.params
argument).
Quantitative kinetic profiles (such as that
or
described above) are not evaluated
by common integration of the kinetic equations/rate laws, however by numeric solution of the Ordinary
Differential Equations, ODE in
{desolve}
R package.
Therefore, higher number of models might be available than for integrated
differential equations, because for complex mechanisms it's quite often highly demanding to obtain
the analytical solution by common integration. Several kinetic models for radical reactions in EPR spectroscopy
are predefined and summarized below (see also the model.react
function argument).
model.react | Short Description |
"(r=1)R --> [k1] B" |
Basic forward reaction,
e.g. irrev. dimerization (if (r=2) ). |
"(a=1)A --> [k1] (r=1)R" |
Basic forward radical formation |
"(a=1)A <==> [k1] [k4] (r=1)R <==> [k2] [k3] (b=1)B" |
Consecutive reactions,
e.g. considering comproportionation (for (a=2) and (r=2) ) + follow-up reversible
dimerization ((b=1) ). |
"(r=1)R <==> [k1] [k2] (b=1)B" |
Basic reversible radical quenching,
e.g. rev. dimerization for (r=2) and (b=1) . |
"(a=1)A <==> [k1] [k2] (r=1)R" |
Basic reversible radical formation,
e.g. from rev. comproportionation of conjugated thiophene oligomers
( , for (a=2) and (r=2) ). |
"(a=1)A + (b=1)B --> [k1] (r=1)R" |
Radical formation by chemical reaction like oxidation,
reduction or spin trapping (if A refers to transient radical, which is not visible within
the common EPR time scale). |
"(a=1)A + (r=1)R --> [k1] B" |
General radical quenching by chemical reaction. |
If the function is not used for fitting of the experimental and processed data,
the result is list
consisting of:
Data frame, containing time
column and qvar
, quantitative variable,
columns corresponding to quantities of different relevant species
denoted as "R"
, "A"
, "B"
+ if data.qt.expr
is NOT NULL
additional experimental quantitative variable is present.
Plot object, containing time
as -axis and
qvar
(see df
above) as -axis + if
data.qt.expr
is NOT NULL the experimental
quantitative variable is presented as well.
Applying function for the fitting procedure
requires model.expr.diff = TRUE
and therefore the result is represented by the difference between
the integral intensities/areas, calculated using the experimental data
and those generated by the model.
International Union of Pure and Applied Chemistry (IUPAC) (2019). “Rate of Reaction”, https://goldbook.iupac.org/terms/view/R05156.
Quisenberry KT, Tellinghuisen J (2006). “Textbook Deficiencies: Ambiguities in Chemical Kinetics Rates and Rate Constants.” J. Chem. Educ., 83(3), 510, https://doi.org/10.1021/ed083p510.
Levine IN (2009). Physical Chemistry, 6th edition. McGraw-Hill, ISBN 978-0-072-53862-5, https://books.google.cz/books/about/Physical_Chemistry.html?id=L5juAAAAMAAJ&redir_esc=y.
rdabbler (2013). “Learning R: Parameter Fitting for Models Involving Differential Equations”, https://www.r-bloggers.com/2013/06/learning-r-parameter-fitting-for-models-involving-differential-equations/.
Other Evaluations and Quantification:
eval_integ_EPR_Spec()
,
eval_kinR_EPR_modelFit()
,
quantify_EPR_Abs()
,
quantify_EPR_Norm_const()
## irreversible dimerization quantitative kinetic profile, ## table (df) with first 10 observations/rows and application ## of the "euler" integrator (to solve ODE) method ## kin.test.01 <- eval_kinR_ODE_model(model.react = "(r=2)R --> [k1] B", kin.params = c(k1 = 0.012, qvar0R = 0.08), solve.ode.method = "euler") ## preview head(kin.test.01$df,n = 10) # ## consecutive reactions and the corresponding plot ## (`model.react` character string without spaces) kin.test.02 <- eval_kinR_ODE_model( model.react = "(a=2)A<==>[k1][k4](r=2)R<==>[k2][k3](b=1)B", kin.params = c(k1 = 0.1, k2 = 0.1, k3 = 2e-4, k4 = 2e-5, qvar0A = 0.02, qvar0R = 0.002, qvar0B = 0) ) ## plot preview kin.test.02$plot # ## data frame/table preview head(kin.test.02$df) # ## loading example data (incl. `Area` and `time` variables) ## from Xenon software: decay of a triarylamine radical cation ## after its generation by electrochemical oxidation triaryl_radCat_path <- load_data_example(file = "Triarylamine_radCat_decay_a.txt") ## corresponding data (double integrated ## EPR spectrum = `Area` vs `time`) triaryl_radCat_data <- readEPR_Exp_Specs(triaryl_radCat_path, header = TRUE, fill = TRUE, select = c(3,7), col.names = c("time_s","Area"), x.unit = "s", x.id = 1, Intensity.id = 2, qValue = 1700, data.structure = "others") %>% na.omit() ## data preview head(triaryl_radCat_data) # ## comparison of the kinetic model with the experimental ## data `triaryl_radCat_data`, kinetic parameters were estimated ## to be as close as possible to the latter. compar_model_expr_data_01 <- eval_kinR_ODE_model(model.react = "(r=2)R --> [k1] B", kin.params = c(qvar0R = 0.019, k1 = 0.04), time.interval.model = c(0,1500), data.qt.expr = triaryl_radCat_data, qvar.expr = "Area", time.expr = "time_s") ## plot preview compar_model_expr_data_01$plot # ## previous kinetic model with partial reaction ## order ("alpha") corresponding to "R" (radical species). ## In such case REACTION is NOT CONSIDERED ## as an ELEMENTARY one ! compar_model_expr_data_02 <- eval_kinR_ODE_model(model.react = "(r=2)R --> [k1] B", elementary.react = FALSE, kin.params = c(qvar0R = 0.019, k1 = 0.04, alpha = 1.9 ), time.interval.model = c(0,1500), data.qt.expr = triaryl_radCat_data, qvar.expr = "Area", time.expr = "time_s") ## plot preview compar_model_expr_data_02$plot
## irreversible dimerization quantitative kinetic profile, ## table (df) with first 10 observations/rows and application ## of the "euler" integrator (to solve ODE) method ## kin.test.01 <- eval_kinR_ODE_model(model.react = "(r=2)R --> [k1] B", kin.params = c(k1 = 0.012, qvar0R = 0.08), solve.ode.method = "euler") ## preview head(kin.test.01$df,n = 10) # ## consecutive reactions and the corresponding plot ## (`model.react` character string without spaces) kin.test.02 <- eval_kinR_ODE_model( model.react = "(a=2)A<==>[k1][k4](r=2)R<==>[k2][k3](b=1)B", kin.params = c(k1 = 0.1, k2 = 0.1, k3 = 2e-4, k4 = 2e-5, qvar0A = 0.02, qvar0R = 0.002, qvar0B = 0) ) ## plot preview kin.test.02$plot # ## data frame/table preview head(kin.test.02$df) # ## loading example data (incl. `Area` and `time` variables) ## from Xenon software: decay of a triarylamine radical cation ## after its generation by electrochemical oxidation triaryl_radCat_path <- load_data_example(file = "Triarylamine_radCat_decay_a.txt") ## corresponding data (double integrated ## EPR spectrum = `Area` vs `time`) triaryl_radCat_data <- readEPR_Exp_Specs(triaryl_radCat_path, header = TRUE, fill = TRUE, select = c(3,7), col.names = c("time_s","Area"), x.unit = "s", x.id = 1, Intensity.id = 2, qValue = 1700, data.structure = "others") %>% na.omit() ## data preview head(triaryl_radCat_data) # ## comparison of the kinetic model with the experimental ## data `triaryl_radCat_data`, kinetic parameters were estimated ## to be as close as possible to the latter. compar_model_expr_data_01 <- eval_kinR_ODE_model(model.react = "(r=2)R --> [k1] B", kin.params = c(qvar0R = 0.019, k1 = 0.04), time.interval.model = c(0,1500), data.qt.expr = triaryl_radCat_data, qvar.expr = "Area", time.expr = "time_s") ## plot preview compar_model_expr_data_01$plot # ## previous kinetic model with partial reaction ## order ("alpha") corresponding to "R" (radical species). ## In such case REACTION is NOT CONSIDERED ## as an ELEMENTARY one ! compar_model_expr_data_02 <- eval_kinR_ODE_model(model.react = "(r=2)R --> [k1] B", elementary.react = FALSE, kin.params = c(qvar0R = 0.019, k1 = 0.04, alpha = 1.9 ), time.interval.model = c(0,1500), data.qt.expr = triaryl_radCat_data, qvar.expr = "Area", time.expr = "time_s") ## plot preview compar_model_expr_data_02$plot
Larmor/ENDOR frequency calculations for the analysis in EPR/Electron-Nuclear Double Resonance (ENDOR). Function is inspired by the similar Larmor Frequency Calculator, available online.
eval_nu_ENDOR(nucle_us_i, B.unit = "G", B.val)
eval_nu_ENDOR(nucle_us_i, B.unit = "G", B.val)
nucle_us_i |
(Vector) character string in the form like |
B.unit |
Character string, denoting the magnetic flux density B unit. Default:
|
B.val |
Numeric, magnetic flux density |
The frequency in MHz is calculated according to relation
where is the Planck's constant,
is the nuclear magneton
available from constants package (
constants::syms$mun
),
is the nuclear
-factor of the specific nucleus (reported in the package
isotopes_ds
data frame as g_Nuclear
) and finally, the denotes the magnetic flux
density at which the ENDOR spectra are recorded (see also
B.val
in arguments). The coefficient
is referred to the resulting frequency in MHz. The negative sign "
" mirrors the convention to describe the direction
of magnetic spin moments precession either counter-clockwise (
, if
)
or clockwise (
, if
, Levitt MH (2013)).
Numeric value or vector of nuclear Larmor/ENDOR frequencies in MHz for selected
nuclei at =
B.val
.
Levitt MH (2013). Spin Dynamics: Basics of Nuclear Magnetic Resonance. Wiley, ISBN 978-1-118-68184-8, https://books.google.cz/books?id=bysFAa4MPQcC.
Other Evaluations:
eval_DeltaXpp_Spec()
,
eval_FWHMx_Spec()
,
eval_extremeX_Spec()
,
eval_gFactor()
,
eval_gFactor_Spec()
,
eval_interval_cnfd_tVec()
,
eval_kinR_Eyring_GHS()
,
eval_peakPick_Spec()
## Larmor/ENDOR frequency for one selected nucleus ## only, e.g. "14N" at 3486 G eval_nu_ENDOR(nucle_us_i = "14N", B.val = 3486) # ## Larmor/ENDOR frequency for selected nuclei ## e.g. "1H" and "31P" at saturation ## field of B = 349.9 mT eval_nu_ENDOR(nucle_us_i = c("1H","31P"), B.unit = "mT", B.val = 349.9)
## Larmor/ENDOR frequency for one selected nucleus ## only, e.g. "14N" at 3486 G eval_nu_ENDOR(nucle_us_i = "14N", B.val = 3486) # ## Larmor/ENDOR frequency for selected nuclei ## e.g. "1H" and "31P" at saturation ## field of B = 349.9 mT eval_nu_ENDOR(nucle_us_i = c("1H","31P"), B.unit = "mT", B.val = 349.9)
The peak picking expands the functionality of the basic eval_extremeX_Spec
to quickly
find extremes within several regions of the entire EPR/ENDOR Spectrum (without a need for an
interactive plotting). The function is based on the findpeaks
to find
the local intensity maxima and/or minima by fitting the experimental EPR spectral parts/points using the shortened
vertex form of a parabola.
The parabola vertices actually represent the maxima or minima. Visualization of the peak picking is provided
by the plot_EPR_Specs
together with the geom_text
function (see geom_label
).
eval_peakPick_Spec( data.spectr, x = "B_mT", x.unit = "mT", xlim = NULL, Intensity = "dIepr_over_dB", Ilim = NULL, lineSpecs.form = "derivative", only.peak.pn = NULL, min.peak.height = NULL, min.peak.dist = NULL, min.peak.width = 1, max.peak.width = Inf, double.sided = TRUE, line.color = "darkviolet", peak.color = "steelblue", peak.text.angle = 90, peak.text.size = 3, peak.point.size = 2, peak.point.shape = 16, peak.text.overlap = FALSE, ... )
eval_peakPick_Spec( data.spectr, x = "B_mT", x.unit = "mT", xlim = NULL, Intensity = "dIepr_over_dB", Ilim = NULL, lineSpecs.form = "derivative", only.peak.pn = NULL, min.peak.height = NULL, min.peak.dist = NULL, min.peak.width = 1, max.peak.width = Inf, double.sided = TRUE, line.color = "darkviolet", peak.color = "steelblue", peak.text.angle = 90, peak.text.size = 3, peak.point.size = 2, peak.point.shape = 16, peak.text.overlap = FALSE, ... )
data.spectr |
Data frame object/table, containing |
x |
Character string, pointing to |
x.unit |
Character string, pointing to unit of |
xlim |
Numeric vector, referring to lower and upper limit of the selected |
Intensity |
Character string, pointing to |
Ilim |
Numeric vector, corresponding to limits of the selected |
lineSpecs.form |
Character string, describing either |
only.peak.pn |
Character string, setting up the selection of positive ( |
min.peak.height |
Numeric, setting the |
min.peak.dist |
Numeric (integer > 0), pointing to minimum distance (in points) between the expected peaks,
which are constructed by parabola fits over the points. For such purpose, the shortened (vertex)
parabola (the 2nd polynomial) expression like
where such formula corresponds to |
min.peak.width |
Numeric (integer > 0), setting the minimum peak-width (points) to fit the vertex
parabola expression (see also the |
max.peak.width |
Numeric (integer > 0), pointing to maximum peak-width (points) to find the peaks.
Default: |
double.sided |
Logical. Should be the peaks found for both intensity sites
( |
line.color |
Character string, line color to plot the EPR/ENDOR spectrum.
All |
peak.color |
Character string, "point" color to visualize/emphasize the peaks.
Similarly, as for the |
peak.text.angle |
Numeric, setting the angle (in deg) of the peak value (projection onto
the |
peak.text.size |
Numeric, pointing to peak annotation text size
(in mm, see the |
peak.point.size |
Numeric, size (in mm) of the peak "point" in graphical representation of the peak picking.
Please consult the |
peak.point.shape |
Numeric (integer between 0 and 24), controlling the "point" symbol like square,
triangle, circle, asterisk...etc,
refer to e.g. |
peak.text.overlap |
Logical, if |
... |
additional arguments specified, please refer to the |
List, consisting of following components, will be returned:
Data frame, corresponding to the original data.spectr
, with all peaks (Intensity
vs x
) found by findpeaks
algorithm and the arguments defined above.
Graphical representation of found peaks in the EPR/ENDOR spectrum.
Other Evaluations:
eval_DeltaXpp_Spec()
,
eval_FWHMx_Spec()
,
eval_extremeX_Spec()
,
eval_gFactor()
,
eval_gFactor_Spec()
,
eval_interval_cnfd_tVec()
,
eval_kinR_Eyring_GHS()
,
eval_nu_ENDOR()
## loading TMPD built-in example file: tmpd.data.file.path <- load_data_example(file = "TMPD_specelchem_accu_b.asc") ## reading data: tmpd.data.file <- readEPR_Exp_Specs(path_to_ASC = tmpd.data.file.path, col.names = c("B_G", "dIepr_over_dB"), qValue = 3500, norm.vec.add = 20, origin = "winepr") # ## peak picking of only positive (Intensitity > 0) ## peaks in the derivative EPR spectrum of TMPD: tmpd.peak.pick.01 <- eval_peakPick_Spec(data.spectr = tmpd.data.file, only.peak.pn = "p", min.peak.dist = 1) # ## peak picking visualization: tmpd.peak.pick.01$plot # ## found peaks data frame preview tmpd.peak.pick.01$df # ## peak picking in 'G' (not in default 'mT') ## of both positive as well as negative intensities ## with the intensity threshold 15% of the maximum, ## peaks annotation text angle 60 deg: tmpd.peak.pick.02 <- eval_peakPick_Spec( data.spectr = tmpd.data.file, x = "B_G", x.unit = "G", min.peak.height = 0.15 * max(tmpd.data.file$dIepr_over_dB), peak.text.angle = 60 ) # ## graph/EPR spectrum peaks preview: tmpd.peak.pick.02$plot
## loading TMPD built-in example file: tmpd.data.file.path <- load_data_example(file = "TMPD_specelchem_accu_b.asc") ## reading data: tmpd.data.file <- readEPR_Exp_Specs(path_to_ASC = tmpd.data.file.path, col.names = c("B_G", "dIepr_over_dB"), qValue = 3500, norm.vec.add = 20, origin = "winepr") # ## peak picking of only positive (Intensitity > 0) ## peaks in the derivative EPR spectrum of TMPD: tmpd.peak.pick.01 <- eval_peakPick_Spec(data.spectr = tmpd.data.file, only.peak.pn = "p", min.peak.dist = 1) # ## peak picking visualization: tmpd.peak.pick.01$plot # ## found peaks data frame preview tmpd.peak.pick.01$df # ## peak picking in 'G' (not in default 'mT') ## of both positive as well as negative intensities ## with the intensity threshold 15% of the maximum, ## peaks annotation text angle 60 deg: tmpd.peak.pick.02 <- eval_peakPick_Spec( data.spectr = tmpd.data.file, x = "B_G", x.unit = "G", min.peak.height = 0.15 * max(tmpd.data.file$dIepr_over_dB), peak.text.angle = 60 ) # ## graph/EPR spectrum peaks preview: tmpd.peak.pick.02$plot
EPR spectra often display hyperfine structure, where the spectral lines split into several other ones,
as a consequence of the electron-nuclear interaction with nuclei close to the paramagnetic center.
Sometimes, such splitting can be complicated and requires simulations, i.e. computational "synthesis"
of spectral structure based on quantum chemistry as well as on mathematical description of spectral lineshapes
(see also References
). The actual function helps to analyze the hyperfine structure (HFS)
of the isotropic EPR spectra by simulations. For such purpose, properties like nuclear -value,
spin quantum number as well as natural abundance of the isotopes, related to interacting nuclei,
must be known and are collected in the
isotopes_ds
. EPR spectra can be simulated
for the derivative as well as for the integrated line forms (see the argument lineSpec.form
).
eval_sim_EPR_iso( g.iso = 2.00232, instrum.params = c(Bcf = 3500, Bsw = 200, Npoints = 2048, mwGHz = 9.8), path_to_dsc_par = NULL, origin = NULL, B.unit = "G", nuclear.system = NULL, natur.abund = TRUE, lineSpecs.form = "derivative", lineGL.DeltaB = list(1, NULL), lineG.content = 1, Intensity.sim = "dIeprSim_over_dB", plot.sim.interact = FALSE )
eval_sim_EPR_iso( g.iso = 2.00232, instrum.params = c(Bcf = 3500, Bsw = 200, Npoints = 2048, mwGHz = 9.8), path_to_dsc_par = NULL, origin = NULL, B.unit = "G", nuclear.system = NULL, natur.abund = TRUE, lineSpecs.form = "derivative", lineGL.DeltaB = list(1, NULL), lineG.content = 1, Intensity.sim = "dIeprSim_over_dB", plot.sim.interact = FALSE )
g.iso |
Numeric value, guess of the isotropic |
|||||||||
instrum.params |
Named numeric vector, containing instrumental parameters required for the simulation =>
Default values are chosen to cover the EPR spectra of common organic radicals.
If |
|||||||||
path_to_dsc_par |
Character string, path (can be also acquired by the |
|||||||||
origin |
Character string, corresponding to software which was used to obtain the EPR spectra
on spectrometers, because the files are slightly different, whether they
were recorded by the "WinEpr" ( |
|||||||||
B.unit |
Character string, pointing to unit of magnetic flux density which is to be presented
on |
|||||||||
nuclear.system |
List, containing the information about groups of equivalent nuclei
interacting with the unpaired electron like |
|||||||||
natur.abund |
Logical, whether the natural abundance of the interacting nuclei
is taken into the calculation of intensity pattern of the simulated EPR spectrum.
Default: |
|||||||||
lineSpecs.form |
Character string, describing either |
|||||||||
lineGL.DeltaB |
List of two values referred to as Gaussian (G) and Lorentzian (L)
spectral line-forms, respectively. For the "pure" Gaussian only the first value is numeric
and the second one is |
|||||||||
lineG.content |
Numeric value between |
|||||||||
Intensity.sim |
Character string, pointing to column of simulated EPR intensity within the related output
data frame. Default: |
|||||||||
plot.sim.interact |
Logical, whether to display the simulated spectrum by interactive |
Theoretical predictions or computations of a spectrum (and its comparison with the experiment) represent
an important step in the analysis of EPR spectra. However, such step requires an iterative process with modelling
the above-described electron-nuclear system followed by a numerical simulations of EPR spectra
to match the experimental ones (see also eval_sim_EPR_isoFit
). Commonly, quantum chemical calculations
(usually DFT, see also vignette("functionality")
are involved in this process.
EPR simulations in the isotropic regime assume that the molecules tumble/move extremely fast causing a total averaging
of any anisotropic properties out. An EPR spectrum corresponding to the latter consists of a series of symmetric
lines with equal widths. In such case the spectrum is characterized by the isotropic HF coupling/splitting
constants (see also the
nuclear.system
argument) as well as
by the above-mentioned linewidth. Many organic radicals exhibit such EPR spectra at room temperature
and in solutions of low viscosities (Gerson F, Huber W (2003), see References
).
In the first step the -region (magnetic flux density) and the resolution must be defined
by the
instrum.params
argument or can be directly acquired from the parameter file using
the path_to_dsc_par
argument. Position of the spectrum (within the desired -region)
as well as those of HFS-lines are evaluated by the resonance condition (see also the
eval_gFactor
)
and by the Breit-Rabi analytical expression for energy levels of the interacting nuclei.
The related s are computed by the fixed-point iterations,
because the corresponding
-value for each of the HFS-lines is not known (Weil JA (1971)
and Stoll A, Schweiger A (2006)). The shape of spectral lines are calculated by the analytical formula
of linear combination of the Gaussian and the Lorentzian line-shapes (also referred to as pseudo-Voigt,
Weil JA, Bolton JR (2007) and Stoll S (2024)). The linear coefficients
are defined by the
lineG.content
argument, actually, corresponding to Gaussian line content (the Lorentzian one
is computed as 1-lineG.content
, accordingly). The linewidth, from that linear combination,
is defined individually for the Gaussian and the Lorentzian (please, refer to the lineGL.DeltaB
argument).
The multiplicities (relative intensity ratios) are computed by the binomial/multinomial coefficients
taking into account the spin quantum numbers of the interacting nuclei, in each of the equivalent groups,
as well as their natural abundance (if natur.abund = TRUE
).
If plot.sim.interact = TRUE
, function returns an interactive plot object with the simulated EPR spectrum.
Otherwise (if plot.sim.interact = FALSE
), the output is represented by the list
with the following
elements:
ggplot2
static object showing the simulated EPR spectrum.
Data frame/table object related to the simulated spectrum.
Weil JA, Bolton JR (2007). Electron paramagnetic resonance: elementary theory and practical applications, 2nd edition. John Wiley and Sons. ISBN 978-0-471-75496-1, https://onlinelibrary.wiley.com/doi/book/10.1002/0470084987.
Weil JA (1971). “The Analysis of Large Hyperfine Splitting in Paramagnetic Resonance Spectroscopy.” J. Magn. Reson. (1969), 4(3), 394–399, https://doi.org/10.1016/0022-2364(71)90049-7.
Stoll S, Schweiger A (2006). “EasySpin, A Comprehensive Software Package for Spectral Simulation and Analysis in EPR.” J. Magn. Reson., 178(1), 42–55, https://doi.org/10.1016/j.jmr.2005.08.013.
Stoll S (2024). “EasySpin Documentation - Line Shapes.”, https://easyspin.org/easyspin/documentation/lineshapes.html.
Gerson F, Huber W (2003). Electron Spin Resonance Spectroscopy of Organic Radicals, Biotechnology Series, Wiley-VCH, ISBN 978-3-527-30275-8, https://books.google.cz/books?id=SEPeNjG3IvYC.
Other Simulations and Optimization:
eval_sim_EPR_isoFit()
,
eval_sim_EPR_iso_combo()
,
optim_for_EPR_fitness()
,
quantify_EPR_Sim_series()
,
smooth_EPR_Spec_by_npreg()
## simulation of simple EPR spectrum (without hyperfine ## structure) with g(iso) = 1.9804 and the linewidth ## ∆Bpp = 3.2 G, only Gaussian lineform is considered: sim.simple.a <- eval_sim_EPR_iso(g.iso = 1.9804, instrum.params = c(Bcf = 3490, Bsw = 200, Npoints = 1600, mwGHz = 9.8943), lineGL.DeltaB = list(3.2,NULL) ) ## simulation preview: sim.simple.a$plot # ## simulation of luteolin radical anion with ## the following four hyperfine coupling constants ## A(1 x 1H) = 3.1 MHz, A(1 x 1H) = 2.8 MHz, ## A(1 x 1H) = 8.0 MHz and A(1 x 1H) = 4.1 MHz, ## one may check out the simulation ## at https://doi.org/10.1016/j.electacta.2013.06.136 ## (see Fig. 6 in that article): sim.luteol <- eval_sim_EPR_iso(g.iso = 2.00495, instrum.params = c(Bcf = 339.367, Bsw = 5.9, Npoints = 2048, mwGHz = 9.5294), nuclear.system = list(list("1H",1,3.1), list("1H",1,2.8), list("1H",1,8.0), list("1H",1,4.1)), lineGL.DeltaB = list(0.034,0.034), lineG.content = 0.6, B.unit = "mT" ) # ## simulated spectrum preview within ## the B = (338-341) mT region: sim.luteol$plot + ggplot2::coord_cartesian(xlim = c(338,341)) # ## ...and the corresponding data frame: head(sim.luteol$df) # ## simulation of phenalenyl/perinaphthenyl ## (PNT) radical in the integrated form: eval_sim_EPR_iso(g = 2.0027, instrum.params = c(Bcf = 3500, # central field Bsw = 100, # sweep width Npoints = 4096, mwGHz = 9.8), # MW Freq. in GHz B.unit = "G", nuclear.system = list( list("1H",3,5.09), # 3 x A(1H) = 5.09 MHz list("1H",6,17.67) # 6 x A(1H) = 17.67 MHz ), lineSpecs.form = "integrated", lineGL.DeltaB = list(0.54,NULL), # Gauss. FWHM in G Intensity.sim = "single_Integ", plot.sim.interact = TRUE )
## simulation of simple EPR spectrum (without hyperfine ## structure) with g(iso) = 1.9804 and the linewidth ## ∆Bpp = 3.2 G, only Gaussian lineform is considered: sim.simple.a <- eval_sim_EPR_iso(g.iso = 1.9804, instrum.params = c(Bcf = 3490, Bsw = 200, Npoints = 1600, mwGHz = 9.8943), lineGL.DeltaB = list(3.2,NULL) ) ## simulation preview: sim.simple.a$plot # ## simulation of luteolin radical anion with ## the following four hyperfine coupling constants ## A(1 x 1H) = 3.1 MHz, A(1 x 1H) = 2.8 MHz, ## A(1 x 1H) = 8.0 MHz and A(1 x 1H) = 4.1 MHz, ## one may check out the simulation ## at https://doi.org/10.1016/j.electacta.2013.06.136 ## (see Fig. 6 in that article): sim.luteol <- eval_sim_EPR_iso(g.iso = 2.00495, instrum.params = c(Bcf = 339.367, Bsw = 5.9, Npoints = 2048, mwGHz = 9.5294), nuclear.system = list(list("1H",1,3.1), list("1H",1,2.8), list("1H",1,8.0), list("1H",1,4.1)), lineGL.DeltaB = list(0.034,0.034), lineG.content = 0.6, B.unit = "mT" ) # ## simulated spectrum preview within ## the B = (338-341) mT region: sim.luteol$plot + ggplot2::coord_cartesian(xlim = c(338,341)) # ## ...and the corresponding data frame: head(sim.luteol$df) # ## simulation of phenalenyl/perinaphthenyl ## (PNT) radical in the integrated form: eval_sim_EPR_iso(g = 2.0027, instrum.params = c(Bcf = 3500, # central field Bsw = 100, # sweep width Npoints = 4096, mwGHz = 9.8), # MW Freq. in GHz B.unit = "G", nuclear.system = list( list("1H",3,5.09), # 3 x A(1H) = 5.09 MHz list("1H",6,17.67) # 6 x A(1H) = 17.67 MHz ), lineSpecs.form = "integrated", lineGL.DeltaB = list(0.54,NULL), # Gauss. FWHM in G Intensity.sim = "single_Integ", plot.sim.interact = TRUE )
This is an extension of the "basic" EPR simulation provided by the eval_sim_EPR_iso
function,
where one can combine several simulated EPR spectra (components), even with (partial) overlay,
into one spectrum corresponding to sum of all components. Such processing might be useful for the simulation
of EPR spectra with satellites, especially of those consisted of naturally occurring
isotopes, like the one presented in Examples
.
eval_sim_EPR_iso_combo( g.iso.vec, instrum.params = c(Bcf = 3500, Bsw = 200, Npoints = 2048, mwGHz = 9.8), B.unit = "G", path_to_dsc_par = NULL, origin = NULL, nuclear.system, natur.abund.vec, lineSpecs.form = "derivative", lineGL.DeltaB, lineG.content.vec, Intensity.sim = "dIeprSim_over_dB", Intensity.sim.coeffs.vec, plot.sim.interact = NULL )
eval_sim_EPR_iso_combo( g.iso.vec, instrum.params = c(Bcf = 3500, Bsw = 200, Npoints = 2048, mwGHz = 9.8), B.unit = "G", path_to_dsc_par = NULL, origin = NULL, nuclear.system, natur.abund.vec, lineSpecs.form = "derivative", lineGL.DeltaB, lineG.content.vec, Intensity.sim = "dIeprSim_over_dB", Intensity.sim.coeffs.vec, plot.sim.interact = NULL )
g.iso.vec |
Numeric vector with all |
|||||||||
instrum.params |
Named numeric vector, containing instrumental parameters required for the simulation =>
Default values are chosen to cover the EPR spectra of common organic radicals.
If |
|||||||||
B.unit |
Character string, pointing to unit of magnetic flux density which is to be presented
on |
|||||||||
path_to_dsc_par |
Character string, path (can be also acquired by the |
|||||||||
origin |
Character string, corresponding to software which was used to obtain the EPR spectra
on spectrometers, because the files are slightly different, whether they
were recorded by the "WinEpr" ( |
|||||||||
nuclear.system |
Nested list with the elements corresponding to considered interacting nuclei for each EPR
spectral component. For example, the |
|||||||||
natur.abund.vec |
Logical vector, whether to consider natural abundance of the interacting nuclei within
the components (see also |
|||||||||
lineSpecs.form |
Character string, describing either |
|||||||||
lineGL.DeltaB |
Nested list of the Gaussian and Lorentzian linewidths for all individual components
like |
|||||||||
lineG.content.vec |
Numeric vector, corresponding to Gaussian line content for all individual components
of the EPR spectrum like |
|||||||||
Intensity.sim |
Character string, pointing to column of simulated EPR intensity within the related output
data frame. Default: |
|||||||||
Intensity.sim.coeffs.vec |
Numeric vector of multiplication coefficients related to EPR component intensities
like |
|||||||||
plot.sim.interact |
Character string, indicating the interactive plot outputs, to visualize either individual
|
List of the following data frames and plots in case of
plot.sim.interact = NULL
=>
Long-format data frame with the simulated EPR spectral components A, B, C, ... (e.g. representing the individual radicals) as a categorical variable + magnetic flux density, intensity as well as their sigmoid integral column/variable.
Data frame with simulation components A, B, C ...and their
corresponding double/single integrals (or areas
) and their relative ratios
to overall integral sum (weighted_areas
).
Data frame with the overall intensity (+ magnetic flux density) as well as integral sum from all simulation components.
Overlay plot object with all simulated components with their
corresponding intensities defined by Intensity.sim.coeffs.vec
.
Plot object displaying the sum of all simulation components.
If plot.sim.interact
is activated (i.e. possesses either "components"
or "sum"
values) interactive plots (based on plotly
) are presented either with
all individual components or with the overall simulated EPR spectrum sum, respectively.
Other Simulations and Optimization:
eval_sim_EPR_iso()
,
eval_sim_EPR_isoFit()
,
optim_for_EPR_fitness()
,
quantify_EPR_Sim_series()
,
smooth_EPR_Spec_by_npreg()
## Simulation of EPR spectrum of TEMPO (aminoxyl) ## radical with 13C satellites and hyperfine coupling ## constants A(1 x 14N) = 48 MHz, A(1 x 13C) = 18.2 MHz, ## the latter 13C may appear on 4 different ## positions (methyl carbons) => therefore the overall ## probability to find it at any position is ## approx. 4,4% (1.1% per one 13C), the additional ## two quaternary α-Carbons are not considered ## see e.g. https://doi.org/10.1016/j.mencom.2014.09.018 sim.tempo.13c <- eval_sim_EPR_iso_combo(g.iso.vec = c(2.0059,2.0059), nuclear.system = list(list("14N",1,48), list(list("14N",1,48), list("13C",1,18.5) ) ), natur.abund.vec = c(FALSE,FALSE), lineGL.DeltaB = list(list(1.3,NULL), list(1.3,NULL) ), lineG.content.vec = c(1,1), Intensity.sim.coeffs.vec = c(0.956/3,0.044/6)) # ## simulated spectrum/plot: sim.tempo.13c$plot.sum + ggplot2::coord_cartesian(xlim = c(3425,3550)) # ## ...and the corresponding data frame: options(pillar.sigfig = 5) ## prevent rounding # tempo.df.sum <- sim.tempo.13c$df.sum tempo.df.sum[1000:1005, ] # ## data frame with all components: sim.tempo.13c$df[1000:1005,] # ## areas/integrals sim.tempo.13c$df.areas
## Simulation of EPR spectrum of TEMPO (aminoxyl) ## radical with 13C satellites and hyperfine coupling ## constants A(1 x 14N) = 48 MHz, A(1 x 13C) = 18.2 MHz, ## the latter 13C may appear on 4 different ## positions (methyl carbons) => therefore the overall ## probability to find it at any position is ## approx. 4,4% (1.1% per one 13C), the additional ## two quaternary α-Carbons are not considered ## see e.g. https://doi.org/10.1016/j.mencom.2014.09.018 sim.tempo.13c <- eval_sim_EPR_iso_combo(g.iso.vec = c(2.0059,2.0059), nuclear.system = list(list("14N",1,48), list(list("14N",1,48), list("13C",1,18.5) ) ), natur.abund.vec = c(FALSE,FALSE), lineGL.DeltaB = list(list(1.3,NULL), list(1.3,NULL) ), lineG.content.vec = c(1,1), Intensity.sim.coeffs.vec = c(0.956/3,0.044/6)) # ## simulated spectrum/plot: sim.tempo.13c$plot.sum + ggplot2::coord_cartesian(xlim = c(3425,3550)) # ## ...and the corresponding data frame: options(pillar.sigfig = 5) ## prevent rounding # tempo.df.sum <- sim.tempo.13c$df.sum tempo.df.sum[1000:1005, ] # ## data frame with all components: sim.tempo.13c$df[1000:1005,] # ## areas/integrals sim.tempo.13c$df.areas
Fitting of the simulated spectrum onto the experimental one represents an important step in the analysis
of EPR spectra. Parameters of the simulated spectrum like ; coupling constants
(in
MHz
) for each group of equivalent nuclei; linewidth
(either
or
depending on the
lineSpecs.form
argument);
spectral baseline (see the baseline.correct
) and finally the intensity (multiplication coefficient)
are optimized by the methods listed in optim_for_EPR_fitness
.
The lineG.content
corresponding parameter is the only one,
which needs to be varied "manually". In order to control the optimization/fitting process,
by similar interactive way like in EasySpin,
a Shiny app
and/or gganimate visualization is under development.
eval_sim_EPR_isoFit( data.spectr.expr, Intensity.expr = "dIepr_over_dB", Intensity.sim = "dIeprSim_over_dB", nu.GHz, B.unit = "G", nuclear.system.noA = NULL, baseline.correct = "constant", lineG.content = 0.5, lineSpecs.form = "derivative", optim.method = "neldermead", optim.params.init, optim.params.lower = NULL, optim.params.upper = NULL, Nmax.evals = 512, tol.step = 5e-07, pswarm.size = NULL, pswarm.diameter = NULL, pswarm.type = NULL, check.fit.plot = TRUE, output.list.final = FALSE, ... )
eval_sim_EPR_isoFit( data.spectr.expr, Intensity.expr = "dIepr_over_dB", Intensity.sim = "dIeprSim_over_dB", nu.GHz, B.unit = "G", nuclear.system.noA = NULL, baseline.correct = "constant", lineG.content = 0.5, lineSpecs.form = "derivative", optim.method = "neldermead", optim.params.init, optim.params.lower = NULL, optim.params.upper = NULL, Nmax.evals = 512, tol.step = 5e-07, pswarm.size = NULL, pswarm.diameter = NULL, pswarm.type = NULL, check.fit.plot = TRUE, output.list.final = FALSE, ... )
data.spectr.expr |
Data frame object/table, containing the experimental spectral data the with magnetic flux density
( |
Intensity.expr |
Character string, pointing to column name of the experimental EPR intensity within
the original |
Intensity.sim |
Character string, pointing to column name of the simulated EPR intensity within the related output
data frame. Default: |
nu.GHz |
Numeric value, microwave frequency in |
B.unit |
Character string, denoting the magnetic flux density unit e.g. |
nuclear.system.noA |
List or nested list without estimated hyperfine coupling constant values,
such as |
baseline.correct |
Character string, referring to baseline correction of the simulated/fitted spectrum.
Corrections like |
lineG.content |
Numeric value between |
lineSpecs.form |
Character string, describing either |
optim.method |
Character string (vector), setting the optimization method(s) gathered within
the |
optim.params.init |
Numeric vector with the initial parameter guess (elements) where the first five elements are immutable
DO NOT PUT ANY OF THESE PARAMETERS to |
optim.params.lower |
Numeric vector (with the same element order like |
optim.params.upper |
Numeric vector (with the same element order like |
Nmax.evals |
Numeric value, maximum number of function evaluations and/or iterations.
The only one method, limited by this argument, is |
tol.step |
Numeric value, describing the smallest optimization step (tolerance) to stop the optimization.
Default: |
pswarm.size |
Numeric value, which equals to particle swarm size (i.e. number of particles),
if |
pswarm.diameter |
Numeric value, corresponding to diameter of the particle swarm search space
(in case
|
pswarm.type |
Character string, setting the type/version of particle swarm algorithm
if |
check.fit.plot |
Logical, whether to return overlay plot with the initial simulation + the best simulation
fit + experimental spectrum (including residuals in the lower part of the plot,
|
output.list.final |
Logical. If |
... |
additional arguments specified (see also |
Optimization/Fitting procedure results in vector or data frame or list depending on the check.fit.plot
and output...
arguments.
If check.fit.plot = TRUE
or check.fit.plot = FALSE
, the result corresponds
to list with the following components:
Visualization of the experimental as well as the best fitted EPR simulated spectra.
If check.fit.plot = TRUE
, the overlay plot consists of the initial simulation + the best simulation
fit + experimental spectrum, including residuals in the plot lower part. Whereas, if check.fit.plot = FALSE
,
following three spectra are available: 1. experimental, 2. the best simulated one with the baseline fit
and 3. the best simulated spectrum with the baseline fit subtracted. The latter two are offset for clarity.
Vector of the best (final) fitting (optimized) parameters, for each corresponding
optim.method
, to simulate the experimental EPR spectrum, see also description of the optim.params.init
.
Tidy data frame (table) with the magnetic flux density and intensities of the experimental,
the best simulated/fitted, as well as the initially simulated EPR spectrum and residuals
(if check.fit.plot = TRUE
), or wide data frame with the following variables / columns
(for check.fit.plot = FALSE
): magnetic flux density, intensity of the experimental
spectrum, intensity of the best simulated one (including the baseline fit), residual intensity and finally,
the best simulated spectrum intensity without the baseline fit.
Minimum sum of residual squares (vector) after the least-square procedure.
Number of iterations/function evaluations completed before termination.
If the pswarm
optimization algorithm is included in optim.method
, the N.evals
equals to vector with the following elements: number of function evaluations, number of iterations (per one particle)
and the number of restarts.
Vector or simple integer code indicating the successful completion
of the optimization/fit. In the case of "levenmarq"
method, the vector elements coincide with
the sum of residual squares at each iteration. If the optim.method = "pswarm"
is applied, one of the following
codes can be returned: 0
: algorithm terminated by reaching the absolute tolerance,
1
: maximum number of function evaluations reached, 2
: maximum number of iterations reached,
3
: maximum number of restarts reached, 4
: maximum number of iterations without improvement reached.
For all the other remaining methods (coming from {nloptr}
package), the integers have to be positive
to indicate the successful convergence.
If output.list.final = TRUE
, the function exclusively returns list with the two components,
which will be applied for the more complex optimization/fitting (which is currently under development).
Vector, corresponding to the best fitting (optimized) parameters (related
to the optim.params.init
argument, see also list above) + minimum sum of residual squares,
after the (final) optim.method
procedure.
Data frame including the final best simulated spectrum with and without the baseline fit.
In order to guess the intensity multiplication constant (please, refer to the optim.params.init
argument), one might compare the intensities of the experimental (expr
) and simulated (sim
)
EPR spectrum by one of the interactive or static plot functions (e.g. plot_EPR_Specs
or plot_EPR_Specs2D_interact
) as well as by the eval_sim_EPR_iso
. Accordingly,
the initial intensity multiplication constant can be estimated as the ratio
max(expr
intensity)/max(sim
intensity).
Other Simulations and Optimization:
eval_sim_EPR_iso()
,
eval_sim_EPR_iso_combo()
,
optim_for_EPR_fitness()
,
quantify_EPR_Sim_series()
,
smooth_EPR_Spec_by_npreg()
## loading built-in example dataset which is simple ## EPR spectrum of the aminoxyl radical: aminoxyl.data.path <- load_data_example(file = "Aminoxyl_radical_a.txt") aminoxyl.data <- readEPR_Exp_Specs(aminoxyl.data.path, qValue = 2100) # ## EPR spectrum simulation fit with "Nelder-Mead" ## optimization method with `check.fit.plot = FALSE`: tempo.test.sim.fit.a <- eval_sim_EPR_isoFit(data.spectr.expr = aminoxyl.data, nu.GHz = 9.806769, lineG.content = 0.5, optim.method = "neldermead", nuclear.system.noA = list("14N",1), baseline.correct = "linear", optim.params.init = c(2.006, # g-value 4.8, # G Delta Bpp 4.8, # L Delta Bpp 0, # intercept (constant) lin. baseline 0.018, # Sim. intensity multiply 1e-6, # slope lin. baseline 49), # A in MHz check.fit.plot = FALSE ) ## OUTPUTS: ## best fit parameters: tempo.test.sim.fit.a$best.fit.params # ## spectrum plot with experimental spectrum, ## simulated one with the linear baseline fit ## and simulated one with the linear baseline ## fit subtracted: tempo.test.sim.fit.a$plot # ## minimum sum of residual squares: tempo.test.sim.fit.a$min.rss # ## number of evaluations / iterations: tempo.test.sim.fit.a$N.evals # ## convergence, in this case it is represented ## by the integer code indicating the successful ## completion (it must be > 0): tempo.test.sim.fit.a$N.converg # ## preview of data frame including all EPR spectra: head(tempo.test.sim.fit.a$df) # ## similar EPR spectrum simulation fit with "particle swarm" ## optimization algorithm and `check.fit.plot = TRUE` option ## as well as user defined bound constraints: tempo.test.sim.fit.b <- eval_sim_EPR_isoFit(data.spectr.expr = aminoxyl.data, nu.GHz = 9.806769, lineG.content = 0.4, optim.method = "pswarm", nuclear.system.noA = list("14N",1), baseline.correct = "constant", optim.params.init = c(2.006,4.8,4.8,0,1.4e-2,49), optim.params.lower = c(2.0048,4.4,4.4,-1e-4,1.1e-2,45), optim.params.upper = c(2.0072,5.2,5.2,1e-4,1.7e-2,53), check.fit.plot = TRUE ) ## OUTPUTS: ## best fit parameters: tempo.test.sim.fit.b$best.fit.params # ## quick simulation check by plotting the both ## simulated and the experimental EPR spectra ## together with the initial simulation ## and the residuals (differences between the ## experiment and the best fit) tempo.test.sim.fit.b$plot # ## fitting of the aminoxyl EPR spectrum ## by the combination of the 1. "Levenberg-Marquardt" ## and 2. "Nelder-Mead" algorithms tempo.test.sim.fit.c <- eval_sim_EPR_isoFit(aminoxyl.data, nu.GHz = 9.86769, lineG.content = 0.5, optim.method = c("levenmarq", "neldermead"), nuclear.system.noA = list("14N",1), baseline.correct = "constant", optim.params.init = c(2.0060, 4.8, 4.8, 0, 7e-3, 49), check.fit.plot = FALSE ) ## OUTPUTS: ## best fit parameters for both procedures within a list: tempo.test.sim.fit.c$best.fit.params # ## compare the results with the example in the `readMAT_params_file`, ## corresponding to the best fit from `Easyspin` # ## `N.converg` also consists of two components ## each corresponding to result of the individual ## optimization method where the "levenmarq" returns ## the sum of squares at each iteration, therefore the 1st ## component is vector and the 2nd one is integer code ## as already stated above: tempo.test.sim.fit.c$N.converg
## loading built-in example dataset which is simple ## EPR spectrum of the aminoxyl radical: aminoxyl.data.path <- load_data_example(file = "Aminoxyl_radical_a.txt") aminoxyl.data <- readEPR_Exp_Specs(aminoxyl.data.path, qValue = 2100) # ## EPR spectrum simulation fit with "Nelder-Mead" ## optimization method with `check.fit.plot = FALSE`: tempo.test.sim.fit.a <- eval_sim_EPR_isoFit(data.spectr.expr = aminoxyl.data, nu.GHz = 9.806769, lineG.content = 0.5, optim.method = "neldermead", nuclear.system.noA = list("14N",1), baseline.correct = "linear", optim.params.init = c(2.006, # g-value 4.8, # G Delta Bpp 4.8, # L Delta Bpp 0, # intercept (constant) lin. baseline 0.018, # Sim. intensity multiply 1e-6, # slope lin. baseline 49), # A in MHz check.fit.plot = FALSE ) ## OUTPUTS: ## best fit parameters: tempo.test.sim.fit.a$best.fit.params # ## spectrum plot with experimental spectrum, ## simulated one with the linear baseline fit ## and simulated one with the linear baseline ## fit subtracted: tempo.test.sim.fit.a$plot # ## minimum sum of residual squares: tempo.test.sim.fit.a$min.rss # ## number of evaluations / iterations: tempo.test.sim.fit.a$N.evals # ## convergence, in this case it is represented ## by the integer code indicating the successful ## completion (it must be > 0): tempo.test.sim.fit.a$N.converg # ## preview of data frame including all EPR spectra: head(tempo.test.sim.fit.a$df) # ## similar EPR spectrum simulation fit with "particle swarm" ## optimization algorithm and `check.fit.plot = TRUE` option ## as well as user defined bound constraints: tempo.test.sim.fit.b <- eval_sim_EPR_isoFit(data.spectr.expr = aminoxyl.data, nu.GHz = 9.806769, lineG.content = 0.4, optim.method = "pswarm", nuclear.system.noA = list("14N",1), baseline.correct = "constant", optim.params.init = c(2.006,4.8,4.8,0,1.4e-2,49), optim.params.lower = c(2.0048,4.4,4.4,-1e-4,1.1e-2,45), optim.params.upper = c(2.0072,5.2,5.2,1e-4,1.7e-2,53), check.fit.plot = TRUE ) ## OUTPUTS: ## best fit parameters: tempo.test.sim.fit.b$best.fit.params # ## quick simulation check by plotting the both ## simulated and the experimental EPR spectra ## together with the initial simulation ## and the residuals (differences between the ## experiment and the best fit) tempo.test.sim.fit.b$plot # ## fitting of the aminoxyl EPR spectrum ## by the combination of the 1. "Levenberg-Marquardt" ## and 2. "Nelder-Mead" algorithms tempo.test.sim.fit.c <- eval_sim_EPR_isoFit(aminoxyl.data, nu.GHz = 9.86769, lineG.content = 0.5, optim.method = c("levenmarq", "neldermead"), nuclear.system.noA = list("14N",1), baseline.correct = "constant", optim.params.init = c(2.0060, 4.8, 4.8, 0, 7e-3, 49), check.fit.plot = FALSE ) ## OUTPUTS: ## best fit parameters for both procedures within a list: tempo.test.sim.fit.c$best.fit.params # ## compare the results with the example in the `readMAT_params_file`, ## corresponding to the best fit from `Easyspin` # ## `N.converg` also consists of two components ## each corresponding to result of the individual ## optimization method where the "levenmarq" returns ## the sum of squares at each iteration, therefore the 1st ## component is vector and the 2nd one is integer code ## as already stated above: tempo.test.sim.fit.c$N.converg
Data frame/Dataset summarizing the essential characteristics of nuclei in EPR spectroscopy.
isotopes_ds
isotopes_ds
A data frame with 351 rows and 9 variables/columns:
Numeric, proton number.
Character, ponting to isotope in format like "14N".
Character, pointing either to stable, "STB", or to radio-active, "RA", isotope.
Character, corresponding to isotope name.
Numeric, denoting the spin quantum number.
Numeric, corresponding to nuclear -factor (
).
Numeric, pointing to natural abundance of an isotope in .
Numeric, corresponding to nuclear quadrupolar moment in .
Numeric, specific Larmor/ENDOR frequency ()
at
.
This dataset was taken form 'EasySpin' toolbox
and only it's format was slightly modified. Therefore, IT CONTAINS THE ENTIRE INFORMATION
LIKE THE ORIGINAL DATASET (see the Source
). For better orientation in ENDOR spectra,
column with the Larmor/ENDOR frequencies (in MHz) at 0.35 T was added according to =>
where is the Planck's constant,
is the nuclear magneton
available from constants
package (
constants::syms$mun
,syms
),
is the nuclear
-factor of the specific nucleus (reported in the data frame as
g_Nuclear
)
and finally, the denotes the magnetic flux density. The negative sign "
" mirrors
convention to describe the direction of magnetic spin moments precession (see also
eval_nu_ENDOR
) either
counter-clockwise (, if
) or clockwise (
, if
)
Please, consult the
vignette("datasets")
as well.
https://easyspin.org/easyspin/documentation/isotopetable.html
Other Built-In Datasets:
solvents_ds
Loads built-in package data files which are required either to demonstrate the package functionality
by examples within the documentation, or to run functions involving essential characteristics
of nuclei important for EPR spectroscopy (e.g. eval_nu_ENDOR
or eval_sim_EPR_iso
,
see also isotopes_ds
). Details of all data are summarized in vignette("datasets")
.
load_data_example(file = NULL)
load_data_example(file = NULL)
file |
Character string, corresponding to file name + extension. |
## list of all files within the "extdata" directory => load_data_example() # ## additionally, you may refer to several function examples
## list of all files within the "extdata" directory => load_data_example() # ## additionally, you may refer to several function examples
General-purpose optimization of the objective fn
function (also called "fitness")
which is to be minimized in order to fit theoretical models (EPR simulations)
onto the experimental data. Several methods/algorithms are implemented (see also Details
):
from the nloptr package: slsqp
,
neldermead
, crs2lm
, sbplx
,
cobyla
, lbfgs
; from the
minpack.lm package:
nls.lm
and finally
from the pso package:
psoptim
.
optim_for_EPR_fitness( method = "neldermead", x.0, fn, lower, upper, data, Nmax.evals = 512, tol.step = 5e-07, pswarm.size = NULL, pswarm.diameter = NULL, pswarm.type = NULL, ... )
optim_for_EPR_fitness( method = "neldermead", x.0, fn, lower, upper, data, Nmax.evals = 512, tol.step = 5e-07, pswarm.size = NULL, pswarm.diameter = NULL, pswarm.type = NULL, ... )
method |
Character string, pointing to applied optimization method/algorithm. One may choose one from
those listed in |
x.0 |
Numeric vector with the initial values to be optimized in order to fit onto the experimental data. |
fn |
Objective function that is to be minimized. Usually it is the function calculating the sum of residual squares,
in which a more general parameterized one can be implemented (see |
lower , upper
|
lower and upper bound constraints. |
data |
Data frame object, containing columns/variables (e.g. intensity of an EPR spectrum), required to undergo a fitting/optimization process. |
Nmax.evals |
Numeric value, maximum number of function evaluations and/or iterations.
The only one method, limited by this argument, is |
tol.step |
Numeric, the smallest optimization step (relative change) between
2 iterations to stop the optimization procedure. For the |
pswarm.size |
Numeric value, which equals to particle swarm size (i.e. number of particles),
if |
pswarm.diameter |
Numeric value, corresponding to diameter of the particle swarm search space
(in case
|
pswarm.type |
Character string, setting the type/version of particle swarm algorithm
if |
... |
additional arguments passed to the function. |
All algorithms are based on the least-square minimization however,
the fn
definition in case of nls.lm
must be provided as a difference/residual
vector (see also eval_kinR_EPR_modelFit
) and not as sum of differences/residual squares.
The applied optimization/fitting methods are summarized in the following table (please, consult the details
in References
or in the individual function documentation - links in the Description
) =>
Method/Algorithm | Package | Short Description |
slsqp |
{nloptr} |
Sequential quadratic programming method for non-linearly constrained, gradient-based optimization. |
cobyla |
{nloptr} |
Constrained optimization by linear approximations, algorithm for derivative-free optimization with nonlinear inequality and equality constraints. |
lbfgs |
{nloptr} |
Low-storage version of the Broyden-Fletcher-Goldfarb-Shanno (BFGS) method. This is a quasi-Newton method well suited for the optimization problems with a large number of variables. |
neldermead |
{nloptr} |
Nelder-Mead ("N-M") simplex algorithm. |
crs2lm |
{nloptr} |
Controlled Random Search (CRS) algorithm (and in particular, the CRS2 variant) with the `local mutation' modification. |
sbplx |
{nloptr} |
Subplex algorithm, which is a variant of the "N-M" method on a sequence of sub-spaces. |
nls.lm (levenmarq ) |
{minpack.lm} |
Modified Levenberg-Marquardt algorithm. It is a combination of gradient descent and Gauss-Newton method. |
psoptim (pswarm ) |
{pso} |
Particle swarm optimization, which is a population-based stochastic optimization algorithm motivated by the intelligent collective behavior of some animals such as flocks of birds or schools of fish. |
Not all {nloptr}
-methods are implemented into the optim_for_EPR_fitness
. Those summarized above
were tested by the EPR simulation fit (see eval_sim_EPR_isoFit
) on the experimental spectra
of TEMPOL and Wuster's blue radicals. They provide the best results (without extensive "playing"
with nl.opts
, i.e. with options to control the optimization procedure) and proceed
relatively fast.
For all listed algorithms the function returns list
with the elements like
(please, refer to e.g. Value
in eval_sim_EPR_isoFit
)
The best parameters found (par
vector, depending on the initial x.0
set of parameters).
The value of fn
(minimum value) corresponding to the best par
.
Number of evaluations and/or iterations (in case of the method = "pswarm"
,
see also Value
in the psoptim
) before the termination.
(Un)successful termination information (convergence
or rsstrace
), usually
corresponding either to integer value showing the (un)successful termination like 2: Maximum number
of iterations reached
(or integer code > 0 indicating successful completion) or in the case
of nls.lm
, it returns a vector with the values equal
to sum of the residual squares at each iteration.
A descriptive message/character string giving additional information about the optimization procedure/termination. By default, this is however "turned off", for the sake of simplicity, because most of the information can be found in the previous convergence list element.
Johnson SG (2023). “The NLopt nonlinear-optimization package.” https://github.com/stevengj/nlopt.
Stamm A (2023). “nloptr.” https://github.com/astamm/nloptr/.
Mullen KM, Elzhov TV, Spiess A, Bolker B (2023). “minpack.lm.” https://github.com/cran/minpack.lm.
Gavin HP (2019). “The Levenberg-Marquardt algorithm for nonlinear least squares curve-fitting problems.” Department of civil and environmental engineering, Duke University, https://people.duke.edu/~hpgavin/lm.pdf.
Adyatama A (2019). “Particle Swarm Optimization.” https://rpubs.com/argaadya/intro-pso.
Tam A (2021). “A Gentle Introduction to Particle Swarm Optimization.” https://machinelearningmastery.com/a-gentle-introduction-to-particle-swarm-optimization/.
Ugolotti R, Cagnoni S (2016). "A Fair Comparison Between Standard PSO Versions." In: Rossi F, Mavelli F, Stano P, Caivano D (eds), Advances in Artificial Life, Evolutionary Computation and Systems Chemistry, WIVACE 2015, Communications in Computer and Information Science, Springer, https://doi.org/10.1007/978-3-319-32695-5_1.
Zambrano-Bigiarini M, Clerc M, Rojas-Mujica R (2013). "Standard Particle Swarm Optimisation 2011 at CEC-2013: A baseline for future PSO improvements." 2013 IEEE Congress on Evolutionary Computation, https://ieeexplore.ieee.org/document/6557848.
Other Simulations and Optimization:
eval_sim_EPR_iso()
,
eval_sim_EPR_isoFit()
,
eval_sim_EPR_iso_combo()
,
quantify_EPR_Sim_series()
,
smooth_EPR_Spec_by_npreg()
## Not run: ## following code snippets were taken from ## the `quantify_EPR_Sim_series` function # ## if an EPR spectrum consists of several ## components or several radical spectra partly overlay, ## following simple function, taking the linear ## combination of EPR simulated intensities (max. 6), ## can be applied in order to fit the sum of the individual ## simulations onto the experimental EPR spectrum ## envelope, the input parameters therefore correspond ## to zero-point/intercept(par[1]) and coefficients ## of the linear combinations(par[2]...par[7]), ## equal to individual intensity multiplications: fit_params_specs_par <- function(data, col.name.pattern, par){ # # data contains variables/columns of simulated # intensities with the headers characterized # by the `col.name.patter` # data <- data[,grep(col.name.pattern, colnames(data), value = TRUE)] # ## create a sum for all columns/simulated spectra if (ncol(data) == 1){ summa <- par[1] + (par[2] * data[[1]]) } if (ncol(data) == 2){ summa <- par[1] + (par[2] * data[[1]]) + (par[3] * data[[2]]) } if (ncol(data) == 3){ summa <- par[1] + (par[2] * data[[1]]) + (par[3] * data[[2]]) + (par[4] * data[[3]]) } if (ncol(data) == 4){ summa <- par[1] + (par[2] * data[[1]]) + (par[3] * data[[2]]) + (par[4] * data[[3]]) + (par[5] * data[[4]]) } if (ncol(data) == 5){ summa <- par[1] + (par[2] * data[[1]]) + (par[3] * data[[2]]) + (par[4] * data[[3]]) + (par[5] * data[[4]]) + (par[6] * data[[5]]) } if (ncol(data) == 6){ summa <- par[1] + (par[2] * data[[1]]) + (par[3] * data[[2]]) + (par[4] * data[[3]]) + (par[5] * data[[4]]) + (par[6] * data[[5]]) + (par[7] * data[[6]]) } # return(summa) } # ## following function is applied to vary only ## `method`, `function` and `data` optim_fn <- function(fun,method,data){ optim.list <- optim_for_EPR_fitness(x.0 = optim.params.init, method = method, fn = fun, lower = optim.params.lower, upper = optim.params.upper, Nmax.evals = Nmax.evals, tol.step = tol.step, pswarm.size = pswarm.size, pswarm.diameter = pswarm.diameter, data = data, col.name.pattern = "Sim.*_[[:upper:]]$" ) # return(optim.list) } # ## finally, the following function is to be minimized: min_residuals_ps <- function(data,col.name.pattern,par){ with(data,sum((data[[Intensity.expr]] - fit_params_specs_par(data,col.name.pattern,par))^2) ) } # ## therefore, the final `optimization` list may look like optimization.list <- lapply(seq(data.list), function(o) { optim_fn(method = optim.method, data = data.list[[o]], fun = min_residuals_ps) } ) ## where `data.list` represents the list of data frames ## including all individual simulated spectra ## (one data frame for each spectrum + original ## experimental spectrum intensity column) # ## End(Not run)
## Not run: ## following code snippets were taken from ## the `quantify_EPR_Sim_series` function # ## if an EPR spectrum consists of several ## components or several radical spectra partly overlay, ## following simple function, taking the linear ## combination of EPR simulated intensities (max. 6), ## can be applied in order to fit the sum of the individual ## simulations onto the experimental EPR spectrum ## envelope, the input parameters therefore correspond ## to zero-point/intercept(par[1]) and coefficients ## of the linear combinations(par[2]...par[7]), ## equal to individual intensity multiplications: fit_params_specs_par <- function(data, col.name.pattern, par){ # # data contains variables/columns of simulated # intensities with the headers characterized # by the `col.name.patter` # data <- data[,grep(col.name.pattern, colnames(data), value = TRUE)] # ## create a sum for all columns/simulated spectra if (ncol(data) == 1){ summa <- par[1] + (par[2] * data[[1]]) } if (ncol(data) == 2){ summa <- par[1] + (par[2] * data[[1]]) + (par[3] * data[[2]]) } if (ncol(data) == 3){ summa <- par[1] + (par[2] * data[[1]]) + (par[3] * data[[2]]) + (par[4] * data[[3]]) } if (ncol(data) == 4){ summa <- par[1] + (par[2] * data[[1]]) + (par[3] * data[[2]]) + (par[4] * data[[3]]) + (par[5] * data[[4]]) } if (ncol(data) == 5){ summa <- par[1] + (par[2] * data[[1]]) + (par[3] * data[[2]]) + (par[4] * data[[3]]) + (par[5] * data[[4]]) + (par[6] * data[[5]]) } if (ncol(data) == 6){ summa <- par[1] + (par[2] * data[[1]]) + (par[3] * data[[2]]) + (par[4] * data[[3]]) + (par[5] * data[[4]]) + (par[6] * data[[5]]) + (par[7] * data[[6]]) } # return(summa) } # ## following function is applied to vary only ## `method`, `function` and `data` optim_fn <- function(fun,method,data){ optim.list <- optim_for_EPR_fitness(x.0 = optim.params.init, method = method, fn = fun, lower = optim.params.lower, upper = optim.params.upper, Nmax.evals = Nmax.evals, tol.step = tol.step, pswarm.size = pswarm.size, pswarm.diameter = pswarm.diameter, data = data, col.name.pattern = "Sim.*_[[:upper:]]$" ) # return(optim.list) } # ## finally, the following function is to be minimized: min_residuals_ps <- function(data,col.name.pattern,par){ with(data,sum((data[[Intensity.expr]] - fit_params_specs_par(data,col.name.pattern,par))^2) ) } # ## therefore, the final `optimization` list may look like optimization.list <- lapply(seq(data.list), function(o) { optim_fn(method = optim.method, data = data.list[[o]], fun = min_residuals_ps) } ) ## where `data.list` represents the list of data frames ## including all individual simulated spectra ## (one data frame for each spectrum + original ## experimental spectrum intensity column) # ## End(Not run)
Visualization of electrochemical responses like
voltammogram or chronoamperogram
either by ggplot2 (static plot) or by plotly
interactive package. The corresponding data frame for the plot can be created from the ASCII text file,
generated by the potentiostat electrochemical instrument, using the fread
function
(see also section Examples
).
plot_ECh_VoC_amperogram( data.vat, x = "E_V", x.unit = "V", Current = "I_uA", Current.unit = "uA", xlim = NULL, Ilim = NULL, line.color = "darkviolet", line.width = 0.75, line.type = 1, theme.basic = "theme_gray", axis.title.size = 15, axis.text.size = 14, border.line.color = "black", border.line.width = 0.5, border.line.type = 1, ref.electrode = NULL, plot.interact = FALSE, ticks = "out", grid = TRUE )
plot_ECh_VoC_amperogram( data.vat, x = "E_V", x.unit = "V", Current = "I_uA", Current.unit = "uA", xlim = NULL, Ilim = NULL, line.color = "darkviolet", line.width = 0.75, line.type = 1, theme.basic = "theme_gray", axis.title.size = 15, axis.text.size = 14, border.line.color = "black", border.line.width = 0.5, border.line.type = 1, ref.electrode = NULL, plot.interact = FALSE, ticks = "out", grid = TRUE )
data.vat |
Data frame (table) object, including required columns like |
x |
Character string, pointing to |
x.unit |
Character string, pointing to |
Current |
Character string, indicating the |
Current.unit |
Character string, pointing to |
xlim |
Numeric vector of the |
Ilim |
Numeric vector, characterizing the lower and upper limit of the current, e.g. |
line.color |
Character string, pointing to line color of the voltammogram / chronoamperogram. All |
line.width |
Numeric, linewidth of the plot line in |
line.type |
Character string or integer, corresponding to width of the voltammogram/chronoamperogram line.
Following types can be specified: |
theme.basic |
Character string, calling a
|
axis.title.size |
Numeric, axis text title size in |
axis.text.size |
Numeric, text size in |
border.line.color |
Character string, referring to color of the plot graph/panel border line. Default:
|
border.line.width |
Numeric, width (in |
border.line.type |
Character string or integer, corresponding to width of the plot graph/panel border line. Following types
can be specified: |
ref.electrode |
Character string, corresponding to reference electrode notiation/label, e.g.
|
plot.interact |
Logical, whether the voltammogram or chronoamperogram is visualized as an interactive plot
by |
ticks |
Character string, corresponding to pointing direction of the axis ticks, either pointing into
the panel graph or outwards (default). If |
grid |
Logical, whether to display the |
Graphical representation (list object) of voltammogram or chronoamperogram either in static
form by {ggplot2}
(plot.interact = FALSE
) or in interactive form by {plotly}
(plot.interact = TRUE
).
Bard AJ, Faulkner LR, White HS (2022). Electrochemical methods: Fundamentals and Applications, 3rd edition. John Wiley and Sons, Inc., ISBN 978-1-119-33405-7, https://www.wiley.com/en-us/9781119334064.
Pingarrón JM, Labuda J, Barek J, Brett CMA, Camões MF, Fojta M, Hibbert DB (2020). “Terminology of Electrochemical Methods of Analysis (IUPAC Recommendations 2019).” Pure and Appl. Chem., 92(4), 641–694. https://doi.org/10.1515/pac-2018-0109.
Neudeck A, Petr A, Dunsch L (1999). “The redox mechanism of Polyaniline Studied by Simultaneous ESR–UV–vis Spectroelectrochemistry.” Synth. Met., 107(3), 143–158, https://doi.org/10.1016/S0379-6779(99)00135-6.
Elgrishi N, Rountree KJ, McCarthy BD, Rountree ES, Eisenhart TT, Dempsey JL (2018). “A Practical Beginner’s Guide to Cyclic Voltammetry.” J. Chem. Educ., 95(2), 197–206, https://doi.org/10.1021/acs.jchemed.7b00361.
Other EPR Spectroelectrochemistry:
eval_ECh_QNe_chronoamp()
## loading package built-in example file => ## `.txt` file generated by the IVIUM potentiostat software triarylamine.path.cv <- load_data_example(file = "Triarylamine_ECh_CV_ivium.txt") ## the data frame contains following variables: ## time, desired potential, current and the actual/applied ## potential triarylamine.data.cv <- data.table::fread(file = triarylamine.path.cv, skip = 2, col.names = c("time_s", "E_V_des", # desired potential "I_A", "E_V_app") # applied potential ) ## data frame preview head(triarylamine.data.cv) # ## simple voltammogram plot with ref. electrode string: plot_ECh_VoC_amperogram(data.vat = triarylamine.data.cv, x = "E_V_app", Current = "I_A", Current.unit = "A", ref.electrode = "Ag-quasiref." ) # ## simple chronoamperogram plot with "theme_bw" theme ## and `ticks` pointing into the graph panel (ticks = "in") plot_ECh_VoC_amperogram(data.vat = triarylamine.data.cv, x = "time_s", x.unit = "s", Current = "I_A", line.color = "darkred", line.type = 3, Current.unit = "A", theme.basic = "theme_bw", ticks = "in" ) # ## simple interactive "darkgreen" voltammogram plot_ECh_VoC_amperogram(data.vat = triarylamine.data.cv, x = "E_V_app", Current = "I_A", Current.unit = "A", line.color = "darkgreen", plot.interact = TRUE )
## loading package built-in example file => ## `.txt` file generated by the IVIUM potentiostat software triarylamine.path.cv <- load_data_example(file = "Triarylamine_ECh_CV_ivium.txt") ## the data frame contains following variables: ## time, desired potential, current and the actual/applied ## potential triarylamine.data.cv <- data.table::fread(file = triarylamine.path.cv, skip = 2, col.names = c("time_s", "E_V_des", # desired potential "I_A", "E_V_app") # applied potential ) ## data frame preview head(triarylamine.data.cv) # ## simple voltammogram plot with ref. electrode string: plot_ECh_VoC_amperogram(data.vat = triarylamine.data.cv, x = "E_V_app", Current = "I_A", Current.unit = "A", ref.electrode = "Ag-quasiref." ) # ## simple chronoamperogram plot with "theme_bw" theme ## and `ticks` pointing into the graph panel (ticks = "in") plot_ECh_VoC_amperogram(data.vat = triarylamine.data.cv, x = "time_s", x.unit = "s", Current = "I_A", line.color = "darkred", line.type = 3, Current.unit = "A", theme.basic = "theme_bw", ticks = "in" ) # ## simple interactive "darkgreen" voltammogram plot_ECh_VoC_amperogram(data.vat = triarylamine.data.cv, x = "E_V_app", Current = "I_A", Current.unit = "A", line.color = "darkgreen", plot.interact = TRUE )
.html
,.pdf
or .docx
Add the interactive plots (see plot_EPR_Specs2D_interact
or plot_EPR_Specs3D_interact
)
to various document formats like .html
, .pdf
or .docx
. Function is based on the
saveWidget
as well as on the webshot
with the help
of knitr package functions. Depending on the output format, plot is saved
in working/actual directory either as .html
or as .png
.
The file name inherits the name of the object/variable (see argument p
and example). Afterwards, during
the R markdown or Quarto
processing, the image is automatically attached to the document in the above-described format. Therefore, this function is quite
handy in interactive notebooks (such as .Rmd
or .qmd
, please also consult
the create_qmdReport_proj
function).
plot_EPR_present_interact(p, size.width = 7, size.height = 5, res.ppi = 200)
plot_EPR_present_interact(p, size.width = 7, size.height = 5, res.ppi = 200)
p |
Plot object/variable name. |
size.width |
Numeric, |
size.height |
Numeric, |
res.ppi |
Numeric, |
Interactive plot format corresponding to that of the output document. If the desired document
format
.html
, interactive plotly graph is saved in working/actual directory
in the same format. Otherwise, for .pdf
and .docx
it is saved as .png
bitmap with the resolution of size.with
res.ppi
x
size.height
res.ppi
.
Other Visualizations and Graphics:
draw_molecule_by_rcdk()
,
plot_EPR_Specs()
,
plot_EPR_Specs2D_interact()
,
plot_EPR_Specs3D_interact()
,
plot_EPR_Specs_integ()
,
plot_labels_xyz()
,
plot_layout2D_interact()
,
plot_theme_In_ticks()
,
plot_theme_NoY_ticks()
,
plot_theme_Out_ticks()
,
present_EPR_Sim_Spec()
## Not run: ## plotting EPR spectrum of verdazyl radical (`verdazyl.rad.data`), ## where the actual plot is stored under ## the `verdazyl.epr.plot.interact` variable name verdazyl.epr.plot.interact <- plot_EPR_Specs2D_interact(data.spectra = verdazyl.rad.data) # ## afterwards, it is automatically transformed and attached ## to document with the desired format by `knitr` plot_EPR_present_interact(verdazyl.epr.plot.interact) # ## remaining image files are stored in the working directory ## End(Not run)
## Not run: ## plotting EPR spectrum of verdazyl radical (`verdazyl.rad.data`), ## where the actual plot is stored under ## the `verdazyl.epr.plot.interact` variable name verdazyl.epr.plot.interact <- plot_EPR_Specs2D_interact(data.spectra = verdazyl.rad.data) # ## afterwards, it is automatically transformed and attached ## to document with the desired format by `knitr` plot_EPR_present_interact(verdazyl.epr.plot.interact) # ## remaining image files are stored in the working directory ## End(Not run)
Plot of EPR/ENDOR spectrum/spectra (overlay plot) based
on the ggplot2-functionality. Spectral data input must be available
as a data frame object (see also argument data.spectra
).
Theme of the visual spectrum representation as well as additional plot elements can be varied like
using the {ggplot2}
package. Within a theme, the y
ticks can be either displayed
or skipped (which is common for visualization of EPR spectra) and the intensity (e.g. dIepr_over_dB
)
is presented in "procedure defined unit" (see p.d.u.).
plot_EPR_Specs( data.spectra, x = "B_mT", x.unit = "mT", xlim = NULL, var2nd.series = NULL, var2nd.series.slct.by = NULL, Intensity = "dIepr_over_dB", Ilim = NULL, lineSpecs.form = "derivative", line.colors = "darkviolet", line.width = 0.75, line.type = 1, border.line.width = 0.5, border.line.color = "black", border.line.type = 1, theme.basic = "theme_gray", axis.title.size = 15, axis.text.size = 14, legend.title = NULL, legend.title.size = NULL, legend.text.size = NULL, grid = TRUE, yTicks = TRUE )
plot_EPR_Specs( data.spectra, x = "B_mT", x.unit = "mT", xlim = NULL, var2nd.series = NULL, var2nd.series.slct.by = NULL, Intensity = "dIepr_over_dB", Ilim = NULL, lineSpecs.form = "derivative", line.colors = "darkviolet", line.width = 0.75, line.type = 1, border.line.width = 0.5, border.line.color = "black", border.line.type = 1, theme.basic = "theme_gray", axis.title.size = 15, axis.text.size = 14, legend.title = NULL, legend.title.size = NULL, legend.text.size = NULL, grid = TRUE, yTicks = TRUE )
data.spectra |
Data frame/table object, containing magnetic flux density, |
x |
Character string, pointing to |
x.unit |
Character string, pointing to unit of |
xlim |
Numeric vector, referring to lower and upper limit of the selected |
var2nd.series |
Character string, referred to name of the second independent variable/quantity
column in the original |
var2nd.series.slct.by |
Numeric, corresponding to each |
Intensity |
Character string, pointing to |
Ilim |
Numeric vector, corresponding to limits of the selected |
lineSpecs.form |
Character string, describing either |
line.colors |
Character string, line color(s) to plot EPR spectrum/spectra.
All
|
line.width |
Numeric, linewidth of the plot line in |
line.type |
Character string or integer, corresponding to width of the (spectral) line(s). Following types
can be specified: |
border.line.width |
Numeric, width (in |
border.line.color |
Character string, referring to color of the plot graph/panel border line. Default:
|
border.line.type |
Character string or integer, corresponding to width of the plot graph/panel border line. Following types
can be specified: |
theme.basic |
Character string, calling a
|
axis.title.size |
Numeric, axis text title size in |
axis.text.size |
Numeric, text size in |
legend.title |
Character string identical to legend title, e.g. |
legend.title.size |
Numeric, legend text title size in |
legend.text.size |
Numeric, legend text size in |
grid |
Logical, whether to display the |
yTicks |
Logical, whether to display the |
Output from the plot_EPR_Specs
can be additionally combined by the +
sign with other
ggplot2
or internal plotting functions
(e.g. with plot_theme_In_ticks
). For details of ggplot2
theme elements, please
refer to Modify Components of a Theme
(see also theme
) or to
ggplot2 Elements Demonstration by Henry Wang.
The actual function does not assume a deep knowledge of ggplot2
package (as well as the grammar of graphics philosophy, see vignette("functionality")
) and literally,
one can easily start to plot from scratch (see also building plot in example of plot_theme_NoY_ticks
).
However, there is a great interactive Rstudio addin/package
called esquisse
which nicely helps to dive into the ggplot2
even for complete beginners.
EPR spectrum/spectra ('overlay') plot object (corresponding to list of plot components) using
the ggplot2
functionality, with the key parameter variations like line color, theme, grid...etc.
Other Visualizations and Graphics:
draw_molecule_by_rcdk()
,
plot_EPR_Specs2D_interact()
,
plot_EPR_Specs3D_interact()
,
plot_EPR_Specs_integ()
,
plot_EPR_present_interact()
,
plot_labels_xyz()
,
plot_layout2D_interact()
,
plot_theme_In_ticks()
,
plot_theme_NoY_ticks()
,
plot_theme_Out_ticks()
,
present_EPR_Sim_Spec()
## load the following built-in spectral data: aminoxyl.file.path <- load_data_example("Aminoxyl_radical_a.txt") ## read the aminoxyl radical spectrum without intensity ## normalization aminoxyl.data <- readEPR_Exp_Specs(aminoxyl.file.path) # ## simple plot of an EPR spectrum with B in `mT` ## and dIepr_over_dB_Sim in `p.d.u.` (derivative intensity) plot_EPR_Specs(aminoxyl.data) # ## the same spectrum with B in `G` and `theme_bw` ## ggplot2 graph theme plot_EPR_Specs(data.spectra = aminoxyl.data, x = "B_G", x.unit = "G", theme.basic = "theme_bw") # ## single integration (without baseline correction) ## of the previous spectrum by the `eval_integ_EPR_Spec` ## function aminoxyl.data.sinteg <- eval_integ_EPR_Spec(aminoxyl.data) ## plot the single integrated spectrum plot_EPR_Specs(aminoxyl.data.sinteg, x = "B_G", x.unit = "G", Intensity = "single_Integ", line.colors = "darkorange", line.type = "dashed", lineSpecs.form = "integrated") # ## loading the built-in CW ENDOR spectrum ## of perinaphthenyl (PNT) pnt.file.path <- load_data_example("PNT_ENDOR_a.txt") ## read the PNT CW ENDOR data without intensity ## normalization pnt.endor.data <- readEPR_Exp_Specs(pnt.file.path, col.names = c("index", "RF_MHz", "dIepr_over_dB"), x.unit = "MHz") ## plotting the previous ENDOR data spectrum ## in derivative form with `darkred` linecolor ## and 1.2 mm linewidth: plot_EPR_Specs(pnt.endor.data, x = "RF_MHz", x.unit = "MHz", line.colors = "darkred", line.width = 1.2) # ## loading the built-in package example to demonstrate ## visualizatioin of time series EPR spectra: triarylamine.decay.series.dsc.path <- load_data_example(file = "Triarylamine_radCat_decay_series.DSC") triarylamine.decay.series.asc.path <- load_data_example(file = "Triarylamine_radCat_decay_series.zip") unzip(triarylamine.decay.series.asc.path, exdir = tempdir() ) ## loading the kinetics: triarylamine.decay.series.data <- readEPR_Exp_Specs_kin(name.root = "Triarylamine_radCat_decay_series", dir_ASC = tempdir(), dir_dsc_par = system.file("extdata", package = "eprscope") ) # ## plot with the CONTINUOUS COLORSCALE (see argument ## `line.colors` and color definitions `1.`): plot_EPR_Specs(triarylamine.decay.series.data$df, var2nd.series = "time_s", line.colors = grDevices::hcl.colors(8,palette = "Roma"), legend.title = "Time (s)", yTicks = FALSE) # ## plot with the DISCRETE COLORSCALE (see argument ## `line.colors` and color definitions `2.`), ## each 10-th spectrum from the original plot is presented: plot_EPR_Specs(triarylamine.decay.series.data$df, var2nd.series = "time_s", var2nd.series.slct.by = 10, line.colors = c("darkblue", "darkorange", "darkviolet"), legend.title = "Time (s)") # ## Not run: ## display the variable temperature experiment selecting ## the DISCRETE COLORSCALE where all EPR spectra from ## the series are presented: plot_EPR_Specs(data.spectra, Ilim = c(-4e-3,4e-3), var2nd.series = "T_K", # temperature in Kelvins var2nd.series.slct.by = 1, line.colors = c("darkblue", "darkorange", "magenta", "steelblue"), legend.title = "Temperature (K)") ## End(Not run)
## load the following built-in spectral data: aminoxyl.file.path <- load_data_example("Aminoxyl_radical_a.txt") ## read the aminoxyl radical spectrum without intensity ## normalization aminoxyl.data <- readEPR_Exp_Specs(aminoxyl.file.path) # ## simple plot of an EPR spectrum with B in `mT` ## and dIepr_over_dB_Sim in `p.d.u.` (derivative intensity) plot_EPR_Specs(aminoxyl.data) # ## the same spectrum with B in `G` and `theme_bw` ## ggplot2 graph theme plot_EPR_Specs(data.spectra = aminoxyl.data, x = "B_G", x.unit = "G", theme.basic = "theme_bw") # ## single integration (without baseline correction) ## of the previous spectrum by the `eval_integ_EPR_Spec` ## function aminoxyl.data.sinteg <- eval_integ_EPR_Spec(aminoxyl.data) ## plot the single integrated spectrum plot_EPR_Specs(aminoxyl.data.sinteg, x = "B_G", x.unit = "G", Intensity = "single_Integ", line.colors = "darkorange", line.type = "dashed", lineSpecs.form = "integrated") # ## loading the built-in CW ENDOR spectrum ## of perinaphthenyl (PNT) pnt.file.path <- load_data_example("PNT_ENDOR_a.txt") ## read the PNT CW ENDOR data without intensity ## normalization pnt.endor.data <- readEPR_Exp_Specs(pnt.file.path, col.names = c("index", "RF_MHz", "dIepr_over_dB"), x.unit = "MHz") ## plotting the previous ENDOR data spectrum ## in derivative form with `darkred` linecolor ## and 1.2 mm linewidth: plot_EPR_Specs(pnt.endor.data, x = "RF_MHz", x.unit = "MHz", line.colors = "darkred", line.width = 1.2) # ## loading the built-in package example to demonstrate ## visualizatioin of time series EPR spectra: triarylamine.decay.series.dsc.path <- load_data_example(file = "Triarylamine_radCat_decay_series.DSC") triarylamine.decay.series.asc.path <- load_data_example(file = "Triarylamine_radCat_decay_series.zip") unzip(triarylamine.decay.series.asc.path, exdir = tempdir() ) ## loading the kinetics: triarylamine.decay.series.data <- readEPR_Exp_Specs_kin(name.root = "Triarylamine_radCat_decay_series", dir_ASC = tempdir(), dir_dsc_par = system.file("extdata", package = "eprscope") ) # ## plot with the CONTINUOUS COLORSCALE (see argument ## `line.colors` and color definitions `1.`): plot_EPR_Specs(triarylamine.decay.series.data$df, var2nd.series = "time_s", line.colors = grDevices::hcl.colors(8,palette = "Roma"), legend.title = "Time (s)", yTicks = FALSE) # ## plot with the DISCRETE COLORSCALE (see argument ## `line.colors` and color definitions `2.`), ## each 10-th spectrum from the original plot is presented: plot_EPR_Specs(triarylamine.decay.series.data$df, var2nd.series = "time_s", var2nd.series.slct.by = 10, line.colors = c("darkblue", "darkorange", "darkviolet"), legend.title = "Time (s)") # ## Not run: ## display the variable temperature experiment selecting ## the DISCRETE COLORSCALE where all EPR spectra from ## the series are presented: plot_EPR_Specs(data.spectra, Ilim = c(-4e-3,4e-3), var2nd.series = "T_K", # temperature in Kelvins var2nd.series.slct.by = 1, line.colors = c("darkblue", "darkorange", "magenta", "steelblue"), legend.title = "Temperature (K)") ## End(Not run)
eval_integ_EPR_Spec
Visualization (static plots based on ggplot2) of integrated EPR spectra
coming as data frame outputs from eval_integ_EPR_Spec
.
plot_EPR_Specs_integ( data.spectra.integ, B = "B_G", B.unit = "G", Blim = NULL, ylim = NULL, slct.integs = c("single_Integ", "baseline_Integ_fit", "single_Integ_correct"), line.width = 0.75, line.type = 1, axis.title.size = 15, axis.text.size = 14, legend.title.size = 13, legend.text.size = 11, separate.integs = FALSE, separate.integ.scales = NULL, output.df = FALSE )
plot_EPR_Specs_integ( data.spectra.integ, B = "B_G", B.unit = "G", Blim = NULL, ylim = NULL, slct.integs = c("single_Integ", "baseline_Integ_fit", "single_Integ_correct"), line.width = 0.75, line.type = 1, axis.title.size = 15, axis.text.size = 14, legend.title.size = 13, legend.text.size = 11, separate.integs = FALSE, separate.integ.scales = NULL, output.df = FALSE )
data.spectra.integ |
Data frame object, inherited output from the |
B |
Character string, pointing to magnetic flux density |
B.unit |
Character string, denoting the magnetic flux density unit e.g. |
Blim |
Numeric vector, magnetic flux density in |
ylim |
Numeric vector, corresponding to lower and upper limit of the |
slct.integs |
Character string vector, pointing to selected integrals/columns/variables (of the original
|
line.width |
Numeric, linewidth of the plot line in |
line.type |
Character string or integer, corresponding to width of the (spectral) line(s). Following types
can be specified: |
axis.title.size |
Numeric, axis text title size in |
axis.text.size |
Numeric, text size in |
legend.title.size |
Numeric, legend text title size in |
legend.text.size |
Numeric, legend text size in |
separate.integs |
Logical, should be the integrals presented in overlay mode (in one graph/panel)
or on separated panels (by |
separate.integ.scales |
Character string related to |
output.df |
Logical, whether a transformed |
Depending on output.df
argument, function returns plot object including all selected
integrated EPR spectra (output.df = FALSE
,default) or list (output.df = TRUE
)
consisting of
Data frame object with intensities of all selected integrals and magnetic flux density
variables/columns in tidy/long table format.
Plot object showing all integrated EPR spectra corresponding to df
.
Other Visualizations and Graphics:
draw_molecule_by_rcdk()
,
plot_EPR_Specs()
,
plot_EPR_Specs2D_interact()
,
plot_EPR_Specs3D_interact()
,
plot_EPR_present_interact()
,
plot_labels_xyz()
,
plot_layout2D_interact()
,
plot_theme_In_ticks()
,
plot_theme_NoY_ticks()
,
plot_theme_Out_ticks()
,
present_EPR_Sim_Spec()
## loading the package built-in example TMPD.data.path <- load_data_example(file = "TMPD_specelchem_accu_b.asc") TMPD.data <- readEPR_Exp_Specs(TMPD.data.path, col.names = c("B_G","dIepr_over_dB"), qValue = 3500, norm.vec.add = c(20,0.001), origin = "winepr") ## integration of the `TMPD` EPR spectrum TMPD.data.integs <- eval_integ_EPR_Spec(TMPD.data,sigmoid.integ = TRUE) # ## plotting integrals in overlay mode plot_EPR_Specs_integ(TMPD.data.integs, slct.integs = c("single_Integ", "sigmoid_Integ"), B = "B_mT", B.unit = "mT" ) # ## separate integrals within the plot plot_EPR_Specs_integ(TMPD.data.integs, slct.integs = c("single_Integ", "sigmoid_Integ"), B = "B_mT", B.unit = "mT", separate.integs = TRUE, separate.integ.scales = "free_y" )
## loading the package built-in example TMPD.data.path <- load_data_example(file = "TMPD_specelchem_accu_b.asc") TMPD.data <- readEPR_Exp_Specs(TMPD.data.path, col.names = c("B_G","dIepr_over_dB"), qValue = 3500, norm.vec.add = c(20,0.001), origin = "winepr") ## integration of the `TMPD` EPR spectrum TMPD.data.integs <- eval_integ_EPR_Spec(TMPD.data,sigmoid.integ = TRUE) # ## plotting integrals in overlay mode plot_EPR_Specs_integ(TMPD.data.integs, slct.integs = c("single_Integ", "sigmoid_Integ"), B = "B_mT", B.unit = "mT" ) # ## separate integrals within the plot plot_EPR_Specs_integ(TMPD.data.integs, slct.integs = c("single_Integ", "sigmoid_Integ"), B = "B_mT", B.unit = "mT", separate.integs = TRUE, separate.integ.scales = "free_y" )
Interactive visualization of EPR spectra or their integrals based on plotly package.
In the first step function takes the essential plot parts as ggplot2,
which is subsequently transferred by ggplotly
into the final interactive format.
Such plots mostly contain buttons in order to zoom,
move and select (parts of) the EPR spectra/integrals as well as to display the point values directly within
graph/panel. Additionally, plots can be exported into .png
image
or .html
formats (see also plot_EPR_present_interact
) and can optionally
also contain tools to draw lines, circles or rectangles
directly into the plot panel for annotations.
plot_EPR_Specs2D_interact( data.spectra, x = "B_mT", x.unit = "mT", Intensity = "dIepr_over_dB", var2nd.series = NULL, lineSpecs.form = "derivative", line.colors = "darkviolet", line.width = 0.75, line.type = 1, bg.color = "#e5ecf6", grid.color = "white", border.line.width = 1.2, border.line.color = "black", legend.title = NULL, legend.title.size = NULL, axis.title.size = 15, axis.text.size = 14 )
plot_EPR_Specs2D_interact( data.spectra, x = "B_mT", x.unit = "mT", Intensity = "dIepr_over_dB", var2nd.series = NULL, lineSpecs.form = "derivative", line.colors = "darkviolet", line.width = 0.75, line.type = 1, bg.color = "#e5ecf6", grid.color = "white", border.line.width = 1.2, border.line.color = "black", legend.title = NULL, legend.title.size = NULL, axis.title.size = 15, axis.text.size = 14 )
data.spectra |
Spectrum data frame/table object, containing magnetic flux density, |
x |
Character string, pointing to |
x.unit |
Character string pointing to |
Intensity |
Character string, corresponding to the intensity column header in the original |
var2nd.series |
Character string, referred to name of the second independent variable/quantity
column in the original |
lineSpecs.form |
Character string, describing either |
line.colors |
Character string (vector). In case of of SIMPLE SPECTRUM
(NOT FOR |
line.width |
Numeric, linewidth of the plot line in |
line.type |
Character string or integer, corresponding to width of the (spectral) line(s). Following types
can be specified: |
bg.color |
Character string, corresponding to background color of the panel/graph.
Available colors are listed on the CSS Color Module Homepage.
Default: |
grid.color |
Character string, corresponding to grid lines color of the panel/graph.
Available colors are listed on the CSS Color Module Homepage.
Default: |
border.line.width |
Numeric, width (in |
border.line.color |
Character string, referring to color of the plot graph/panel border line. Available colors
are listed on CSS Color Module Homepage.
Default: |
legend.title |
Character string |
legend.title.size |
Numeric, text size (in |
axis.title.size |
Numeric, text size (in |
axis.text.size |
Numeric, text size (in |
Interactive plot object of EPR spectrum/spectra based on plotly package.
Other Visualizations and Graphics:
draw_molecule_by_rcdk()
,
plot_EPR_Specs()
,
plot_EPR_Specs3D_interact()
,
plot_EPR_Specs_integ()
,
plot_EPR_present_interact()
,
plot_labels_xyz()
,
plot_layout2D_interact()
,
plot_theme_In_ticks()
,
plot_theme_NoY_ticks()
,
plot_theme_Out_ticks()
,
present_EPR_Sim_Spec()
## load built-in EPR spectral data data.file.path <- load_data_example(file = "TMPD_specelchem_accu_b.asc") ## spectrum recorded as accumulation of 20 scans data.epr <- readEPR_Exp_Specs(path_to_ASC = data.file.path, col.names = c("B_G", "dIepr_over_dB"), qValue = 3500, norm.vec.add = 20, origin = "winepr") ## interactive plot or screenshot plot_EPR_Specs2D_interact(data.spectra = data.epr) # ## loading the built-in CW ENDOR spectrum ## of perinaphthenyl (PNT) pnt.file.path <- load_data_example("PNT_ENDOR_a.txt") ## read the PNT CW ENDOR data without intensity ## normalization pnt.endor.data <- readEPR_Exp_Specs(pnt.file.path, col.names = c("index", "RF_MHz", "dIepr_over_dB"), x.unit = "MHz") ## plotting ENDOR spectrum plot_EPR_Specs2D_interact(data.spectra = pnt.endor.data, x = "RF_MHz", x.unit = "MHz", line.colors = "darkgreen", bg.color = "cornsilk", grid.color = "darkgrey") # ## Not run: ## plot time series EPR spectra = verdazyl radical ## oxidation kinetics (`verdazylRad.kinet.spectr`) plot_EPR_Specs2D_interact(verdazylRad.kinet.spectr, x = "B_G", x.unit = "G", var2nd.series = "time_s", legend.title = "<i>Time</i> (s)", line.colors = c("darkorange","darkblue") ) ## End(Not run)
## load built-in EPR spectral data data.file.path <- load_data_example(file = "TMPD_specelchem_accu_b.asc") ## spectrum recorded as accumulation of 20 scans data.epr <- readEPR_Exp_Specs(path_to_ASC = data.file.path, col.names = c("B_G", "dIepr_over_dB"), qValue = 3500, norm.vec.add = 20, origin = "winepr") ## interactive plot or screenshot plot_EPR_Specs2D_interact(data.spectra = data.epr) # ## loading the built-in CW ENDOR spectrum ## of perinaphthenyl (PNT) pnt.file.path <- load_data_example("PNT_ENDOR_a.txt") ## read the PNT CW ENDOR data without intensity ## normalization pnt.endor.data <- readEPR_Exp_Specs(pnt.file.path, col.names = c("index", "RF_MHz", "dIepr_over_dB"), x.unit = "MHz") ## plotting ENDOR spectrum plot_EPR_Specs2D_interact(data.spectra = pnt.endor.data, x = "RF_MHz", x.unit = "MHz", line.colors = "darkgreen", bg.color = "cornsilk", grid.color = "darkgrey") # ## Not run: ## plot time series EPR spectra = verdazyl radical ## oxidation kinetics (`verdazylRad.kinet.spectr`) plot_EPR_Specs2D_interact(verdazylRad.kinet.spectr, x = "B_G", x.unit = "G", var2nd.series = "time_s", legend.title = "<i>Time</i> (s)", line.colors = c("darkorange","darkblue") ) ## End(Not run)
Interactive plotting of EPR spectra or their integrals based on plotly package.
The aim of this function is to nicely visualize the series of EPR spectra (or their corresponding integrals),
while checking out the EPR intensities upon e.g. kinetic (time series), variable temperature or simultaneous
spectroelectrochemical experiments (potential series). For such purpose, the data frame input
(see the data.spectra.series
argument) is transformed into the matrix
(with columns/variables corresponding
to intensities at defined times, potentials, temperatures...etc.). In the next step the plot_ly
function generates either 3D surface or 2D contour plot objects which are finally customized
by the layout
as well as by the colorbar
. Similarly, as for
the plot_EPR_Specs2D_interact
final plots can be stored or attached to a certain document format,
using the plot_EPR_present_interact
function (or directly within Rstudio), as .png
or .html
.
plot_EPR_Specs3D_interact( data.spectra.series, x = "B_mT", Intensity = "dIepr_over_dB", var2nd.series = "time_s", plot.type = "surface", scheme.color = "Viridis", contour.labels = FALSE, xlim = NULL, xlab = "<i>B</i> (mT)", ylab = "<i>Time</i> (s)", zlab = "d <i>I</i><sub>EPR</sub> / d <i>B</i> (p.d.u.)", axis.title.size = 12, axis.text.size = 11, bg.x.color = "rgb(220, 220,220)", grid.x.color = "rgb(255, 255, 255)", bg.y.color = "rgb(220, 220,220)", grid.y.color = "rgb(255, 255, 255)", bg.z.color = "rgb(220, 220,220)", grid.z.color = "rgb(255, 255, 255)", output.matrix.df = FALSE )
plot_EPR_Specs3D_interact( data.spectra.series, x = "B_mT", Intensity = "dIepr_over_dB", var2nd.series = "time_s", plot.type = "surface", scheme.color = "Viridis", contour.labels = FALSE, xlim = NULL, xlab = "<i>B</i> (mT)", ylab = "<i>Time</i> (s)", zlab = "d <i>I</i><sub>EPR</sub> / d <i>B</i> (p.d.u.)", axis.title.size = 12, axis.text.size = 11, bg.x.color = "rgb(220, 220,220)", grid.x.color = "rgb(255, 255, 255)", bg.y.color = "rgb(220, 220,220)", grid.y.color = "rgb(255, 255, 255)", bg.z.color = "rgb(220, 220,220)", grid.z.color = "rgb(255, 255, 255)", output.matrix.df = FALSE )
data.spectra.series |
Spectrum data frame/table, object containing magnetic flux density, |
x |
Character string, pointing to |
Intensity |
Character string, corresponding to the intensity column header in the original |
var2nd.series |
Character string, referred to name of the second independent variable/quantity
column in the original |
plot.type |
Character string, inherited from |
scheme.color |
Character string, corresponding to |
contour.labels |
Logical, whether contours of intensity "hills" and "valleys" are projected
onto the |
xlim |
Numeric vector, pointing to lower and upper limit of the |
xlab |
Character string |
ylab |
Character string |
zlab |
Character string |
axis.title.size |
Numeric, text size (in |
axis.text.size |
Numeric, text size (in |
bg.x.color |
Character string, setting the background color of the |
grid.x.color |
Character string, pointing to color of |
bg.y.color |
Character string, setting the background color of the |
grid.y.color |
Character string, pointing to color of |
bg.z.color |
Character string, setting the background color of the |
grid.z.color |
Character string, pointing to color of |
output.matrix.df |
Logical, if |
Depending on output.matrix.df
, function returns either interactive plot object
(output.matrix.df = FALSE
) or if otput.matrix.df = TRUE
, it results in the list
consisting of
Interactive object plot (see below).
Associated data fame object in wide table format for subsequent processing by other graphing
software programs. It can be also quite easily transformed into the long/tidy format by the pivot_longer
.
In both cases the interactive plot can be visualized either in 3D surface mode (plot.type = "surface"
)
or in 2D contour mode with the intensity scale mapped onto the color bar (plot.type = "contour"
).
Other Visualizations and Graphics:
draw_molecule_by_rcdk()
,
plot_EPR_Specs()
,
plot_EPR_Specs2D_interact()
,
plot_EPR_Specs_integ()
,
plot_EPR_present_interact()
,
plot_labels_xyz()
,
plot_layout2D_interact()
,
plot_theme_In_ticks()
,
plot_theme_NoY_ticks()
,
plot_theme_Out_ticks()
,
present_EPR_Sim_Spec()
## loading the built-in package example to demonstrate ## visualizatioin of time series EPR spectra: triarylamine.decay.series.dsc.path <- load_data_example(file = "Triarylamine_radCat_decay_series.DSC") triarylamine.decay.series.asc.path <- load_data_example(file = "Triarylamine_radCat_decay_series.zip") unzip(triarylamine.decay.series.asc.path, exdir = tempdir() ) ## loading the kinetics: triarylamine.decay.series.data <- readEPR_Exp_Specs_kin(name.root = "Triarylamine_radCat_decay_series", dir_ASC = tempdir(), dir_dsc_par = system.file("extdata", package = "eprscope") ) # ## plot basics `surface` plot (with default arguments) ## and the `Jet` color scheme including ## Intensity contour labels plot_EPR_Specs3D_interact(triarylamine.decay.series.data$df, contour.labels = TRUE, scheme.color = "Jet") # ## plot basic `contour` plot (with default arguments) plot_EPR_Specs3D_interact(triarylamine.decay.series.data$df, plot.type = "contour") # ## Not run: ## 3D surface plotting EPR spectra series (in the region ## of <334,345> mT) from variable temperature ## (VT) experiments plot_EPR_Specs3D_interact(data.spectra.series, var2nd.series = "Temperature_K", xlim = c(334,345), contour.labels = T, ylab = "<i>Temperature</i> (K)") ## End(Not run)
## loading the built-in package example to demonstrate ## visualizatioin of time series EPR spectra: triarylamine.decay.series.dsc.path <- load_data_example(file = "Triarylamine_radCat_decay_series.DSC") triarylamine.decay.series.asc.path <- load_data_example(file = "Triarylamine_radCat_decay_series.zip") unzip(triarylamine.decay.series.asc.path, exdir = tempdir() ) ## loading the kinetics: triarylamine.decay.series.data <- readEPR_Exp_Specs_kin(name.root = "Triarylamine_radCat_decay_series", dir_ASC = tempdir(), dir_dsc_par = system.file("extdata", package = "eprscope") ) # ## plot basics `surface` plot (with default arguments) ## and the `Jet` color scheme including ## Intensity contour labels plot_EPR_Specs3D_interact(triarylamine.decay.series.data$df, contour.labels = TRUE, scheme.color = "Jet") # ## plot basic `contour` plot (with default arguments) plot_EPR_Specs3D_interact(triarylamine.decay.series.data$df, plot.type = "contour") # ## Not run: ## 3D surface plotting EPR spectra series (in the region ## of <334,345> mT) from variable temperature ## (VT) experiments plot_EPR_Specs3D_interact(data.spectra.series, var2nd.series = "Temperature_K", xlim = c(334,345), contour.labels = T, ylab = "<i>Temperature</i> (K)") ## End(Not run)
Launch this app in order to quickly check recorded EPR spectra with their instrumental parameters.
Additionally, you may try to interactively simulate the isotropic continuous wave (CW) EPR spectra
using the simple user interface based on the R Shiny and several
functions from the package (see Details
).
plot_eval_ExpSim_app()
plot_eval_ExpSim_app()
Based on the acquisition EPR spectrum origin
, in user interface, one can load a spectrum
and its instrumental/experimental parameters by the readEPR_Exp_Specs
as well as
by the readEPR_params_tabs
functions. An EPR is immediately depicted in the interactive
{plotly}
format by plot_EPR_Specs2D_interact
. The magnetic flux density
of such EPR spectrum can be changed from
mT
to G
and to g
-values. Moreover,
if the compound/radical structure is already known one can easily show its structure by entering
its corresponding SMILES
code, using the draw_molecule_by_rcdk
.
Uploaded ASCII
data (spectrum + parameters) are applied to interactively simulate
the corresponding experimental spectrum by the eval_sim_EPR_iso
and to visualize
it by the present_EPR_Sim_Spec
. Additionally, one can also print and download
the corresponding data frame/table in several formats (.csv
,.pdf
or .xls(x)
)
and thus use the data not only in R
environment but also in other programs.
## Not run: ## run the app just by the following ## command in R console: plot_eval_ExpSim_app() # ## this is an examples of the raw ## shiny R code to run the app, ## code example from the `SERVER` part: server <- function(input, output,session) { ## redefinition of `norm.vec.add` norm_vec <- reactiveValues(val = NULL) observe({ if (isTRUE(input$normVec)){ norm_vec$val <- as.numeric(unlist(strsplit(input$vecNorm,","))) } else { norm_vec$val <- NULL } }) # ## Load experimental spectrum data frame expr_data <- reactive({ # req(input$ASCIIfile) # spectr.data <- readEPR_Exp_Specs( path_to_ASC = input$ASCIIfile$datapath, col.names = switch( 3-origin.cond(orig = input$origin), c("index","B_G", "dIepr_over_dB"), c("B_G", "dIepr_over_dB"), c("B_mT","dIepr_over_dB") ), x.unit = switch( 3-origin.cond(orig = input$origin), "G", "G", "mT" ), qValue = input$qValue, origin = input$origin, norm.vec.add = norm_vec$val ) spectr.data }) # # -------------------- INTERACTIVE SPECTRUM --------------------- # output$plot <- plotly::renderPlotly({ # ## add g-Value condition: if (isTRUE(input$gval)) { expr_data_g <- expr_data() %>% dplyr::mutate(g_Value = eval_gFactor( nu.val = input$MWnuGHz, B.val = .data$B_mT )) } ...}) } ## End(Not run)
## Not run: ## run the app just by the following ## command in R console: plot_eval_ExpSim_app() # ## this is an examples of the raw ## shiny R code to run the app, ## code example from the `SERVER` part: server <- function(input, output,session) { ## redefinition of `norm.vec.add` norm_vec <- reactiveValues(val = NULL) observe({ if (isTRUE(input$normVec)){ norm_vec$val <- as.numeric(unlist(strsplit(input$vecNorm,","))) } else { norm_vec$val <- NULL } }) # ## Load experimental spectrum data frame expr_data <- reactive({ # req(input$ASCIIfile) # spectr.data <- readEPR_Exp_Specs( path_to_ASC = input$ASCIIfile$datapath, col.names = switch( 3-origin.cond(orig = input$origin), c("index","B_G", "dIepr_over_dB"), c("B_G", "dIepr_over_dB"), c("B_mT","dIepr_over_dB") ), x.unit = switch( 3-origin.cond(orig = input$origin), "G", "G", "mT" ), qValue = input$qValue, origin = input$origin, norm.vec.add = norm_vec$val ) spectr.data }) # # -------------------- INTERACTIVE SPECTRUM --------------------- # output$plot <- plotly::renderPlotly({ # ## add g-Value condition: if (isTRUE(input$gval)) { expr_data_g <- expr_data() %>% dplyr::mutate(g_Value = eval_gFactor( nu.val = input$MWnuGHz, B.val = .data$B_mT )) } ...}) } ## End(Not run)
Using physico-chemical notation of quantities or formulas (labels and titles with greek symbols,
subscript and superscript...etc) in static plots. The function is inspired by the
R-Bloggers:Math Notation
and R-Bloggers:Plotmath,
in order to simplify the writing. See also plotmath
documentation or in console
write ?plotmath
.
plot_labels_xyz(quantity, unit, user.defined = FALSE)
plot_labels_xyz(quantity, unit, user.defined = FALSE)
quantity |
Variable string without quotation (some parts of the expression can be however quoted,
see examples below), corresponding to physical quantity, which should be displayed as the (axis) title
like |
unit |
Variable String without quotation (some parts of the expression can be however quoted,
see examples below) referring to displayed physical quantity unit, like |
user.defined |
Logical, in order to bring more flexibility to customize quantities and units
to meet the users needs. Default: |
Axis labels/expressions for different plots.
Other Visualizations and Graphics:
draw_molecule_by_rcdk()
,
plot_EPR_Specs()
,
plot_EPR_Specs2D_interact()
,
plot_EPR_Specs3D_interact()
,
plot_EPR_Specs_integ()
,
plot_EPR_present_interact()
,
plot_layout2D_interact()
,
plot_theme_In_ticks()
,
plot_theme_NoY_ticks()
,
plot_theme_Out_ticks()
,
present_EPR_Sim_Spec()
## Not run: ## magnetic flux density plot_labels_xyz(B,mT) # ## derivative intensity plot_labels_xyz(d*italic(I)[EPR]~"/"~d*italic(B), "("~p.d.u.~")", user.defined = TRUE) # ## derivative intesity plot_labels_xyz(d*italic(I)[EPR]~"/"~d*italic(B),p.d.u.) # ## ∆Bpp plot_labels_xyz(quantity = Delta*B[pp], unit = "("~mT~")", user.defined = TRUE) # ## time plot_labels_xyz(t,s) # ## temperature plot_labels_xyz(T,K) # ## electrochemical potential plot_labels_xyz(E, "("~V~")"~~~italic(vs)~~~italic(Ref.~Electrode), user.defined = TRUE) # ## concentration plot_labels_xyz(c,mmol~dm^-3) # ## double integral plot_labels_xyz(Double~~Integral, p.d.u., user.defined = FALSE) # ## ENDOR frequency plot_labels_xyz(italic(nu)[RF],"("~MHz~")", user.defined = TRUE) ## End(Not run) # ## loading example data (incl. `Area` and `time` ## variables) from Xenon: decay of a triarylamine ## radical cation after its generation ## by electrochemical oxidation triaryl_radCat_path <- load_data_example(file = "Triarylamine_radCat_decay_a.txt") ## corresponding data (double integrated EPR ## spectrum = `Area` vs `time`) triaryl_radCat_data <- readEPR_Exp_Specs(triaryl_radCat_path, header = TRUE, fill = TRUE, select = c(3,7), col.names = c("time_s","Area"), x.unit = "s", x.id = 1, Intensity.id = 2, qValue = 1700, data.structure = "others") %>% na.omit() # ## simple plot of previous data using ## `plot_labels_xyz()` ggplot2::ggplot(data = triaryl_radCat_data) + ggplot2::geom_point( ggplot2::aes(x = time_s,y = Area) ) + ggplot2::labs(title = "Radical Kinetics", x = plot_labels_xyz(Time,s), y = plot_labels_xyz(Double~~Integral,p.d.u.)) + plot_theme_NoY_ticks()
## Not run: ## magnetic flux density plot_labels_xyz(B,mT) # ## derivative intensity plot_labels_xyz(d*italic(I)[EPR]~"/"~d*italic(B), "("~p.d.u.~")", user.defined = TRUE) # ## derivative intesity plot_labels_xyz(d*italic(I)[EPR]~"/"~d*italic(B),p.d.u.) # ## ∆Bpp plot_labels_xyz(quantity = Delta*B[pp], unit = "("~mT~")", user.defined = TRUE) # ## time plot_labels_xyz(t,s) # ## temperature plot_labels_xyz(T,K) # ## electrochemical potential plot_labels_xyz(E, "("~V~")"~~~italic(vs)~~~italic(Ref.~Electrode), user.defined = TRUE) # ## concentration plot_labels_xyz(c,mmol~dm^-3) # ## double integral plot_labels_xyz(Double~~Integral, p.d.u., user.defined = FALSE) # ## ENDOR frequency plot_labels_xyz(italic(nu)[RF],"("~MHz~")", user.defined = TRUE) ## End(Not run) # ## loading example data (incl. `Area` and `time` ## variables) from Xenon: decay of a triarylamine ## radical cation after its generation ## by electrochemical oxidation triaryl_radCat_path <- load_data_example(file = "Triarylamine_radCat_decay_a.txt") ## corresponding data (double integrated EPR ## spectrum = `Area` vs `time`) triaryl_radCat_data <- readEPR_Exp_Specs(triaryl_radCat_path, header = TRUE, fill = TRUE, select = c(3,7), col.names = c("time_s","Area"), x.unit = "s", x.id = 1, Intensity.id = 2, qValue = 1700, data.structure = "others") %>% na.omit() # ## simple plot of previous data using ## `plot_labels_xyz()` ggplot2::ggplot(data = triaryl_radCat_data) + ggplot2::geom_point( ggplot2::aes(x = time_s,y = Area) ) + ggplot2::labs(title = "Radical Kinetics", x = plot_labels_xyz(Time,s), y = plot_labels_xyz(Double~~Integral,p.d.u.)) + plot_theme_NoY_ticks()
Additional customization of interactive 2D plots (see also plot_EPR_Specs2D_interact
).
The main goal is to simplify setting up process of the layout
via several nested lists
.
Mostly, it nicely works (using the %>%
) either with the general plot_ly
or the above-mentioned plot_EPR_Specs2D_interact
(see also Examples
).
plot_layout2D_interact( p, data = NULL, xlab = "<i>B</i> (mT)", ylab = "d <i>I</i> <sub>EPR</sub> / d <i>B</i> (p.d.u.)", axis.title.x.family = "Arial", axis.title.x.color = "black", axis.title.x.size = 15, axis.text.x.family = "Arial", axis.text.x.color = "black", axis.text.x.size = 14, axis.title.y.family = "Arial", axis.title.y.color = "black", axis.title.y.size = 15, axis.text.y.family = "Arial", axis.text.y.color = "black", axis.text.y.size = 14, legend.title = NULL, legend.title.family = "Arial", legend.title.color = "black", legend.title.size = 13, bg.color = "#e5ecf6", grid.x = TRUE, grid.y = TRUE, grid.color = "white", grid.line.width = 1, grid.line.type = "solid", border.line.width = 1.4, border.line.color = "black" )
plot_layout2D_interact( p, data = NULL, xlab = "<i>B</i> (mT)", ylab = "d <i>I</i> <sub>EPR</sub> / d <i>B</i> (p.d.u.)", axis.title.x.family = "Arial", axis.title.x.color = "black", axis.title.x.size = 15, axis.text.x.family = "Arial", axis.text.x.color = "black", axis.text.x.size = 14, axis.title.y.family = "Arial", axis.title.y.color = "black", axis.title.y.size = 15, axis.text.y.family = "Arial", axis.text.y.color = "black", axis.text.y.size = 14, legend.title = NULL, legend.title.family = "Arial", legend.title.color = "black", legend.title.size = 13, bg.color = "#e5ecf6", grid.x = TRUE, grid.y = TRUE, grid.color = "white", grid.line.width = 1, grid.line.type = "solid", border.line.width = 1.4, border.line.color = "black" )
p |
|
data |
Data frame object in order to associate with the layout (optional). If not provided, arguments are evaluated
using the data frame in |
xlab |
Character string |
ylab |
Character string |
axis.title.x.family |
Character string, setting the font of the |
axis.title.x.color |
Character string, pointing to color of the |
axis.title.x.size |
Numeric, setting up the size of the |
axis.text.x.family |
Character string, setting the font of the |
axis.text.x.color |
Character string, pointing to color of the |
axis.text.x.size |
Numeric, setting up the size of the |
axis.title.y.family |
Character string, setting the font of the |
axis.title.y.color |
Character string, pointing to color of the |
axis.title.y.size |
Numeric, setting up the size of the |
axis.text.y.family |
Character string, setting the font of the |
axis.text.y.color |
Character string, pointing to color of the |
axis.text.y.size |
Numeric, setting up the size of the |
legend.title |
Character string |
legend.title.family |
Character string, setting the font of the legend title. Following |
legend.title.color |
Character string pointing to color of the legend title font, default:
|
legend.title.size |
Numeric, text size (in |
bg.color |
Character string, corresponding to background color of the panel/graph.
Available colors are listed on the CSS Color Module Homepage.
Default: |
grid.x |
Logical, whether to show ( |
grid.y |
Logical, whether to show ( |
grid.color |
Character string, corresponding to grid lines color of the panel/graph.
Available colors are listed on the CSS Color Module Homepage.
Default: |
grid.line.width |
Numeric, width (in |
grid.line.type |
Character string, corresponding to type of the grid line. In addition to |
border.line.width |
Numeric, width (in |
border.line.color |
Character string, referring to color of the plot graph/panel border line. Available colors
are listed on CSS Color Module Homepage.
Default: |
List of the interactive plot object properties/parts, which can be used in connection with
plot_EPR_Specs2D_interact
or plot_ly
.
Other Visualizations and Graphics:
draw_molecule_by_rcdk()
,
plot_EPR_Specs()
,
plot_EPR_Specs2D_interact()
,
plot_EPR_Specs3D_interact()
,
plot_EPR_Specs_integ()
,
plot_EPR_present_interact()
,
plot_labels_xyz()
,
plot_theme_In_ticks()
,
plot_theme_NoY_ticks()
,
plot_theme_Out_ticks()
,
present_EPR_Sim_Spec()
## example from `plot_EPR_Specs2D_interact()` ## loading the built-in CW ENDOR spectrum ## of perinaphthenyl (PNT) pnt.file.path <- load_data_example("PNT_ENDOR_a.txt") ## read the PNT CW ENDOR data without intensity ## normalization pnt.endor.data <- readEPR_Exp_Specs(pnt.file.path, col.names = c("index", "RF_MHz", "dIepr_over_dB"), x.unit = "MHz") ## plotting ENDOR spectrum plot_EPR_Specs2D_interact(data.spectra = pnt.endor.data, x = "RF_MHz", x.unit = "MHz", line.colors = "darkgreen", bg.color = "cornsilk", grid.color = "darkgrey") %>% plot_layout2D_interact(xlab = "<i>ν</i><sub>RF</sub> (MHz)", axis.title.x.family = "Times New Roman", axis.title.y.family = "Times New Roman", border.line.color = "blue", grid.y = FALSE )
## example from `plot_EPR_Specs2D_interact()` ## loading the built-in CW ENDOR spectrum ## of perinaphthenyl (PNT) pnt.file.path <- load_data_example("PNT_ENDOR_a.txt") ## read the PNT CW ENDOR data without intensity ## normalization pnt.endor.data <- readEPR_Exp_Specs(pnt.file.path, col.names = c("index", "RF_MHz", "dIepr_over_dB"), x.unit = "MHz") ## plotting ENDOR spectrum plot_EPR_Specs2D_interact(data.spectra = pnt.endor.data, x = "RF_MHz", x.unit = "MHz", line.colors = "darkgreen", bg.color = "cornsilk", grid.color = "darkgrey") %>% plot_layout2D_interact(xlab = "<i>ν</i><sub>RF</sub> (MHz)", axis.title.x.family = "Times New Roman", axis.title.y.family = "Times New Roman", border.line.color = "blue", grid.y = FALSE )
ggplot2
Theme with Axis Ticks Oriented Inside the PanelChange the ggplot2-based theme in order to meet the needs
of graph (such as EPR spectrum, kinetic profiles...etc)
visuals/non-data components of the actual plot. Theme can be mainly applied
for the basic ggplot2 components like
ggplot() + geom_...() + ...
and consists of highlighted panel borders, grid and axis ticks pointing
inside the graph/plot panel. For details of ggplot2
theme elements please,
refer to Modify Components of a Theme
(see also the theme
) or to
ggplot2 Elements Demonstration by Henry Wang.
plot_theme_In_ticks( axis.text.size = 14, axis.title.size = 15, grid = TRUE, border.line.color = "black", border.line.type = 1, border.line.width = 0.5, bg.transparent = FALSE, ... )
plot_theme_In_ticks( axis.text.size = 14, axis.title.size = 15, grid = TRUE, border.line.color = "black", border.line.type = 1, border.line.width = 0.5, bg.transparent = FALSE, ... )
axis.text.size |
Numeric, text size (in |
axis.title.size |
Numeric, text size (in |
grid |
Logical, whether to display the |
border.line.color |
Character string, setting up the color of the plot panel border line, default:
|
border.line.type |
Character string or integer, corresponding to width of the graph/plot panel border line. Following types
can be specified: |
border.line.width |
Numeric, width (in |
bg.transparent |
Logical, whether the entire plot background (excluding the panel)
should be transparent, default: |
... |
additional arguments specified by the |
Custom ggplot2 theme
(list) with x,y-axis
ticks pointing inside the graph/plot panel.
Other Visualizations and Graphics:
draw_molecule_by_rcdk()
,
plot_EPR_Specs()
,
plot_EPR_Specs2D_interact()
,
plot_EPR_Specs3D_interact()
,
plot_EPR_Specs_integ()
,
plot_EPR_present_interact()
,
plot_labels_xyz()
,
plot_layout2D_interact()
,
plot_theme_NoY_ticks()
,
plot_theme_Out_ticks()
,
present_EPR_Sim_Spec()
## loading the aminoxyl radical CW EPR spectrum: aminoxyl.data.path <- load_data_example(file = "Aminoxyl_radical_a.txt") aminoxyl.data <- readEPR_Exp_Specs(aminoxyl.data.path, qValue = 2100) # ## simple `ggplot2` without any theme customization ggplot2::ggplot(data = aminoxyl.data) + ggplot2::geom_line( ggplot2::aes(x = B_mT,y = dIepr_over_dB) ) # ## simple `ggplot2` with `in-ticks` theme and tile ggplot2::ggplot(data = aminoxyl.data) + ggplot2::geom_line( ggplot2::aes(x = B_mT,y = dIepr_over_dB) ) + plot_theme_In_ticks() + ggplot2::ggtitle( label = "EPR Spectrum of Aminoxyl Radical" ) # ## basic EPR spectrum plot by the `plot_EPR_Specs()` plot_EPR_Specs(data.spectra = aminoxyl.data) # ## previous spectrum combined with `in-ticks` theme ## without the panel background plot_EPR_Specs(data.spectra = aminoxyl.data) + plot_theme_In_ticks( panel.background = ggplot2::element_blank() )
## loading the aminoxyl radical CW EPR spectrum: aminoxyl.data.path <- load_data_example(file = "Aminoxyl_radical_a.txt") aminoxyl.data <- readEPR_Exp_Specs(aminoxyl.data.path, qValue = 2100) # ## simple `ggplot2` without any theme customization ggplot2::ggplot(data = aminoxyl.data) + ggplot2::geom_line( ggplot2::aes(x = B_mT,y = dIepr_over_dB) ) # ## simple `ggplot2` with `in-ticks` theme and tile ggplot2::ggplot(data = aminoxyl.data) + ggplot2::geom_line( ggplot2::aes(x = B_mT,y = dIepr_over_dB) ) + plot_theme_In_ticks() + ggplot2::ggtitle( label = "EPR Spectrum of Aminoxyl Radical" ) # ## basic EPR spectrum plot by the `plot_EPR_Specs()` plot_EPR_Specs(data.spectra = aminoxyl.data) # ## previous spectrum combined with `in-ticks` theme ## without the panel background plot_EPR_Specs(data.spectra = aminoxyl.data) + plot_theme_In_ticks( panel.background = ggplot2::element_blank() )
ggplot2
Theme without Y
Axis TicksChange the ggplot2-based theme in order
to meet the needs of graph (such as EPR spectrum, kinetic profiles...etc)
visuals/non-data components of the actual graph/plot. The theme can be mainly applied for the basic ggplot2
components like
ggplot() + geom_...() + ...
and consists of highlighted panel borders, grid and x-axis ticks pointing
inside the plot panel. The y-axis ticks are skipped (see also plot_EPR_Specs
).
For details of ggplot2
theme elements please,
refer to Modify Components of a Theme
(see also theme
) or to
ggplot2 Elements Demonstration by Henry Wang.
plot_theme_NoY_ticks( axis.text.size = 14, axis.title.size = 15, grid = TRUE, border.line.color = "black", border.line.type = 1, border.line.width = 0.5, bg.transparent = FALSE, ... )
plot_theme_NoY_ticks( axis.text.size = 14, axis.title.size = 15, grid = TRUE, border.line.color = "black", border.line.type = 1, border.line.width = 0.5, bg.transparent = FALSE, ... )
axis.text.size |
Numeric, text size (in |
axis.title.size |
Numeric, text size (in |
grid |
Logical, whether to display the |
border.line.color |
Character string, setting up the color of the plot panel border line, default:
|
border.line.type |
Character string or integer, corresponding to width of the graph/plot panel border line. Following types
can be specified: |
border.line.width |
Numeric, width (in |
bg.transparent |
Logical, whether the entire plot background (excluding the panel)
should be transparent, default: |
... |
additional arguments specified by the |
Custom ggplot2 theme
(list) with x-axis
ticks pointing inside the graph/plot panel,
and with y-ticks
being not displayed.
Other Visualizations and Graphics:
draw_molecule_by_rcdk()
,
plot_EPR_Specs()
,
plot_EPR_Specs2D_interact()
,
plot_EPR_Specs3D_interact()
,
plot_EPR_Specs_integ()
,
plot_EPR_present_interact()
,
plot_labels_xyz()
,
plot_layout2D_interact()
,
plot_theme_In_ticks()
,
plot_theme_Out_ticks()
,
present_EPR_Sim_Spec()
#' ## loading the aminoxyl radical CW EPR spectrum: aminoxyl.data.path <- load_data_example(file = "Aminoxyl_radical_a.txt") aminoxyl.data <- readEPR_Exp_Specs(aminoxyl.data.path, qValue = 2100) # ## simple `ggplot2` without any theme customization ggplot2::ggplot(data = aminoxyl.data) + ggplot2::geom_line( ggplot2::aes(x = B_mT,y = dIepr_over_dB) ) # ## simple `ggplot2` with `noY-ticks` theme and tile ## (+subtitle) ggplot2::ggplot(data = aminoxyl.data) + ggplot2::geom_line( ggplot2::aes(x = B_mT,y = dIepr_over_dB) ) + plot_theme_NoY_ticks() + ggplot2::ggtitle(label = "Aminoxyl Radical", subtitle = "EPR Spectrum") # ## comparison of EPR spectra generated ## by `plot_EPR_Specs()` and by the simple ## `ggplot2` with `noY-ticks` theme plot_EPR_Specs(data.spectra = aminoxyl.data, yTicks = FALSE) + ggplot2::ggtitle(label = "Aminoxyl Radical", subtitle = "EPR Spectrum") # ## loading example data (incl. `Area` and `time` ## variables) from Xenon: decay of a triarylamine ## radical cation after its generation ## by electrochemical oxidation triaryl_radCat_path <- load_data_example(file = "Triarylamine_radCat_decay_a.txt") ## corresponding data (double integrated EPR ## spectrum = `Area` vs `time`) triaryl_radCat_data <- readEPR_Exp_Specs(triaryl_radCat_path, header = TRUE, fill = TRUE, select = c(3,7), col.names = c("time_s","Area"), x.unit = "s", x.id = 1, Intensity.id = 2, qValue = 1700, data.structure = "others") %>% na.omit() # ## simple plot of previous data using ## the `noY-ticks` theme ggplot2::ggplot(data = triaryl_radCat_data) + ggplot2::geom_point( ggplot2::aes(x = time_s,y = Area) ) + ggplot2::labs(title = "Radical Kinetics", x = plot_labels_xyz(Time,s), y = plot_labels_xyz(Double~~Integral,p.d.u.)) + plot_theme_NoY_ticks()
#' ## loading the aminoxyl radical CW EPR spectrum: aminoxyl.data.path <- load_data_example(file = "Aminoxyl_radical_a.txt") aminoxyl.data <- readEPR_Exp_Specs(aminoxyl.data.path, qValue = 2100) # ## simple `ggplot2` without any theme customization ggplot2::ggplot(data = aminoxyl.data) + ggplot2::geom_line( ggplot2::aes(x = B_mT,y = dIepr_over_dB) ) # ## simple `ggplot2` with `noY-ticks` theme and tile ## (+subtitle) ggplot2::ggplot(data = aminoxyl.data) + ggplot2::geom_line( ggplot2::aes(x = B_mT,y = dIepr_over_dB) ) + plot_theme_NoY_ticks() + ggplot2::ggtitle(label = "Aminoxyl Radical", subtitle = "EPR Spectrum") # ## comparison of EPR spectra generated ## by `plot_EPR_Specs()` and by the simple ## `ggplot2` with `noY-ticks` theme plot_EPR_Specs(data.spectra = aminoxyl.data, yTicks = FALSE) + ggplot2::ggtitle(label = "Aminoxyl Radical", subtitle = "EPR Spectrum") # ## loading example data (incl. `Area` and `time` ## variables) from Xenon: decay of a triarylamine ## radical cation after its generation ## by electrochemical oxidation triaryl_radCat_path <- load_data_example(file = "Triarylamine_radCat_decay_a.txt") ## corresponding data (double integrated EPR ## spectrum = `Area` vs `time`) triaryl_radCat_data <- readEPR_Exp_Specs(triaryl_radCat_path, header = TRUE, fill = TRUE, select = c(3,7), col.names = c("time_s","Area"), x.unit = "s", x.id = 1, Intensity.id = 2, qValue = 1700, data.structure = "others") %>% na.omit() # ## simple plot of previous data using ## the `noY-ticks` theme ggplot2::ggplot(data = triaryl_radCat_data) + ggplot2::geom_point( ggplot2::aes(x = time_s,y = Area) ) + ggplot2::labs(title = "Radical Kinetics", x = plot_labels_xyz(Time,s), y = plot_labels_xyz(Double~~Integral,p.d.u.)) + plot_theme_NoY_ticks()
ggplot2
Theme with Axis Ticks Oriented Outside the PanelChange the ggplot2-based theme in order to meet the needs
of graph (such as EPR spectrum, kinetic profiles...etc)
visuals/non-data components of the actual graph/plot. The theme can be mainly applied for the basic
ggplot2
components like ggplot() + geom_...() + ...
and consists of highlighted panel borders,
grid and axis ticks pointing outside of the plot panel. For details of ggplot2
theme elements please,
refer to Modify Components of a Theme
(see also theme
) or to
ggplot2 Elements Demonstration by Henry Wang.
plot_theme_Out_ticks( axis.text.size = 14, axis.title.size = 15, grid = TRUE, border.line.color = "black", border.line.type = 1, border.line.width = 0.5, bg.transparent = FALSE, ... )
plot_theme_Out_ticks( axis.text.size = 14, axis.title.size = 15, grid = TRUE, border.line.color = "black", border.line.type = 1, border.line.width = 0.5, bg.transparent = FALSE, ... )
axis.text.size |
Numeric, text size (in |
axis.title.size |
Numeric, text size (in |
grid |
Logical, whether to display the |
border.line.color |
Character string, setting up the color of the plot panel border line, default:
|
border.line.type |
Character string or integer, corresponding to width of the graph/plot panel border line. Following types
can be specified: |
border.line.width |
Numeric, width (in |
bg.transparent |
Logical, whether the entire plot background (excluding the panel)
should be transparent, default: |
... |
additional arguments specified by the |
Custom ggplot2
theme
(list) with x,y-axis
ticks pointing outside of the graph/plot panel.
Other Visualizations and Graphics:
draw_molecule_by_rcdk()
,
plot_EPR_Specs()
,
plot_EPR_Specs2D_interact()
,
plot_EPR_Specs3D_interact()
,
plot_EPR_Specs_integ()
,
plot_EPR_present_interact()
,
plot_labels_xyz()
,
plot_layout2D_interact()
,
plot_theme_In_ticks()
,
plot_theme_NoY_ticks()
,
present_EPR_Sim_Spec()
## loading TMPD built-in example file: tmpd.data.file.path <- load_data_example(file = "TMPD_specelchem_accu_b.asc") ## reading data: tmpd.data.file <- readEPR_Exp_Specs(path_to_ASC = tmpd.data.file.path, col.names = c("B_G","dIepr_over_dB"), qValue = 3500, norm.vec.add = 20, origin = "winepr") # ggplot2::ggplot(data = tmpd.data.file, ggplot2::aes(x = B_G,y = dIepr_over_dB) ) + ggplot2::geom_line(linewidth = 0.75,color = "darkgreen") + ggplot2::xlab("B (G)") + ggplot2::ylab("dIepr / dB (p.d.u.)") + plot_theme_Out_ticks()
## loading TMPD built-in example file: tmpd.data.file.path <- load_data_example(file = "TMPD_specelchem_accu_b.asc") ## reading data: tmpd.data.file <- readEPR_Exp_Specs(path_to_ASC = tmpd.data.file.path, col.names = c("B_G","dIepr_over_dB"), qValue = 3500, norm.vec.add = 20, origin = "winepr") # ggplot2::ggplot(data = tmpd.data.file, ggplot2::aes(x = B_G,y = dIepr_over_dB) ) + ggplot2::geom_line(linewidth = 0.75,color = "darkgreen") + ggplot2::xlab("B (G)") + ggplot2::ylab("dIepr / dB (p.d.u.)") + plot_theme_Out_ticks()
Presenting experimental as well as simulated/fitted EPR spectra together
in one ggplot2 object. They are visualized
in two possible modes. Despite the fact that quite often two spectra are compared in overlay mode,
sometimes it is rather difficult to figure out differences between the experimental
and the simulated EPR spectrum by such manner (the details can be "hidden" in overlays).
Therefore, there is also an option to offset the EPR simulated spectrum underneath the experimental
one, see argument Intensity.shift.ratio
. For the sake of presentation, the maximum-minimum
intensity difference, of the simulated spectrum, is automatically scaled onto
the experimental one.
present_EPR_Sim_Spec( data.spectr.expr, data.spectr.sim, B.unit = "G", Intensity.expr = "dIepr_over_dB", Intensity.sim = "dIeprSim_over_dB", Intensity.shift.ratio = 1.2, B.shift = 0, lineSpecs.form = "derivative", line.color.expr = "red", line.color.sim = "blue", line.width = 0.75, output.df = FALSE )
present_EPR_Sim_Spec( data.spectr.expr, data.spectr.sim, B.unit = "G", Intensity.expr = "dIepr_over_dB", Intensity.sim = "dIeprSim_over_dB", Intensity.shift.ratio = 1.2, B.shift = 0, lineSpecs.form = "derivative", line.color.expr = "red", line.color.sim = "blue", line.width = 0.75, output.df = FALSE )
data.spectr.expr |
Data frame object related to experimental spectrum, including the magnetic flux
density (in |
data.spectr.sim |
Data frame object related to experimental spectrum including the magnetic flux
density (in |
B.unit |
Character string, pointing to unit of magnetic flux density (coming from the original
datasets) which is to be presented on |
Intensity.expr |
Character string, referring to intensity column name if other
than |
Intensity.sim |
Character string, referring to intensity column name of the simulated spectrum
if other than |
Intensity.shift.ratio |
Numeric (CANNOT BE |
B.shift |
Numeric, difference between the |
lineSpecs.form |
Character string, describing either |
line.color.expr |
Character string, line color to plot simple EPR spectrum. All |
line.color.sim |
Character string, line color to plot simple EPR spectrum. All |
line.width |
Numeric, linewidth of the plot line in |
output.df |
Logical, whether the data frame, corresponding to graphic spectra comparison
(this actually corresponds to merging of the above-mentioned data frames
by |
Plot object (list) of the experimental and the simulated EPR (in derivative or integrated form)
spectrum or list
consisting of plot
and the corresponding data frame df
.
Any output plot corresponds to simple ggplot2
object and can be combined with a desired theme
(e.g. with plot_theme_NoY_ticks
, see also Examples
).
Other Visualizations and Graphics:
draw_molecule_by_rcdk()
,
plot_EPR_Specs()
,
plot_EPR_Specs2D_interact()
,
plot_EPR_Specs3D_interact()
,
plot_EPR_Specs_integ()
,
plot_EPR_present_interact()
,
plot_labels_xyz()
,
plot_layout2D_interact()
,
plot_theme_In_ticks()
,
plot_theme_NoY_ticks()
,
plot_theme_Out_ticks()
## load package built-in EPR spectral ## data example: data.file.path <- load_data_example(file = "TMPD_specelchem_accu_b.asc") data.spectrum.expr <- readEPR_Exp_Specs(path_to_ASC = data.file.path, col.names = c("B_G", "dIepr_over_dB"), qValue = 3500, origin = "winepr" ) # ## instrumental parameters for the spectrum, ## by the `WinEPR` spectrometer software tmpd.params.file <- load_data_example(file = "TMPD_specelchem_accu_b.par") # ## simulation of the TMPD radical cation ## EPR spectrum data.spectrum.sim <- eval_sim_EPR_iso(g.iso = 2.00303, instrum.params = NULL, path_to_dsc_par = tmpd.params.file, origin = "winepr", nuclear.system = list( list("14N", 2, 19.29), list("1H", 4, 5.49), list("1H", 12, 19.66) ), lineGL.DeltaB = list(0.48, 0.32), lineG.content = 0.5, ) # ## comparison of both spectra ## by the simulated spectrum offset present_EPR_Sim_Spec( data.spectr.expr = data.spectrum.expr, data.spectr.sim = data.spectrum.sim$df ) + plot_theme_NoY_ticks(legend.text = ggplot2::element_text(size = 13) ) # ## comparison of both spectra ## in overlay mode present_EPR_Sim_Spec( data.spectr.expr = data.spectrum.expr, data.spectr.sim = data.spectrum.sim$df, Intensity.shift.ratio = NULL, ) + plot_theme_NoY_ticks(legend.text = ggplot2::element_text(size = 13) )
## load package built-in EPR spectral ## data example: data.file.path <- load_data_example(file = "TMPD_specelchem_accu_b.asc") data.spectrum.expr <- readEPR_Exp_Specs(path_to_ASC = data.file.path, col.names = c("B_G", "dIepr_over_dB"), qValue = 3500, origin = "winepr" ) # ## instrumental parameters for the spectrum, ## by the `WinEPR` spectrometer software tmpd.params.file <- load_data_example(file = "TMPD_specelchem_accu_b.par") # ## simulation of the TMPD radical cation ## EPR spectrum data.spectrum.sim <- eval_sim_EPR_iso(g.iso = 2.00303, instrum.params = NULL, path_to_dsc_par = tmpd.params.file, origin = "winepr", nuclear.system = list( list("14N", 2, 19.29), list("1H", 4, 5.49), list("1H", 12, 19.66) ), lineGL.DeltaB = list(0.48, 0.32), lineG.content = 0.5, ) # ## comparison of both spectra ## by the simulated spectrum offset present_EPR_Sim_Spec( data.spectr.expr = data.spectrum.expr, data.spectr.sim = data.spectrum.sim$df ) + plot_theme_NoY_ticks(legend.text = ggplot2::element_text(size = 13) ) # ## comparison of both spectra ## in overlay mode present_EPR_Sim_Spec( data.spectr.expr = data.spectrum.expr, data.spectr.sim = data.spectrum.sim$df, Intensity.shift.ratio = NULL, ) + plot_theme_NoY_ticks(legend.text = ggplot2::element_text(size = 13) )
Estimate the number (or concentration) of "spins"/radicals/paramagnetic species using the absolute quantitative method by sigmoid integral as well as by the instrumental parameters without the need for a standard sample with known concentration/amount of radicals/"spins". The calculation assumes that the sample height middle point, within an EPR tube, matches the cavity/resonator center.
quantify_EPR_Abs( integ.sigmoid.max, instrum.params = NULL, path_to_dsc_par, origin = "xenon", qValue = NULL, tube.sample.id.mm, point.sample.factor = 8.51e-09, fill.sample.h.mm, eff.cavity.h.mm = 23, fn.B1.Bm.fit.y = c(1.00179, -0.00307086, -0.0265409, 0.000297603, 0.000223277, -4.53833e-06, -4.1451e-07, 1.89417e-08, -1.48241e-09), fn.B1.Bm.fit.y.max = 0.28, Norm.const = NULL, Temp.K = NULL, S = 0.5 )
quantify_EPR_Abs( integ.sigmoid.max, instrum.params = NULL, path_to_dsc_par, origin = "xenon", qValue = NULL, tube.sample.id.mm, point.sample.factor = 8.51e-09, fill.sample.h.mm, eff.cavity.h.mm = 23, fn.B1.Bm.fit.y = c(1.00179, -0.00307086, -0.0265409, 0.000297603, 0.000223277, -4.53833e-06, -4.1451e-07, 1.89417e-08, -1.48241e-09), fn.B1.Bm.fit.y.max = 0.28, Norm.const = NULL, Temp.K = NULL, S = 0.5 )
integ.sigmoid.max |
Numeric value or vector of the entire EPR spectrum sigmoid integral. |
|||||||||
instrum.params |
Named numeric vector, containing instrumental parameters required for the quantification =>
Default: |
|||||||||
path_to_dsc_par |
Character string, path (can be also acquired by the |
|||||||||
origin |
Character string, corresponding to software which was used to obtain the EPR spectra
on spectrometers, because the files are slightly different, whether they
were recorded by the "WinEpr" ( |
|||||||||
qValue |
Numeric value of the sensitivity |
|||||||||
tube.sample.id.mm |
Numeric value, which equals to internal diameter (in |
|||||||||
point.sample.factor |
Numeric value, corresponding to point sample correction factor, provided by the cavity/probehead manufacturer. Value for the standard Bruker rectangular cavity is set as default. |
|||||||||
fill.sample.h.mm |
Numeric value, referring to sample height (in |
|||||||||
eff.cavity.h.mm |
Numeric value, which equals to effective cavity/probehead height/length, usually provided by the probehead manufacturer. |
|||||||||
fn.B1.Bm.fit.y |
Numeric vector (coefficients) of the polynomial degree from 5 to 12. Coefficients for the standard Bruker rectangular cavity are set as default. |
|||||||||
fn.B1.Bm.fit.y.max |
Numeric value, corresponding to maximum value of the polynomial fit. Value for the standard Bruker rectangular cavity is set as default. |
|||||||||
Norm.const |
Numeric value, corresponding to normalization constant (see
|
|||||||||
Temp.K |
Numeric value, temperature value in |
|||||||||
S |
Numeric value, total spin sample quantum number. For radicals |
There are two approaches how to quantify the number of paramagnetic species/radicals/spins.
The relative one needs a standard sample with a known spin number and can be evaluated
by the sigmoid integral ratio of the sample under study and that of the standard.
While the absolute method do not need the reference sample, it requires
a precise cavity signal calibration as well as standardized cell geometry. Both are provided
by the EPR instrument and lab-glass manufacturers (see e.g. Hirschmann-Laborgeräte (2023), References
).
In case of absolute quantitative EPR analysis the sigmoid integral (its maximum value),
,can be used to calculate the number of "spins"/radicals/paramagnetic species,
(see also
References
) =>
where the quantity notations possess the following meaning (parentheses denote whether it is an instrumental or sample dependent parameter):
Quantity Symbol | Meaning/Short Desription |
|
Point sample calibration factor (instrumental). |
|
Spatial distribution of the microwave and modulation
amplitude within the cavity/probehead/resonator (instrumental). |
|
Receiver gain (commonly in units (instrumental)). |
|
Conversion time (commonly in ) which is an analogy
to integration time in other spectroscopies (instrumental). |
|
Number of scans/accumulations during the experiment (instrumental). |
|
Microwave power (instrumental). |
|
Modulation amplitude (instrumental). |
|
Q-Value or Q-Factor characterizing the resonator/cavity/probehead sensitivity (unitless and instrumental). |
|
Boltzmann factor for temperature dependence (instrumental-sample). |
|
Total electronic spin quantum number (sample). Commonly, for radicals . |
Almost all summarized quantities are instrument-dependent. Most of them correspond to the essential
parameters for the experiment and can be easily acquired from the .DSC
/.dsc
/.par
file(s).
The Boltzmann factor describes the population of spin states
by , where
denotes
the energy difference between the basic spin states,
is the Boltzmann constant
(available from
syms
) and the represents the temperature in
.
For temperatures
and continuous wave experiments where
the
is constant, this factor may be very well estimated
by the following formula:
The term actually corresponds to normalization constant
which is available from
quantify_EPR_Norm_const
.
Besides the above-described parameters which can be easily estimated, there are however characteristics
that requires precise calibration and usually are provided by the spectrometer manufacturers.
The spatial distribution of the microwave, , and modulation
amplitude,
, influences the intensity of the sample predominantly along the
-axis direction
(i.e. when moving the sample tube up or down within the cavity). Such intensity distribution,
depending on the cavity/probehead for different sample length and positions, can be approximated by a polynomial
(see the
fn.B1.Bm.fit.y
argument) that is supplied by the manufacturer as well (the coefficients
of the polynomial can be sometimes found in .DSC
/.dsc
/.par
file(s)). For quantitative
purposes, such polynomial is integrated over the length of the sample.
List of the following quantities:
Number of spins per effective centimeter. It is defined
as the cm around the maximum, , of the intensity
distribution curve/polynomial fit within the cavity
from
the equation shown in
Details
.
Number of spins per .
Concentration of spins/radicals in .
Eaton GR, Eaton SS, Barr DP, Weber RT (2010). Quantitative EPR. Springer Science and Business Media. ISBN 978-3-211-92947-6, https://link.springer.com/book/10.1007/978-3-211-92948-3.
Weber RT (2011). Xenon User's Guide. Bruker BioSpin Manual Version 1.3, Software Version 1.1b50.
Hirschmann-Laborgeräte (2023). “Ringcaps.” https://hirschmannlab.de/en/produkt/ringcaps/.
Mazúr M, Valko M, Morris H (2000). “Analysis of the Radial and Longitudinal Effect in a Double TE104 and a Single TE102 Rectangular Cavity.” J. Magn. Reson., 142(1), 37–56. ISSN 1090-7807, https://doi.org/10.1006/jmre.1999.1915.
Portis AM (1953). “Electronic Structure ofF Centers: Saturation of the Electron Spin Resonance.” Phys. Rev., 91(5), 1071–1078, https://doi.org/10.1103/PhysRev.91.1071.
Mailer C, Sarna T, Swartz HM, Hyde JS (1977). “Quantitative Studies of Free Radicals in Biology: Corrections to ESR Saturation Data.” J. Magn. Reson. (1969), 25(1), 205–210, ISSN 0022-2364, https://doi.org/10.1016/0022-2364(77)90133-0.
Other Evaluations and Quantification:
eval_integ_EPR_Spec()
,
eval_kinR_EPR_modelFit()
,
eval_kinR_ODE_model()
,
quantify_EPR_Norm_const()
## Not run: ## quantitative analysis (determining the ## radical concentration `c.M`) of a sample measured ## at different temperatures ## all data summarized in `data.tidy.integ` data.quant <- mapply(function(x,y) {quantify_EPR_Abs(x, instrum.params = c(PmW = 2.518, BmmT = 5.4e-02, TK = NULL, ## 298 K mwGHz = 9.530265), path_to_dsc_par = NULL, origin = NULL, tube.sample.id.mm = 2.86, fill.sample.h.mm = 23, Temp.K = y)$c.M }, data.tidy.integ$Area, data.tidy.integ$Temperature_K ) ## End(Not run)
## Not run: ## quantitative analysis (determining the ## radical concentration `c.M`) of a sample measured ## at different temperatures ## all data summarized in `data.tidy.integ` data.quant <- mapply(function(x,y) {quantify_EPR_Abs(x, instrum.params = c(PmW = 2.518, BmmT = 5.4e-02, TK = NULL, ## 298 K mwGHz = 9.530265), path_to_dsc_par = NULL, origin = NULL, tube.sample.id.mm = 2.86, fill.sample.h.mm = 23, Temp.K = y)$c.M }, data.tidy.integ$Area, data.tidy.integ$Temperature_K ) ## End(Not run)
Normalization constant used by quantify_EPR_Abs
or to normalize
the EPR spectrum intensity. Calculation depends on the receiver gain expression.
quantify_EPR_Norm_const( conv.time.ms, Nscans, Npoints = NULL, Bsw = NULL, rg, rg.unit = "dB" )
quantify_EPR_Norm_const( conv.time.ms, Nscans, Npoints = NULL, Bsw = NULL, rg, rg.unit = "dB" )
conv.time.ms |
Numeric, conversion time in milliseconds. |
Nscans |
Numeric, number of scans. |
Npoints |
Numeric, number of points (resolution) corresponding to individual sweep,
if |
Bsw |
Numeric, experimental sweep width (magnetic flux density recording region,
|
rg |
Numeric, receiver gain value. |
rg.unit |
Character string corresponding to unit of the receiver gain.
Either |
For the receiver gain expressed in units the normalization constant is defined
by the following relation =>
where depicts the conversion time in
;
corresponds to number of scans and
is the receiver gain in
. In the case that the receiver gain is unitless, the normalization
constant is defined by =>
where and
correspond to unitless receiver gain
and sweep width in Gauss, respectively.
equals to the number of points (resolution of
an individual sweep). One can gather all parameters
by the
readEPR_param_slct
or by the readEPR_params_tabs
function from
the corresponding .DSC
/.dsc
or .par
file. If during recording of EPR spectra
the option Normalize Acquisition
(in Spectrometer Configuration/Acquisition Options)
is activated, THE INTENSITY is ALREADY NORMALIZED and DOESN'T REQUIRE ANY ADDITIONAL
NORMALIZATION !. Please, refer also to the quantify_EPR_Abs
function.
Numeric value of the normalization constant for quantitative EPR and intensity normalization.
Weber RT (2011). Xenon User's Guide. Bruker BioSpin Manual Version 1.3, Software Version 1.1b50.
Bruker Biospin (2007). WIN-EPR User's Manual.
Other Evaluations and Quantification:
eval_integ_EPR_Spec()
,
eval_kinR_EPR_modelFit()
,
eval_kinR_ODE_model()
,
quantify_EPR_Abs()
quantify_EPR_Norm_const(conv.time.ms = 8.2, Nscans = 10, rg = 32) # quantify_EPR_Norm_const(conv.time.ms = 13.1, Bsw = 180, Nscans = 10, Npoints = 1024, rg = 3.2e+4, rg.unit = "Unitless")
quantify_EPR_Norm_const(conv.time.ms = 8.2, Nscans = 10, rg = 32) # quantify_EPR_Norm_const(conv.time.ms = 13.1, Bsw = 180, Nscans = 10, Npoints = 1024, rg = 3.2e+4, rg.unit = "Unitless")
Evaluating the linear combination of spectral intensities of components (loaded as ASCII text files corresponding
to simulated spectra). The related intensity multiplication coefficients
(please, refer to the optim.params.init
argument) are optimized by methods gathered in the
optim_for_EPR_fitness
. The goal is to fit the sum of the simulated components
onto each experimental spectrum within series. So far, the maximum number of components is set to 6.
quantify_EPR_Sim_series( data.spectra.series, dir_ASC_sim, name.pattern.sim, sim.origin = "easyspin", var2nd.series = "time_s", B.unit = "G", Intensity.expr = "dIepr_over_dB", Intensity.sim = "dIeprSim_over_dB", optim.method = "sbplx", optim.params.init, optim.params.lower = NULL, optim.params.upper = NULL, Nmax.evals = 512, tol.step = 5e-07, pswarm.size = NULL, pswarm.diameter = NULL, pswarm.type = NULL, single.integ = "single_IntegSim", double.integ = "double_IntegSim", output.area.stat = TRUE, ... )
quantify_EPR_Sim_series( data.spectra.series, dir_ASC_sim, name.pattern.sim, sim.origin = "easyspin", var2nd.series = "time_s", B.unit = "G", Intensity.expr = "dIepr_over_dB", Intensity.sim = "dIeprSim_over_dB", optim.method = "sbplx", optim.params.init, optim.params.lower = NULL, optim.params.upper = NULL, Nmax.evals = 512, tol.step = 5e-07, pswarm.size = NULL, pswarm.diameter = NULL, pswarm.type = NULL, single.integ = "single_IntegSim", double.integ = "double_IntegSim", output.area.stat = TRUE, ... )
data.spectra.series |
Spectrum data frame/table object containing magnetic flux density
as |
dir_ASC_sim |
Character string, pointing to folder where the simulated EPR spectra (data files) of all
components are stored. Path can be alternatively specified by the |
name.pattern.sim |
Character string pattern from file names related to simulated EPR spectral data
like |
sim.origin |
Character string, referring to "origin" of the simulated ASCII data.
There are four possibilities |
var2nd.series |
Character string referred to name of the second independent variable/quantity
column in the original |
B.unit |
Character string, pointing to unit of magnetic flux density
like |
Intensity.expr |
Character string, pointing to column name of the experimental EPR intensity within
the original |
Intensity.sim |
Character string pointing to column name of the simulated EPR intensity within the related
data frames (check the simulated spectral data for all components).
Default: |
optim.method |
Character string, pointing to applied optimization method/algorithm.
One may choose one from those listed in |
optim.params.init |
Numeric vector with the elements: baseline constant/intercept followed by simulated intensity multiplication coefficient for each EPR spectral component. Therefore, the length of this vector is equal to number of components + 1. |
optim.params.lower |
Numeric vector with the length of |
optim.params.upper |
Numeric vector with the length of |
Nmax.evals |
Numeric value, maximum number of function evaluations and/or iterations.
The only one method, limited by this argument, is |
tol.step |
Numeric, the smallest optimization step (relative change) between
2 iterations to stop the optimization procedure. For the |
pswarm.size |
Numeric value equal to particle swarm size (i.e. number of particles),
if |
pswarm.diameter |
Numeric value, corresponding to diameter of the particle swarm search space
(in case when
|
pswarm.type |
Character string, setting the type/version of particle swarm algorithm
if |
single.integ |
Character string, setting up the column/variable name related to single-integrated spectrum
within the output data frame, default: |
double.integ |
Character string, setting up the column/variable name related to double-integrated spectrum
within the output data frame, default: |
output.area.stat |
Logical, whether to summarize all fitted EPR spectral components, in columns,
for each time/temperature/...etc. point in row. Additional optimization measures are presented as well
(see |
... |
additional arguments specified (see also |
Analyzed EPR spectra may consists of several components (see also the eval_sim_EPR_iso_combo
function), like the overlapped EPR spectra of several radicals. In order to follow the concentration/amount
variations of each individual radical during the kinetic/temperature/...series, one must figure out,
how those individual spectral components are actually changed. In the first approximation, it means
to follow the corresponding EPR intensities/integrals, whereas the component positions (-values)
are assumed to be fixed (or those changes can be neglected). Therefore, the actual function takes the linear
combination of the spectral intensities of components (simulated spectra) and optimizes
the related multiplication coefficients. Additional analysis, where the positions of spectral
components (simulated spectra) are not fixed and can be optimized as well is under development.
Function provides data frame object, depending on the output.area.stat
argument,
as listed below:
If output.area.stat = TRUE
(default), the resulting data frame consists
of columns/variables like integrals/areas for each simulated and fitted EPR spectrum, where
the components are denoted by the uppercase letters (Area_Sim_A
, Area_Sim_B
,...etc.);
best fitted/optimized coefficients to multiply the intensities (Optim_CoeffInt_Sim_A
,
Optim_CoeffInt_Sim_B
,...etc); best fitted/optimized intercept (or baseline constant,
Optim_intercept
); minimum sum of residual squares (min_RSS
); number
of evaluations/iterations (N_evals
) and finally convergence information/number (N_converg
,
like already described in the optim_for_EPR_fitness
). These variables are presented for each
var2nd.series
(e.g. time) point like example for one EPR spectral component:
time_s | Area_Sim_A | Optim_CoeffInt_Sim_A | Optim_intercept | min_RSS | N_evals | N_converg |
6 | 0.020624473 | 0.052843937 | 5.508809e-10 | 2.289953e-07 | 198 | 4 |
21 | 0.020217930 | 0.051802287 | 5.401823e-10 | 2.438172e-07 | 177 | 4 |
36 | 0.018836579 | 0.048263010 | 5.029705e-10 | 2.662651e-07 | 201 | 4 |
Tidy/long table format of the original data.spectra.series
with additional
columns/variables (best fitted simulated intensities) for all spectral components: A, B, C, ...etc.
Other Simulations and Optimization:
eval_sim_EPR_iso()
,
eval_sim_EPR_isoFit()
,
eval_sim_EPR_iso_combo()
,
optim_for_EPR_fitness()
,
smooth_EPR_Spec_by_npreg()
## Not run: ## example with default arguments corresponding ## to one simulated spectral component, ## `optim.params.init` has the length ## of => number of components + 1, ## because of included intercept/baseline constant quant.data.sim.test.a <- quantify_EPR_Sim_series(data.spectra.series, dir_ASC_sim = "./", optim.method = "pswarm", name.pattern.sim = "DHMB0_1st_04_SimA", optim.params.init = c(0,0.8), output.area.stat = TRUE) # ## similar example with two components ## (simulated spectra) and tidy data frame ## output (not the summarized one) quant.data.sim.test.b <- quantify_EPR_Sim_series(data.spectra.series, dir_ASC_sim = "./", optim.method = "sbplx", name.pattern.sim = "DHMB0_1st_04_Sim[[:upper:]]", optim.params.init = c(0,0.8,0.2), output.area.stat = FALSE) # ## End(Not run)
## Not run: ## example with default arguments corresponding ## to one simulated spectral component, ## `optim.params.init` has the length ## of => number of components + 1, ## because of included intercept/baseline constant quant.data.sim.test.a <- quantify_EPR_Sim_series(data.spectra.series, dir_ASC_sim = "./", optim.method = "pswarm", name.pattern.sim = "DHMB0_1st_04_SimA", optim.params.init = c(0,0.8), output.area.stat = TRUE) # ## similar example with two components ## (simulated spectra) and tidy data frame ## output (not the summarized one) quant.data.sim.test.b <- quantify_EPR_Sim_series(data.spectra.series, dir_ASC_sim = "./", optim.method = "sbplx", name.pattern.sim = "DHMB0_1st_04_Sim[[:upper:]]", optim.params.init = c(0,0.8,0.2), output.area.stat = FALSE) # ## End(Not run)
This function is based on the fread
with the purpose to read
the experimental EPR/ENDOR spectra or other original (pre-processed) data, from the EPR spectrometers,
in tabular ASCII format (such as .txt
, .csv
or .asc
). Default argument values correspond
to data reading from Xenon files (see the argument origin
).
readEPR_Exp_Specs( path_to_ASC, sep = "auto", skip = 1, header = FALSE, col.names = c("index", "B_G", "dIepr_over_dB"), x.id = 2, x.unit = "G", Intensity.id = 3, time.series.id = NULL, convertB.unit = TRUE, qValue = NULL, norm.vec.add = NULL, origin = "xenon", data.structure = "spectra", ... )
readEPR_Exp_Specs( path_to_ASC, sep = "auto", skip = 1, header = FALSE, col.names = c("index", "B_G", "dIepr_over_dB"), x.id = 2, x.unit = "G", Intensity.id = 3, time.series.id = NULL, convertB.unit = TRUE, qValue = NULL, norm.vec.add = NULL, origin = "xenon", data.structure = "spectra", ... )
path_to_ASC |
Character string, path to ASCII file/table (e.g. in |
|||||||||||
sep |
The separator between columns. Defaults to the character in the set |
|||||||||||
skip |
If 0 (default) start on the first line and from there finds the first row with a consistent number of columns. This automatically avoids irregular header information before the column names row. |
|||||||||||
header |
Does the first data line contain column names? Defaults according to whether every non-empty field on the first data line is type character. If so, or TRUE is supplied, any empty column names are given a default name. |
|||||||||||
col.names |
Character string vector, inherited from the |
|||||||||||
x.id |
Numeric index related to |
|||||||||||
x.unit |
Character string, corresponding to original |
|||||||||||
Intensity.id |
Numeric index related to |
|||||||||||
time.series.id |
Numeric index related to |
|||||||||||
convertB.unit |
Logical (default: |
|||||||||||
qValue |
Numeric, Q value (quality factor, number) displayed at specific |
|||||||||||
norm.vec.add |
Numeric vector. Additional normalization constant in the form of vector, including
all (in addition to |
|||||||||||
origin |
Character string, corresponding to origin of the ASCII data, like from the
most common spectrometers (from which the data are loaded automatically using the default parameters).
Options are summarized in the following table (any other specific
|
|||||||||||
data.structure |
Character string, referring to structure of the ASCII data. Common spectral data files
with |
|||||||||||
... |
additional arguments specified (see also the |
ASCII data are transformed into R data frames, which can be then easily processed by the actual or other
R packages, e.g. dplyr), afterwards. Spectral intensities are automatically
normalized by the common experimental parameters like Q-factor, concentration, weight...etc.
These are defined by the two arguments:
qValue
and norm.vec.add
. The latter actually corresponds to values of the above-mentioned
quantities represented by the vector. If qValue = NULL
(actually corresponding to 1
),
the Q-value can be also defined as a component of the norm.vec.add
. Finally, the normalized intensity
is calculated by the following expression (depending on the qValue
and/or norm.vec.add
):
or
where is iterating through all components of the
norm.vec.add
.
The structure of ASCII files/tables depends on the origin/software used to acquire the EPR spectra.
This is mirrored mainly by the origin
and data.structure
arguments. Default arguments
are set to read the data from Xenon acquisition/processing software. However, additional
origins
can be set like origin = "winepr"
or origin = "magnettech"
or even
any arbitrary string e.g. origin = "csv"
(see also the origin
argument). For the latter,
all arguments must be set accordingly, as already demonstrated in Examples
.
Time series (time evolution of EPR spectra/kinetics) is defined by the time.series.id
argument.
In such case the ASCII data table also contains additional column either with recorded
time (see also correct_time_Exp_Specs
) or with slice number for each spectrum.
Data frame/table consisting of the magnetic flux density
column B_mT
in millitesla (as well as B_G
in gauss) or RF_MHz
(in case of ENDOR spectrum)
or unitless g-factor
and of the derivative intensity column (dIepr_over_dB
) or any other
intensities (like integrated spectral form) in procedure defined unit
(see p.d.u.),
which is normalized by the above-described parameters
and finally the index
and/or a time
(in the case of time series experiment) columns
are displayed as well.
Other Data Reading:
readEPR_Exp_Specs_kin()
,
readEPR_Exp_Specs_multif()
,
readEPR_Sim_Spec()
,
readEPR_param_slct()
,
readEPR_params_slct_kin()
,
readEPR_params_slct_quant()
,
readEPR_params_slct_sim()
,
readEPR_params_tabs()
,
readEPR_solvent_props()
,
readMAT_params_file()
## simple EPR spectrum acquired by "xenon" ## and with `B` conversion "G" <=> "mT" ## Loading the data aminoxyl.data.path <- load_data_example(file = "Aminoxyl_radical_a.txt") aminoxyl.data.01 <- readEPR_Exp_Specs(aminoxyl.data.path, qValue = 2100) ## preview head(aminoxyl.data.01) # # simple EPR spectrum acquired by "xenon" ## and without `B` conversion "G" <=> "mT" aminoxyl.data.02 <- readEPR_Exp_Specs(aminoxyl.data.path, convertB.unit = FALSE, qValue = 2100) ## preview head(aminoxyl.data.02) # ## the simple spectrum acquired by "winepr" ## (and 20 scans) on a 1 mM sample concentration: ## Loading the data TMPD.data.path <- load_data_example(file = "TMPD_specelchem_accu_b.asc") TMPD.data <- readEPR_Exp_Specs(TMPD.data.path, col.names = c("B_G","dIepr_over_dB"), qValue = 3500, norm.vec.add = c(20,0.001), origin = "winepr") ## preview head(TMPD.data) # ## the ENDOR spectrum recorded by "xenon" ## and 8 accumulation sweeps ## loading the data PNT.ENDOR.data.path <- load_data_example(file = "PNT_ENDOR_a.txt") PNT.ENDOR.data <- readEPR_Exp_Specs(PNT.ENDOR.data.path, col.names = c("index", "RF_MHz", "dIepr_over_dB"), x.unit = "MHz", norm.vec.add = 8) ## preview head(PNT.ENDOR.data) # ## reading the (pre-processed) data file ## (data.structure = "mixed") from (by) the "Xenon" software ## corresponding to kinetics with `Area` and `time` ## columns/variables , these two have to be selected ## from several others + normalize `Area` ## against the `qValue` (first of all load the path ## of package example file) triarylamine.rc.decay.path <- load_data_example("Triarylamine_radCat_decay_a.txt") ## data triarylamine.rc.decay.data <- readEPR_Exp_Specs(path_to_ASC = triarylamine.rc.decay.path, header = TRUE, fill = TRUE, select = c(3,7), col.names = c("time_s","Area"), x.unit = "s", x.id = 1, Intensity.id = 2, qValue = 1700, data.structure = "others") %>% na.omit() ## preview head(triarylamine.rc.decay.data) # ## reading the "magnettech" file example, ## first of all load the package example file acridineRad.data.path <- load_data_example("AcridineDeriv_Irrad_365nm.csv.zip") ## unzip acridineRad.data <- unzip(acridineRad.data.path, files = c("AcridineDeriv_Irrad_365nm.csv"), exdir = tempdir()) ## reading "magnettech" acridineRad.data <- readEPR_Exp_Specs(acridineRad.data, col.names = c("B_mT","dIepr_over_dB"), x.unit = "mT", origin = "magnettech") ## preview head(acridineRad.data) # ## Not run: ## EPR time series acquired by "Winepr"/"WinEpr" readEPR_Exp_Specs(path_to_ASC, col.names = c("B_G", "Slice", "dIepr_over_dB"), origin = "Winepr") # ## example for "xenon" time series experiment ## (evolution of EPR spectra in time, e.g. in case of ## EPR spectroelectrochemistry or photochemistry): ## together with `B` conversion "G" <=> mT ## and intensity normalized against `qValue` readEPR_Exp_Specs(path_to_ASC, col.names = c("index", "B_G", "time_s", "dIepr_over_dB"), qValue = 2800) # ## read `.csv` file which is an output from online ## converter: ## https://www.spectra.tools/bin/controller.pl?body=Xepr2gfac readEPR_Exp_Specs("data.csv", skip = 0, col.names = c("B_G", "g_Value", "dIepr_over_dB"), x.id = 1, Intensity.id = 3, origin = "csv") ## End(Not run)
## simple EPR spectrum acquired by "xenon" ## and with `B` conversion "G" <=> "mT" ## Loading the data aminoxyl.data.path <- load_data_example(file = "Aminoxyl_radical_a.txt") aminoxyl.data.01 <- readEPR_Exp_Specs(aminoxyl.data.path, qValue = 2100) ## preview head(aminoxyl.data.01) # # simple EPR spectrum acquired by "xenon" ## and without `B` conversion "G" <=> "mT" aminoxyl.data.02 <- readEPR_Exp_Specs(aminoxyl.data.path, convertB.unit = FALSE, qValue = 2100) ## preview head(aminoxyl.data.02) # ## the simple spectrum acquired by "winepr" ## (and 20 scans) on a 1 mM sample concentration: ## Loading the data TMPD.data.path <- load_data_example(file = "TMPD_specelchem_accu_b.asc") TMPD.data <- readEPR_Exp_Specs(TMPD.data.path, col.names = c("B_G","dIepr_over_dB"), qValue = 3500, norm.vec.add = c(20,0.001), origin = "winepr") ## preview head(TMPD.data) # ## the ENDOR spectrum recorded by "xenon" ## and 8 accumulation sweeps ## loading the data PNT.ENDOR.data.path <- load_data_example(file = "PNT_ENDOR_a.txt") PNT.ENDOR.data <- readEPR_Exp_Specs(PNT.ENDOR.data.path, col.names = c("index", "RF_MHz", "dIepr_over_dB"), x.unit = "MHz", norm.vec.add = 8) ## preview head(PNT.ENDOR.data) # ## reading the (pre-processed) data file ## (data.structure = "mixed") from (by) the "Xenon" software ## corresponding to kinetics with `Area` and `time` ## columns/variables , these two have to be selected ## from several others + normalize `Area` ## against the `qValue` (first of all load the path ## of package example file) triarylamine.rc.decay.path <- load_data_example("Triarylamine_radCat_decay_a.txt") ## data triarylamine.rc.decay.data <- readEPR_Exp_Specs(path_to_ASC = triarylamine.rc.decay.path, header = TRUE, fill = TRUE, select = c(3,7), col.names = c("time_s","Area"), x.unit = "s", x.id = 1, Intensity.id = 2, qValue = 1700, data.structure = "others") %>% na.omit() ## preview head(triarylamine.rc.decay.data) # ## reading the "magnettech" file example, ## first of all load the package example file acridineRad.data.path <- load_data_example("AcridineDeriv_Irrad_365nm.csv.zip") ## unzip acridineRad.data <- unzip(acridineRad.data.path, files = c("AcridineDeriv_Irrad_365nm.csv"), exdir = tempdir()) ## reading "magnettech" acridineRad.data <- readEPR_Exp_Specs(acridineRad.data, col.names = c("B_mT","dIepr_over_dB"), x.unit = "mT", origin = "magnettech") ## preview head(acridineRad.data) # ## Not run: ## EPR time series acquired by "Winepr"/"WinEpr" readEPR_Exp_Specs(path_to_ASC, col.names = c("B_G", "Slice", "dIepr_over_dB"), origin = "Winepr") # ## example for "xenon" time series experiment ## (evolution of EPR spectra in time, e.g. in case of ## EPR spectroelectrochemistry or photochemistry): ## together with `B` conversion "G" <=> mT ## and intensity normalized against `qValue` readEPR_Exp_Specs(path_to_ASC, col.names = c("index", "B_G", "time_s", "dIepr_over_dB"), qValue = 2800) # ## read `.csv` file which is an output from online ## converter: ## https://www.spectra.tools/bin/controller.pl?body=Xepr2gfac readEPR_Exp_Specs("data.csv", skip = 0, col.names = c("B_G", "g_Value", "dIepr_over_dB"), x.id = 1, Intensity.id = 3, origin = "csv") ## End(Not run)
Reading the continuous wave (CW) EPR time series spectral data (recorded by e.g. 2D_Field_Delay
experiment in "Xenon" acquisition/processing software). Function (based on readEPR_Exp_Specs
) includes
automatic time correction for CW EPR time.series
experiments (see also correct_time_Exp_Specs
).
readEPR_Exp_Specs_kin( name.root, dir_ASC, dir_dsc_par, time.unit = "s", time.delta.slice.s = NULL, col.names = c("index", "B_G", "time_s", "dIepr_over_dB"), x.id = 2, x.unit = "G", Intensity.id = 4, time.series.id = 3, convertB.unit = TRUE, qValue = NULL, norm.vec.add = NULL, origin = "xenon", ... )
readEPR_Exp_Specs_kin( name.root, dir_ASC, dir_dsc_par, time.unit = "s", time.delta.slice.s = NULL, col.names = c("index", "B_G", "time_s", "dIepr_over_dB"), x.id = 2, x.unit = "G", Intensity.id = 4, time.series.id = 3, convertB.unit = TRUE, qValue = NULL, norm.vec.add = NULL, origin = "xenon", ... )
name.root |
Character string, corresponding to entire file name without extension. |
|||||||||||
dir_ASC |
Character string, path (can be also defined by the |
|||||||||||
dir_dsc_par |
Character string, path (can be also defined by the |
|||||||||||
time.unit |
Character string, specifying the |
|||||||||||
time.delta.slice.s |
Numeric, time interval in seconds between |
|||||||||||
col.names |
Character/String vector inherited from |
|||||||||||
x.id |
Numeric index related to |
|||||||||||
x.unit |
Character string, corresponding to original |
|||||||||||
Intensity.id |
Numeric index related to |
|||||||||||
time.series.id |
Numeric index related to |
|||||||||||
convertB.unit |
Logical (default: |
|||||||||||
qValue |
Numeric, Q value (quality factor, number) displayed at specific |
|||||||||||
norm.vec.add |
Numeric vector, additional normalization constant in the form of vector, involving
all (in addition to |
|||||||||||
origin |
Character string, corresponding to origin of the ASCII data, like from the
most common spectrometers (from which the data are loaded automatically using the default parameters).
Options are summarized in the following table (any other specific
|
|||||||||||
... |
additional arguments specified, see also the |
List of EPR spectrum data (including time) in tidy long table format (df
) + corrected
time vector (time
). For the origon = "winepr"
"time" slices/indices must be already converted
into time domain by time.delta.slice.s
(see arguments and examples).
Other Data Reading:
readEPR_Exp_Specs()
,
readEPR_Exp_Specs_multif()
,
readEPR_Sim_Spec()
,
readEPR_param_slct()
,
readEPR_params_slct_kin()
,
readEPR_params_slct_quant()
,
readEPR_params_slct_sim()
,
readEPR_params_tabs()
,
readEPR_solvent_props()
,
readMAT_params_file()
## loading the built-in package example to demonstrate ## the reading of time series EPR spectra/kinetics: triarylam.decay.series.dsc.path <- load_data_example(file = "Triarylamine_radCat_decay_series.DSC") triarylam.decay.series.asc.path <- load_data_example(file = "Triarylamine_radCat_decay_series.zip") unzip(triarylam.decay.series.asc.path,exdir = tempdir()) # ## loading the kinetics: triarylam.decay.series.data <- readEPR_Exp_Specs_kin(name.root = "Triarylamine_radCat_decay_series", dir_ASC = tempdir(), dir_dsc_par = system.file("extdata", package = "eprscope") ) # ## data preview head(triarylam.decay.series.data$df) # ## preview of corrected time vector ## (the uncorrected one actually starts from `0`) triarylam.decay.series.data$time # ## Not run: ## reading by the "WinEPR" software readEPR_Exp_Specs_kin("Sample_spectra_irradiation", file.path(".","ASCII_data_dir"), file.path(".","dsc_data_dir"), time.unit = "s", time.delta.slice.s = 24.1, col.names = c("B_G", "Slice", "Intensity"), x.unit = "G", qValue = 2900, origin = "winepr") ## End(Not run)
## loading the built-in package example to demonstrate ## the reading of time series EPR spectra/kinetics: triarylam.decay.series.dsc.path <- load_data_example(file = "Triarylamine_radCat_decay_series.DSC") triarylam.decay.series.asc.path <- load_data_example(file = "Triarylamine_radCat_decay_series.zip") unzip(triarylam.decay.series.asc.path,exdir = tempdir()) # ## loading the kinetics: triarylam.decay.series.data <- readEPR_Exp_Specs_kin(name.root = "Triarylamine_radCat_decay_series", dir_ASC = tempdir(), dir_dsc_par = system.file("extdata", package = "eprscope") ) # ## data preview head(triarylam.decay.series.data$df) # ## preview of corrected time vector ## (the uncorrected one actually starts from `0`) triarylam.decay.series.data$time # ## Not run: ## reading by the "WinEPR" software readEPR_Exp_Specs_kin("Sample_spectra_irradiation", file.path(".","ASCII_data_dir"), file.path(".","dsc_data_dir"), time.unit = "s", time.delta.slice.s = 24.1, col.names = c("B_G", "Slice", "Intensity"), x.unit = "G", qValue = 2900, origin = "winepr") ## End(Not run)
Loads the EPR spectra from several/multiple text
files (including the instrumental
parameters in .DSC
/.dsc
or .par
format) at once. Finally, the data are transformed
either into a list of data frames or into a tidy/long table format.
According to experimental quantity (e.g. temperature, microwave power, recording time...etc),
names
and var2nd.series
(in the case of tidy = TRUE
) arguments have to be specified.
readEPR_Exp_Specs_multif( name.pattern, dir_ASC, dir_dsc_par, col.names = c("index", "B_G", "dIepr_over_dB"), x.id = 2, x.unit = "G", Intensity.id = 3, convertB.unit = TRUE, qValues = NULL, norm.list.add = NULL, names, tidy = FALSE, var2nd.series = NULL, var2nd.series.factor = FALSE, origin = "xenon", ... )
readEPR_Exp_Specs_multif( name.pattern, dir_ASC, dir_dsc_par, col.names = c("index", "B_G", "dIepr_over_dB"), x.id = 2, x.unit = "G", Intensity.id = 3, convertB.unit = TRUE, qValues = NULL, norm.list.add = NULL, names, tidy = FALSE, var2nd.series = NULL, var2nd.series.factor = FALSE, origin = "xenon", ... )
name.pattern |
Character string ('specimen'), inherited from |
|||||||||||
dir_ASC |
Path (defined by |
|||||||||||
dir_dsc_par |
Path (defined by |
|||||||||||
col.names |
Character string vector, inherited from |
|||||||||||
x.id |
Numeric index related to |
|||||||||||
x.unit |
Character string pointing to unit of quantity (coming from the original ASCII data, see also
|
|||||||||||
Intensity.id |
Numeric index related to |
|||||||||||
convertB.unit |
Logical (default: |
|||||||||||
qValues |
Numeric vector of Q-values (sensitivity factors to normalize EPR intensities) either loaded from
instrumental parameters ( |
|||||||||||
norm.list.add |
Numeric list of vectors. Additional normalization constants in the form of vectors involving
all (i.e. in addition to |
|||||||||||
names |
Character string vector, corresponding either to values of additional quantity
(e.g. temperature,microwave power...etc, |
|||||||||||
tidy |
Logical, whether to transform the list of data frames into the long table ( |
|||||||||||
var2nd.series |
Character string, if |
|||||||||||
var2nd.series.factor |
Logical, whether to factorize |
|||||||||||
origin |
Character string, corresponding to origin of the ASCII data, like from the
most common spectrometers (from which the data are loaded automatically using the default parameters).
Options are summarized in the following table (any other specific
|
|||||||||||
... |
additional arguments specified, see also |
List of Data Frames (or long table tidy
format) corresponding
to multiple spectral data files/data sets. g-Value column (if x.unit = "mT"
or "G"
)
is automatically calculated during the processing and it is included in the data frame list/database as well.
Other Data Reading:
readEPR_Exp_Specs()
,
readEPR_Exp_Specs_kin()
,
readEPR_Sim_Spec()
,
readEPR_param_slct()
,
readEPR_params_slct_kin()
,
readEPR_params_slct_quant()
,
readEPR_params_slct_sim()
,
readEPR_params_tabs()
,
readEPR_solvent_props()
,
readMAT_params_file()
## Not run: ## multiple ENDOR spectra at different temperatures recorded by `Xenon` software ## read and transformed into `longtable`, ready to plot the overlay ## EPR spectra => `var2nd.series.factor = FALSE` (default). readEPR_Exp_Specs_multif(name.pattern = "^.*_sample_VT_", file.path(".","ASCII_data_dir"), file.path(".","DSC_data_dir"), col.names = c("index", "RF_MHz", "Intensity"), x.id = 2, x.unit = "MHz", Intensity.id = 3, names = c("210","220","230","240"), tidy = TRUE, var2nd.series = "Temperature_K") # ## multiple EPR spectra recorded at different temperatures ## by `WinEPR` software, experiments performed with a powder ## sample (m = 10 mg) and each spectrum acquired ## as 7 accumulations, the resulting database ## corresponds to list of data frames readEPR_Exp_Specs_multif("^Sample_VT_", file.path(".","ASCII_data_dir"), file.path(".","DSC_data_dir"), col.names = c("B_G","dIepr_over_dB"), x.id = 1, x.unit = "G", Intensity.id = 2, names = c("210","220","230","240"), qValues = c(3400,3501,3600,2800), norm.list.add = rep(list(c(10,7)),times = 4), origin = "winepr") # ## multiple `Xenon` EPR spectra related to one powder sample (m = 8 mg) ## where several instrumental parameters are changed ## at once, the file names (files are stored in the actual directory) ## start with the "R5228_AV_powder_", function returns all spectral data ## in `tidy` (long) table format readEPR_Exp_Specs_multif(name.pattern = "R5228_AV_powder_", dir_ASC = ".", dir_dsc_par = ".", names = c("a","b","c","d"), tidy = TRUE, var2nd.series = "sample", norm.list.add = rep(list(8),4)) ## End(Not run)
## Not run: ## multiple ENDOR spectra at different temperatures recorded by `Xenon` software ## read and transformed into `longtable`, ready to plot the overlay ## EPR spectra => `var2nd.series.factor = FALSE` (default). readEPR_Exp_Specs_multif(name.pattern = "^.*_sample_VT_", file.path(".","ASCII_data_dir"), file.path(".","DSC_data_dir"), col.names = c("index", "RF_MHz", "Intensity"), x.id = 2, x.unit = "MHz", Intensity.id = 3, names = c("210","220","230","240"), tidy = TRUE, var2nd.series = "Temperature_K") # ## multiple EPR spectra recorded at different temperatures ## by `WinEPR` software, experiments performed with a powder ## sample (m = 10 mg) and each spectrum acquired ## as 7 accumulations, the resulting database ## corresponds to list of data frames readEPR_Exp_Specs_multif("^Sample_VT_", file.path(".","ASCII_data_dir"), file.path(".","DSC_data_dir"), col.names = c("B_G","dIepr_over_dB"), x.id = 1, x.unit = "G", Intensity.id = 2, names = c("210","220","230","240"), qValues = c(3400,3501,3600,2800), norm.list.add = rep(list(c(10,7)),times = 4), origin = "winepr") # ## multiple `Xenon` EPR spectra related to one powder sample (m = 8 mg) ## where several instrumental parameters are changed ## at once, the file names (files are stored in the actual directory) ## start with the "R5228_AV_powder_", function returns all spectral data ## in `tidy` (long) table format readEPR_Exp_Specs_multif(name.pattern = "R5228_AV_powder_", dir_ASC = ".", dir_dsc_par = ".", names = c("a","b","c","d"), tidy = TRUE, var2nd.series = "sample", norm.list.add = rep(list(8),4)) ## End(Not run)
Taking selected instrumental parameters or information
from the .DSC/.dsc
or .par
file of an EPR spectrum (written by the Xenon
/Magnettech
or WinEpr
software, respectively).
readEPR_param_slct(path_to_dsc_par, string, origin = "xenon")
readEPR_param_slct(path_to_dsc_par, string, origin = "xenon")
path_to_dsc_par |
Character string, path to |
|||||||||||||||||||||||||||||||||||||||||
string |
Character (vector) string (appeared at the line beginning) within the
|
|||||||||||||||||||||||||||||||||||||||||
origin |
Character string, corresponding to software used to acquire EPR spectra.
The files are slightly different depending on whether
they were recorded by the "WinEpr", |
Numeric or character string (e.g. date or comment), corresponding to selected instrumental parameter(s)
applied to record the EPR spectra. In case of string
character vector, named list, containing
either character and/or numeric values, is returned with the names corresponding to string
.
Other Data Reading:
readEPR_Exp_Specs()
,
readEPR_Exp_Specs_kin()
,
readEPR_Exp_Specs_multif()
,
readEPR_Sim_Spec()
,
readEPR_params_slct_kin()
,
readEPR_params_slct_quant()
,
readEPR_params_slct_sim()
,
readEPR_params_tabs()
,
readEPR_solvent_props()
,
readMAT_params_file()
## loading `.DSC` (`Xenon`) parameter file example triaryl_radCat_dsc_path <- load_data_example(file = "Triarylamine_radCat_decay_a.DSC") # ## reading modulation amplitude (in T) from the `Xenon` spectrometer file readEPR_param_slct(triaryl_radCat_dsc_path,string = "B0MA") # ## reading Q-Value from the `Xenon` spectrometer file readEPR_param_slct(triaryl_radCat_dsc_path,string = "QValue") # ## reading `CMNT` (comment) and `MWFQ` (microwave frequency in Hz) ## from the `Xenon` spectrometer file readEPR_param_slct(triaryl_radCat_dsc_path, string = c("CMNT","MWFQ")) # ## loading `.par` (`WinEPR`) parameter file example TMPD_radCat_par_path <- load_data_example(file = "TMPD_specelchem_accu_b.par") # ## reading `JDA` (date) from `WinEPR` spectrometer file readEPR_param_slct(TMPD_radCat_par_path, string = "JDA", origin = "winepr") # ## reading `RMA` (modulation amplitude in G) and `TE` ## (temperature in K) as well as `JCO` (comment) ## from `WinEPR` spectrometer file readEPR_param_slct(TMPD_radCat_par_path, string = c("RMA","TE","JCO"), origin = "WinEPR") # ## loading and reading the `.DSC` file from `Xenon` ## corresponding to phenalenyl (PNT) CW ENDOR spectrum, ## read expr. date (`TIME`), microwave frequency (`MWFQ`) ## in Hz and the corresponding field for saturation (`B0VL`) ## in Tesla: pnt_endor_dsc_path <- load_data_example(file = "PNT_ENDOR_a.DSC") readEPR_param_slct(pnt_endor_dsc_path, string = c("TIME","MWFQ","B0VL") )
## loading `.DSC` (`Xenon`) parameter file example triaryl_radCat_dsc_path <- load_data_example(file = "Triarylamine_radCat_decay_a.DSC") # ## reading modulation amplitude (in T) from the `Xenon` spectrometer file readEPR_param_slct(triaryl_radCat_dsc_path,string = "B0MA") # ## reading Q-Value from the `Xenon` spectrometer file readEPR_param_slct(triaryl_radCat_dsc_path,string = "QValue") # ## reading `CMNT` (comment) and `MWFQ` (microwave frequency in Hz) ## from the `Xenon` spectrometer file readEPR_param_slct(triaryl_radCat_dsc_path, string = c("CMNT","MWFQ")) # ## loading `.par` (`WinEPR`) parameter file example TMPD_radCat_par_path <- load_data_example(file = "TMPD_specelchem_accu_b.par") # ## reading `JDA` (date) from `WinEPR` spectrometer file readEPR_param_slct(TMPD_radCat_par_path, string = "JDA", origin = "winepr") # ## reading `RMA` (modulation amplitude in G) and `TE` ## (temperature in K) as well as `JCO` (comment) ## from `WinEPR` spectrometer file readEPR_param_slct(TMPD_radCat_par_path, string = c("RMA","TE","JCO"), origin = "WinEPR") # ## loading and reading the `.DSC` file from `Xenon` ## corresponding to phenalenyl (PNT) CW ENDOR spectrum, ## read expr. date (`TIME`), microwave frequency (`MWFQ`) ## in Hz and the corresponding field for saturation (`B0VL`) ## in Tesla: pnt_endor_dsc_path <- load_data_example(file = "PNT_ENDOR_a.DSC") readEPR_param_slct(pnt_endor_dsc_path, string = c("TIME","MWFQ","B0VL") )
Function takes selected instrumental parameters relevant to time series ("kinetic")
experiment from the .DSC/.dsc
or .par
file of an EPR Spectrum, obtained from the "Xenon",
"WinEpr" or "Magnettech" software. These parameters are required for time correction of the CW (continuous wave) EPR
spectra, see the correct_time_Exp_Specs
.
readEPR_params_slct_kin(path_to_dsc_par, origin = "xenon")
readEPR_params_slct_kin(path_to_dsc_par, origin = "xenon")
path_to_dsc_par |
String, path to |
origin |
Character string, corresponding to software used to acquire EPR spectra.
The files are slightly different depending on whether
they were recorded by the "WinEpr", |
List containing:
Number of scans.
Sweep time in s
required for time correction during the 2D_Field_Delay
(time series EPR experiment).
Number of points (spectral resolution).
Other Data Reading:
readEPR_Exp_Specs()
,
readEPR_Exp_Specs_kin()
,
readEPR_Exp_Specs_multif()
,
readEPR_Sim_Spec()
,
readEPR_param_slct()
,
readEPR_params_slct_quant()
,
readEPR_params_slct_sim()
,
readEPR_params_tabs()
,
readEPR_solvent_props()
,
readMAT_params_file()
## loading `.DSC` (`Xenon`) parameter file example aminoxyl_dsc_path <- load_data_example(file = "Triarylamine_radCat_decay_series.DSC") # readEPR_params_slct_kin(aminoxyl_dsc_path)
## loading `.DSC` (`Xenon`) parameter file example aminoxyl_dsc_path <- load_data_example(file = "Triarylamine_radCat_decay_series.DSC") # readEPR_params_slct_kin(aminoxyl_dsc_path)
Reading the .DSC/.dsc
or .par
file to extract the important parameters like
"modulation amplitude", "temperature", "microwave power" as well as "microwave frequency"
which are are required for the absolute EPR quantitative analysis (
radical or paramagnetic species number determination, see the
quantify_EPR_Abs
function).
readEPR_params_slct_quant(path_to_dsc_par, origin = "xenon")
readEPR_params_slct_quant(path_to_dsc_par, origin = "xenon")
path_to_dsc_par |
Character string, path (also provided by |
origin |
Character string, corresponding to software used to acquire EPR spectra.
The files are slightly different depending on whether
they were recorded by the "WinEpr", |
List consisting of:
Modulation amplitude value in mT
.
Microwave source power in mW
.
Experimental temperature in K
.
Microwave frequency value in GHz
.
Other Data Reading:
readEPR_Exp_Specs()
,
readEPR_Exp_Specs_kin()
,
readEPR_Exp_Specs_multif()
,
readEPR_Sim_Spec()
,
readEPR_param_slct()
,
readEPR_params_slct_kin()
,
readEPR_params_slct_sim()
,
readEPR_params_tabs()
,
readEPR_solvent_props()
,
readMAT_params_file()
## loading `.DSC` (`Xenon`) parameter file example aminoxyl_dsc_path <- load_data_example(file = "Aminoxyl_radical_a.DSC") # readEPR_params_slct_quant(aminoxyl_dsc_path)
## loading `.DSC` (`Xenon`) parameter file example aminoxyl_dsc_path <- load_data_example(file = "Aminoxyl_radical_a.DSC") # readEPR_params_slct_quant(aminoxyl_dsc_path)
Reading the .DSC/.dsc
or .par
file to extract the important parameters like
"sweep width", "central field", "number of points" as well as "microwave frequency"
which are are required for the simulations of EPR spectra (see also
the eval_sim_EPR_iso
function).
readEPR_params_slct_sim(path_to_dsc_par, origin = "xenon", B.unit = "G")
readEPR_params_slct_sim(path_to_dsc_par, origin = "xenon", B.unit = "G")
path_to_dsc_par |
Character string, path (also provided by |
origin |
Character string, corresponding to software used to acquire EPR spectra.
The files are slightly different depending on whether
they were recorded by the "WinEpr", |
B.unit |
Character string, pointing to unit of magnetic flux density which is the output
"unit", |
List consisting of:
Central field (magnetic flux density, B) value in B.unit
.
Sweep width (magnetic flux density, B, experimental range) value in B.unit
.
Number of points (spectral resolution).
Microwave frequency value in GHz
.
Other Data Reading:
readEPR_Exp_Specs()
,
readEPR_Exp_Specs_kin()
,
readEPR_Exp_Specs_multif()
,
readEPR_Sim_Spec()
,
readEPR_param_slct()
,
readEPR_params_slct_kin()
,
readEPR_params_slct_quant()
,
readEPR_params_tabs()
,
readEPR_solvent_props()
,
readMAT_params_file()
## loading `.par` (`WinEPR`) parameter file example TMPD_radCat_par_path <- load_data_example(file = "TMPD_specelchem_accu_b.par") # ## `B` parameters in `mT` readEPR_params_slct_sim(TMPD_radCat_par_path, origin = "winepr", B.unit = "mT") # ## loading `.dsc` (`Magnettech`) parameter ## file example AcridineRad.params.path <- load_data_example("AcridineDeriv_Irrad_365nm.dsc") readEPR_params_slct_sim(AcridineRad.params.path, origin = "magnettech")
## loading `.par` (`WinEPR`) parameter file example TMPD_radCat_par_path <- load_data_example(file = "TMPD_specelchem_accu_b.par") # ## `B` parameters in `mT` readEPR_params_slct_sim(TMPD_radCat_par_path, origin = "winepr", B.unit = "mT") # ## loading `.dsc` (`Magnettech`) parameter ## file example AcridineRad.params.path <- load_data_example("AcridineDeriv_Irrad_365nm.dsc") readEPR_params_slct_sim(AcridineRad.params.path, origin = "magnettech")
Taking the instrumental parameters from the .DSC/.dsc
or .par
files, applied
to record the EPR Spectra, and transferring them into list of Tables/Data Frames
.
They include either parameter values and their units or character/string information about the measurement,
see also the readEPR_param_slct
.
readEPR_params_tabs(path_to_dsc_par, origin = "xenon", interact = NULL)
readEPR_params_tabs(path_to_dsc_par, origin = "xenon", interact = NULL)
path_to_dsc_par |
Character string, path (also provided by |
origin |
Character string, corresponding to software used to acquire EPR spectra.
The files are slightly different depending on whether
they were recorded by the "WinEpr", |
interact |
Character string, whether to display interactive tables by the |
List of data frames/tables containing:
Instrumental parameters with their numeric values and units.
Information character string, such as date, operator, comment...etc.
Both data frames may be depicted in the form of interactive tables
by the interact
function argument.
Other Data Reading:
readEPR_Exp_Specs()
,
readEPR_Exp_Specs_kin()
,
readEPR_Exp_Specs_multif()
,
readEPR_Sim_Spec()
,
readEPR_param_slct()
,
readEPR_params_slct_kin()
,
readEPR_params_slct_quant()
,
readEPR_params_slct_sim()
,
readEPR_solvent_props()
,
readMAT_params_file()
## loading built-in example file => ## "AcridineDeriv_Irrad_365nm.dsc" by `Magnettech` ## spectrometer software AcridinRad.data.file <- load_data_example("AcridineDeriv_Irrad_365nm.dsc") ## reading and displaying parameters as data frame AcridinRad.params.data <- readEPR_params_tabs(AcridinRad.data.file, origin = "magnettech") # ## parameters preview AcridinRad.params.data$params # ## info preview AcridinRad.params.data$info # ## built-in example file => "TMPD_specelchem_accu_b.par" ## by the `WinEPR` spectrometer software tmpd.params.file <- load_data_example(file = "TMPD_specelchem_accu_b.par") ## reading and displaying parameters as data frame tmpd.params.tab <- readEPR_params_tabs(tmpd.params.file, origin = "winepr") # ## preview tmpd.params.tab$params ## ## the same data frame, now in interactive table form readEPR_params_tabs(tmpd.params.file, origin = "winepr", interact = "params")
## loading built-in example file => ## "AcridineDeriv_Irrad_365nm.dsc" by `Magnettech` ## spectrometer software AcridinRad.data.file <- load_data_example("AcridineDeriv_Irrad_365nm.dsc") ## reading and displaying parameters as data frame AcridinRad.params.data <- readEPR_params_tabs(AcridinRad.data.file, origin = "magnettech") # ## parameters preview AcridinRad.params.data$params # ## info preview AcridinRad.params.data$info # ## built-in example file => "TMPD_specelchem_accu_b.par" ## by the `WinEPR` spectrometer software tmpd.params.file <- load_data_example(file = "TMPD_specelchem_accu_b.par") ## reading and displaying parameters as data frame tmpd.params.tab <- readEPR_params_tabs(tmpd.params.file, origin = "winepr") # ## preview tmpd.params.tab$params ## ## the same data frame, now in interactive table form readEPR_params_tabs(tmpd.params.file, origin = "winepr", interact = "params")
Loading the ASCII data like .txt
,.asc
or .csv
, related to simulated EPR spectrum from different
sources like "EasySpin" (Matlab), "Xenon" (EPR spectrometer), "SimFonia" (WinEPR system)
or "csv" (comma separated values, universal format or MS Excel). Finally, they are automatically converted
into data frames by the fread
.
readEPR_Sim_Spec( path_to_ASC, B.unit = "G", Intensity.sim = "dIeprSim_over_dB", sim.origin = "easyspin" )
readEPR_Sim_Spec( path_to_ASC, B.unit = "G", Intensity.sim = "dIeprSim_over_dB", sim.origin = "easyspin" )
path_to_ASC |
Character string, path to ASCII file/table
with simulated spectral data ( |
B.unit |
Character string, pointing to unit of magnetic flux density coming from the original data
which is to be presented on the |
Intensity.sim |
Character string, pointing to intensity data frame column name, corresponding
to simulated EPR spectrum. If used together with the quantification of radicals,
this argument must be equal to that of the |
sim.origin |
Character string, referring to the "origin" of a simulated spectrum ASCII data.
There are four possibilities |
Data frame, consisting of magnetic flux density (Bsim_mT
or Bsim_G
) and intensity
variable/column (depending on the Intensity.sim
argument), corresponding to simulated EPR spectrum.
Other Data Reading:
readEPR_Exp_Specs()
,
readEPR_Exp_Specs_kin()
,
readEPR_Exp_Specs_multif()
,
readEPR_param_slct()
,
readEPR_params_slct_kin()
,
readEPR_params_slct_quant()
,
readEPR_params_slct_sim()
,
readEPR_params_tabs()
,
readEPR_solvent_props()
,
readMAT_params_file()
## Not run: readEPR_Sim_Spec(path_to_ASC = "./Simulations/TEMPO_simulation.txt", sim.origin = "xenon") # readEPR_Sim_Spec("Cu_complex_simulation.txt", B.unit = "mT", sim.origin = "easyspin") ## End(Not run)
## Not run: readEPR_Sim_Spec(path_to_ASC = "./Simulations/TEMPO_simulation.txt", sim.origin = "xenon") # readEPR_Sim_Spec("Cu_complex_simulation.txt", B.unit = "mT", sim.origin = "easyspin") ## End(Not run)
solvents_ds
DatasetGathering the solvent properties from solvents_ds
in order to filter out
specific solvent
and its corresponding properties (by the prop
argument).
See also vignette("datasets")
.
readEPR_solvent_props(solvent, prop = NULL)
readEPR_solvent_props(solvent, prop = NULL)
solvent |
Character string, pointing to solvent name (or any string from the solvent name/abbreviation),
such as |
prop |
Character string related to a data frame variable/column/property e.g. |
Data frame with row/rows of selected solvent(s) and the corresponding properties. If a specific property
is called like code = "melting"
( melting point in °C), the function returns
value/character
.
Other Data Reading:
readEPR_Exp_Specs()
,
readEPR_Exp_Specs_kin()
,
readEPR_Exp_Specs_multif()
,
readEPR_Sim_Spec()
,
readEPR_param_slct()
,
readEPR_params_slct_kin()
,
readEPR_params_slct_quant()
,
readEPR_params_slct_sim()
,
readEPR_params_tabs()
,
readMAT_params_file()
## Properties of `DMSO`: solvent_01 <- readEPR_solvent_props("DMSO") head(solvent_01) # ## All `xylene` solvent specifications: solvent_02 <- readEPR_solvent_props(solvent = "xylene") head(solvent_02) # ## Boiling point of `o-xylene`: readEPR_solvent_props(solvent = "o-xylene", prop = "boiling")
## Properties of `DMSO`: solvent_01 <- readEPR_solvent_props("DMSO") head(solvent_01) # ## All `xylene` solvent specifications: solvent_02 <- readEPR_solvent_props(solvent = "xylene") head(solvent_02) # ## Boiling point of `o-xylene`: readEPR_solvent_props(solvent = "o-xylene", prop = "boiling")
.mat
FileFunction is based on the readMat
and provides the reading of a .mat
simulation file content from EasySpin MATLAB, including structures/variables and fields.
It can be also used to read and store simulated EPR spectrum in the form of R data frame (see Examples
).
readMAT_params_file(path_to_MAT, str.var = NULL, field.var = NULL)
readMAT_params_file(path_to_MAT, str.var = NULL, field.var = NULL)
path_to_MAT |
Character string, path to |
str.var |
Character string, denoting structure/variable, which may contain |
field.var |
Character string, corresponding to field variable after 'dot', which is available only for certain
structures/variables, see e.g. example above (Sys.g). Therefore,
the default value is |
Unless the str.var
and/or field.var
are not specified, the output is list
with the all original
parameters/structures from MATLAB file. Otherwise, the function returns either numeric/character vector/value
or list depending on class
of the original parameter/field variable.
Other Data Reading:
readEPR_Exp_Specs()
,
readEPR_Exp_Specs_kin()
,
readEPR_Exp_Specs_multif()
,
readEPR_Sim_Spec()
,
readEPR_param_slct()
,
readEPR_params_slct_kin()
,
readEPR_params_slct_quant()
,
readEPR_params_slct_sim()
,
readEPR_params_tabs()
,
readEPR_solvent_props()
## loading the package built-in ## `Aminoxyl_radical_a.mat` file as an example aminoxyl.mat.file <- load_data_example(file = "Aminoxyl_radical_a.mat") # ## reading the entire `mat` file as list ## and assign variable aminoxyl.mat.list <- readMAT_params_file(aminoxyl.mat.file) # ## read the `Sim1` structure/variable content into list aminoxyl.mat.sim1 <- readMAT_params_file(aminoxyl.mat.file, str.var = "Sim1") # ## list preview aminoxyl.mat.sim1 # ## compare the previous simulation parameters with ## those obtained by the `eval_sim_EPR_isoFit()` ## function (look at the corresponding examples) # ## alternatively the `Sim1` (its dimension > 2) ## can be also read by the following command ## however, the returned output has a complex ## array-list structure aminoxyl.mat.list$Sim1[, , 1] # ## read the `Sim1` structure/variable ## and the field `Nucs` corresponding to nuclei ## considered in the EPR simulation aminoxyl.mat.sim1.nucs <- readMAT_params_file(aminoxyl.mat.file, str.var = "Sim1", field.var = "Nucs") # ## preview aminoxyl.mat.sim1.nucs # ## reading the magnetic flux density ## `B` column/vector corresponding to simulated ## and experimental EPR spectrum aminoxyl.B.G <- readMAT_params_file(aminoxyl.mat.file, str.var = "B") # ## preview of the first 6 values aminoxyl.B.G[1:6] # ## reading the intensity related to simulated ## EPR spectrum aminoxyl.sim.fitSpec <- readMAT_params_file(aminoxyl.mat.file, str.var = "fit1", field.var = "fitSpec") # ## for the newer EasySpin version (> 6.0.0), ## the "fitSpec" is replaced by the simple "fit", ## all additional parameters (array) are stored under ## the "pfit_full" variable # ## preview of the first 6 values aminoxyl.sim.fitSpec[1:6] # ## The last two examples can be used ## to load the simulated EPR spectrum ## by the `EasySpin` from `mat` file => simulation.aminoxyl.spectr.df <- data.frame(Bsim_G = aminoxyl.B.G, dIeprSim_over_dB = aminoxyl.sim.fitSpec) # ## preview head(simulation.aminoxyl.spectr.df)
## loading the package built-in ## `Aminoxyl_radical_a.mat` file as an example aminoxyl.mat.file <- load_data_example(file = "Aminoxyl_radical_a.mat") # ## reading the entire `mat` file as list ## and assign variable aminoxyl.mat.list <- readMAT_params_file(aminoxyl.mat.file) # ## read the `Sim1` structure/variable content into list aminoxyl.mat.sim1 <- readMAT_params_file(aminoxyl.mat.file, str.var = "Sim1") # ## list preview aminoxyl.mat.sim1 # ## compare the previous simulation parameters with ## those obtained by the `eval_sim_EPR_isoFit()` ## function (look at the corresponding examples) # ## alternatively the `Sim1` (its dimension > 2) ## can be also read by the following command ## however, the returned output has a complex ## array-list structure aminoxyl.mat.list$Sim1[, , 1] # ## read the `Sim1` structure/variable ## and the field `Nucs` corresponding to nuclei ## considered in the EPR simulation aminoxyl.mat.sim1.nucs <- readMAT_params_file(aminoxyl.mat.file, str.var = "Sim1", field.var = "Nucs") # ## preview aminoxyl.mat.sim1.nucs # ## reading the magnetic flux density ## `B` column/vector corresponding to simulated ## and experimental EPR spectrum aminoxyl.B.G <- readMAT_params_file(aminoxyl.mat.file, str.var = "B") # ## preview of the first 6 values aminoxyl.B.G[1:6] # ## reading the intensity related to simulated ## EPR spectrum aminoxyl.sim.fitSpec <- readMAT_params_file(aminoxyl.mat.file, str.var = "fit1", field.var = "fitSpec") # ## for the newer EasySpin version (> 6.0.0), ## the "fitSpec" is replaced by the simple "fit", ## all additional parameters (array) are stored under ## the "pfit_full" variable # ## preview of the first 6 values aminoxyl.sim.fitSpec[1:6] # ## The last two examples can be used ## to load the simulated EPR spectrum ## by the `EasySpin` from `mat` file => simulation.aminoxyl.spectr.df <- data.frame(Bsim_G = aminoxyl.B.G, dIeprSim_over_dB = aminoxyl.sim.fitSpec) # ## preview head(simulation.aminoxyl.spectr.df)
/
from Quantum Chemical (QCH) ComputationsProviding table, based on Gaussian/ORCA/...etc. output text files in order to summarize
the mean /
values of groups with equivalent nuclei, according to proposed
molecular structure/symmetry.
rearrange_aAiso_QCHcomp(path_to_ASC, col.names, nuclei.list.slct)
rearrange_aAiso_QCHcomp(path_to_ASC, col.names, nuclei.list.slct)
path_to_ASC |
Character string, pointing to path of ASCII file ( |
col.names |
Character string vector, containing names of all columns from QCH computational output,
for the names see example in |
nuclei.list.slct |
List of numeric values for the rearrangement of selected atoms/nuclei according to symmetry,
e.g. |
The /
values are computed for each atom/nucleus
(with its corresponding
atomic number within the structure
as well as with the characteristic
isotopic number/value
), such an entire table can be copied e.g. from Gaussian output
(after 'Isotropic Fermi Contact Couplings'
line) or can be constructed from ORCA (or any other) output,
example for such a file structure (from Gaussian):
No_atom | Atom_Nucleus | MegaHertz | Gauss | 1e-4_cm-1 |
1 | N(14) | 0.00643 | 0.00229 | 0.00214 |
17 | N(14) | 13.99707 | 4.9945 | 4.66892 |
28 | H(1) | 16.34971 | 5.83398 | 5.45368 |
The input table/data frame, like the previous one, must include following columns: atomic/nucleus number, atom/nucleus notation,
hyperfine coupling constant in MHz
and finally hyperfine splitting constant in G
. These columns/variables
are essential for the evaluation.
Data frame/Table of /
mean values corresponding to groups
of equivalent nuclei within the structure/symmetry.
Other Evaluations and Quantum Chemistry:
eval_gFactor_QCHcomp()
,
rearrange_aAiso_QCHorgau()
## Not run: rearrange_aAiso_QCHcomp( "./iso_values_Gaussian.txt", c("No","Nucleus","au","Megahertz","Gauss","10^n4_cm^n1"), list(3,c(21,22),c(20,23),c(24,25),c(27,26)) ) ## End(Not run)
## Not run: rearrange_aAiso_QCHcomp( "./iso_values_Gaussian.txt", c("No","Nucleus","au","Megahertz","Gauss","10^n4_cm^n1"), list(3,c(21,22),c(20,23),c(24,25),c(27,26)) ) ## End(Not run)
/
from Gaussian & ORCA ComputationsProviding table, specifically from Gaussian
or ORCA
output text files to summarize
the /
mean values of groups with equivalent nuclei, according
to proposed molecular structure/symmetry (see also the
rearrange_aAiso_QCHcomp
).
rearrange_aAiso_QCHorgau( path_to_QCHoutput, N.nuclei, nuclei.list.slct, origin = "gaussian", output.text.origin = FALSE, output.text.path = NULL )
rearrange_aAiso_QCHorgau( path_to_QCHoutput, N.nuclei, nuclei.list.slct, origin = "gaussian", output.text.origin = FALSE, output.text.path = NULL )
path_to_QCHoutput |
Character string, corresponding to path of |
N.nuclei |
Numeric value that equals to number of atoms/nuclei within the calculated structure. |
nuclei.list.slct |
List of numeric values for the rearrangement of selected atoms/nuclei according to symmetry,
e.g. |
origin |
Character string, pointing to origin of DFT EPR calculation parameters <=> which
software package was used. Only two values are available => |
output.text.origin |
Logical, whether to write a text file containing the extracted
|
output.text.path |
Character string, setting the path to file containing
the extracted |
Data frame/Table of /
mean values, corresponding to groups
of proposed equivalent nuclei within the structure/symmetry constructed directly
from Gaussian or ORCA output text files.
Other Evaluations and Quantum Chemistry:
eval_gFactor_QCHcomp()
,
rearrange_aAiso_QCHcomp()
## built-in file and path gauss.file.path <- load_data_example(file = "TMPDAradCatEPRa.inp.log.zip") gauss.file <- unzip(gauss.file.path) symmetry.As.df <- rearrange_aAiso_QCHorgau(gauss.file, N.nuclei = 28, nuclei.list.slct = list(c(7, 8), ## 2 x 14N c(13, 14, 15, 16), ## 4 x 1H (aromatic) c(17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28) ## 12 x 1H (methyl groups) ) ) # ## preview symmetry.As.df
## built-in file and path gauss.file.path <- load_data_example(file = "TMPDAradCatEPRa.inp.log.zip") gauss.file <- unzip(gauss.file.path) symmetry.As.df <- rearrange_aAiso_QCHorgau(gauss.file, N.nuclei = 28, nuclei.list.slct = list(c(7, 8), ## 2 x 14N c(13, 14, 15, 16), ## 4 x 1H (aromatic) c(17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28) ## 12 x 1H (methyl groups) ) ) # ## preview symmetry.As.df
Smoothing of the EPR spectra by non-parametric fitting a smoothing spline, ss
from npreg package, onto the experimental
EPR spectrum/spectra.
smooth_EPR_Spec_by_npreg( data.spectr, B = "B_mT", B.unit = "mT", lineSpecs.form = "derivative", Intensity = "dIepr_over_dB", method = "BIC", output.vec = FALSE, ... )
smooth_EPR_Spec_by_npreg( data.spectr, B = "B_mT", B.unit = "mT", lineSpecs.form = "derivative", Intensity = "dIepr_over_dB", method = "BIC", output.vec = FALSE, ... )
data.spectr |
Spectrum data frame object where the magnetic flux density (in |
|||||||||||||||||||
B |
Character string, pointing to magnetic flux density |
|||||||||||||||||||
B.unit |
Character string, denoting the magnetic flux density unit e.g. |
|||||||||||||||||||
lineSpecs.form |
Character string, describing either |
|||||||||||||||||||
Intensity |
Character string, pointing to |
|||||||||||||||||||
method |
Character string, corresponding to method in order to fit an EPR spectrum by a smoothing spline
from
|
|||||||||||||||||||
output.vec |
Logical, whether the function output have to be vectorized, i.e. only the vector
of smoothed EPR intensity is provided. This is especially useful for the EPR spectral (time) series,
which can be handily processed by the |
|||||||||||||||||||
... |
additional arguments passed to the function (see also the |
The EPR spectrum is fitted by splines which, by default, correspond to cubic Bernoulli polynomials like
where equals to general EPR intensity and
is the magnetic flux density.
This may be applied to both derivative or single integrated EPR spectrum forms. Also a higher/lower polynomial
degree may be applied by the
method
(see the argument description) and by the m
optional argument
(see ...
additional arguments) which is a penalty order (integer). For the above-mentioned cubic
spline/polynomial m = 2
. Linear polynomial corresponds
to m = 1
and the highest quintic polynomial/spline is referred as m = 3
:
If the optional argument bernoulli
is set to FALSE
then "classic" definition
of a smoothing spline is produced. In such case, the function estimate is a piece-wise polynomial function
with pieces of degree 2m−1. Additional optional arguments from ss
like knots
definition, equivalent degrees of freedom, vector of weights...etc. can be applied as well.
If output.vec = TRUE
the output corresponds to vector of the smoothed EPR intensity
(either derivative lineSpecs.form = "derivative"
or integrated
lineSpecs.form = "integrated"/"absorption"
) with the length of the original Intensity
.
Contrarily, if the output.vec
is set to FALSE
the following list is returned =>
Original data frame with the addition column, corresponding to smoothed EPR intensity (derivative or integrated).
Plot object (list) EPR intensity vs. B with the experimental data and its corresponding smoothed relation performed by splines.
Weighted (if the optional parameter w
is defined) sum of residual squares.
Equivalent degrees of freedom used.
List with elements to characterize the spline fit (Details see fit
value
in the ss
function documentation).
Estimated standard deviation.
Akaike’s Information Criterion (if the method = "AIC"
). A negative number that has
the largest modulus (deepest down in the negative territory) indicates the preferred model.
Bayesian Information Criterion (if the method = "BIC"
). A negative number that has
the largest modulus (deepest down in the negative territory) indicates the preferred model.
Likelihood logarithm, if the method = "REML"/"ML"
. Log likelihood value
is a measure of goodness of fit for any model. The higher the value, the better the model.
Berry LN, Helwig NE (2021). “Cross-Validation, Information Theory, or Maximum Likelihood? A Comparison of Tuning Methods for Penalized Splines.” Stats, 4(3), 701–724, https://doi.org/10.3390/stats4030042.
Elezović N (2016). “Generalized Bernoulli Polynomials and Numbers, Revisited.” Mediterr. J. Math., 13(1), 141–151. ISSN 1660-5454, https://doi.org/10.1007/s00009-014-0498-7.
Weisstein EW (2023). “Bernoulli Polynomial”, https://mathworld.wolfram.com/BernoulliPolynomial.html, MathWorld–A Wolfram Web Resource.
Helwig NE (2022). "Non-parametric Regression via Smoothing Splines", R package version 1.0-9, https://cran.r-project.org/web/packages/npreg/npreg.pdf.
Other Simulations and Optimization:
eval_sim_EPR_iso()
,
eval_sim_EPR_isoFit()
,
eval_sim_EPR_iso_combo()
,
optim_for_EPR_fitness()
,
quantify_EPR_Sim_series()
## loading the built-in package example ## time series EPR spectra: triarylamine.decay.series.dsc.path <- load_data_example(file = "Triarylamine_radCat_decay_series.DSC") triarylamine.decay.series.asc.path <- load_data_example(file = "Triarylamine_radCat_decay_series.zip") unzip(triarylamine.decay.series.asc.path, exdir = tempdir() ) ## loading the kinetics: triarylamine.decay.series.data <- readEPR_Exp_Specs_kin(name.root = "Triarylamine_radCat_decay_series", dir_ASC = tempdir(), dir_dsc_par = system.file("extdata", package = "eprscope") ) # ## select the first spectrum triarylamine.decay.series.data1st <- triarylamine.decay.series.data$df %>% dplyr::filter(time_s == triarylamine.decay.series.data$time[1]) # ## smoothing the 1st EPR spectrum with default ## arguments/parameters triarylamine.1st.spec.smooth <- smooth_EPR_Spec_by_npreg(data.spectr = triarylamine.decay.series.data1st ) # ## plot preview triarylamine.1st.spec.smooth$plot # ## sum of residual squares preview triarylamine.1st.spec.smooth$rss # ## estimated standard deviation triarylamine.1st.spec.smooth$sigma # ## smoothing of all EPR spectra in the series ## with default arguments using the data ## "pipe" ("%>%") `dplyr` processing triarylamine.all.spec.smooth <- triarylamine.decay.series.data$df %>% dplyr::group_by(time_s) %>% dplyr::mutate(smoothed = smooth_EPR_Spec_by_npreg( dplyr::pick(B_mT,dIepr_over_dB), output.vec = TRUE ) ) # ## data frame preview head(triarylamine.all.spec.smooth) # ## plot all smoothed spectra in the series plot_EPR_Specs(data.spectra = triarylamine.all.spec.smooth, Intensity = "smoothed", var2nd.series = "time_s", var2nd.series.slct.by = 10, line.colors = c("darkorange", "darkblue"), legend.title = "Time (s)", yTicks = TRUE )
## loading the built-in package example ## time series EPR spectra: triarylamine.decay.series.dsc.path <- load_data_example(file = "Triarylamine_radCat_decay_series.DSC") triarylamine.decay.series.asc.path <- load_data_example(file = "Triarylamine_radCat_decay_series.zip") unzip(triarylamine.decay.series.asc.path, exdir = tempdir() ) ## loading the kinetics: triarylamine.decay.series.data <- readEPR_Exp_Specs_kin(name.root = "Triarylamine_radCat_decay_series", dir_ASC = tempdir(), dir_dsc_par = system.file("extdata", package = "eprscope") ) # ## select the first spectrum triarylamine.decay.series.data1st <- triarylamine.decay.series.data$df %>% dplyr::filter(time_s == triarylamine.decay.series.data$time[1]) # ## smoothing the 1st EPR spectrum with default ## arguments/parameters triarylamine.1st.spec.smooth <- smooth_EPR_Spec_by_npreg(data.spectr = triarylamine.decay.series.data1st ) # ## plot preview triarylamine.1st.spec.smooth$plot # ## sum of residual squares preview triarylamine.1st.spec.smooth$rss # ## estimated standard deviation triarylamine.1st.spec.smooth$sigma # ## smoothing of all EPR spectra in the series ## with default arguments using the data ## "pipe" ("%>%") `dplyr` processing triarylamine.all.spec.smooth <- triarylamine.decay.series.data$df %>% dplyr::group_by(time_s) %>% dplyr::mutate(smoothed = smooth_EPR_Spec_by_npreg( dplyr::pick(B_mT,dIepr_over_dB), output.vec = TRUE ) ) # ## data frame preview head(triarylamine.all.spec.smooth) # ## plot all smoothed spectra in the series plot_EPR_Specs(data.spectra = triarylamine.all.spec.smooth, Intensity = "smoothed", var2nd.series = "time_s", var2nd.series.slct.by = 10, line.colors = c("darkorange", "darkblue"), legend.title = "Time (s)", yTicks = TRUE )
Data frame summarizing the most important solvent properties for EPR/ENDOR which are required for variable temperature (VT) experiments and EPR spectroelectrochemistry.
solvents_ds
solvents_ds
A data frame with 46 rows and 10 variables/columns:
Character, solvent name.
Character, ponting to molecular formula.
Numeric, pointing to relative molecular weight.
Numeric, corresponding to boling point in °C.
Numeric, corresponding melting point in °C.
Numeric, corresponding to density in .
Character, pointing to solubility in water expressed
in . 2. Solubility of THF in water is rather complex.
Character, corresponding to relative permittivity.
Numeric, pointing to flash point in °C.
Character, corresponding to solvent dynamic viscosity
in . The values were collected from
Sigma-Aldrich
for 20°C;
PubChem NCBI for 20°C and 25°C
and from ACCU DYNE TEST for 20°C, 25°C or 30°C.
The main properties were collected from the Division of Organic Chemistry
of the ACS
and the Sigma-Aldrich.
Additional resources (e.g. for viscosities) are PubChem NCBI
and ACCU DYNE TEST. Besides that, the polarity of solvents
(expressed by the relative permitivity Dielectric_Const
) is important parameter to decide which tube/cell
has to be used for an experiment at specific temperature (unless the measurements performed directly in liquid )
=> for the polar solvents use capillaries or special "flat" cells (e.g. for EPR spectroelectrochemistry),
while for the less polar solvents, common quartz tubes (with the i.d. of
) can be applied.
See also
vignette("datasets")
.
https://organicchemistrydata.org/solvents/
https://pubchem.ncbi.nlm.nih.gov/
https://www.accudynetest.com/visc_table.html
Other Built-In Datasets:
isotopes_ds