Skip to content
Extraits de code Groupes Projets
Valider 7ee6ae53 rédigé par Michel Crucifix's avatar Michel Crucifix
Parcourir les fichiers

tonecombinations

parent a813aba6
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -10,8 +10,6 @@ Description: Collection of time series analysis tools, focused on spectral decom ...@@ -10,8 +10,6 @@ Description: Collection of time series analysis tools, focused on spectral decom
License: MIT licence License: MIT licence
LazyLoad: yes LazyLoad: yes
RoxygenNote: 7.3.2 RoxygenNote: 7.3.2
Imports: Rdpack, sfsmisc, cmna, gsignal, pracma Imports: Rdpack, sfsmisc, cmna, gsignal, pracma, RcppAlgos
RdMacros: Rdpack RdMacros: Rdpack
Depends:
R (>= 2.10)
LazyData: true LazyData: true
...@@ -94,9 +94,11 @@ generate_name <- function(invec,char="s", labels = NULL){ ...@@ -94,9 +94,11 @@ generate_name <- function(invec,char="s", labels = NULL){
#' @param infreq : input frequencies #' @param infreq : input frequencies
#' @param omegas : reference frequencies (a numeric vector which may contain explicit row names) #' @param omegas : reference frequencies (a numeric vector which may contain explicit row names)
#' @param fractions : 1, 2, or 3 depending on willing to include singe, double or triple periods #' @param fractions : 1, 2, or 3 depending on willing to include singe, double or triple periods
#' @param keepPositives : argument passed to `toneCombinations`
#' @param tol1 : acceptable tolerance for being considered as a certain attribution #' @param tol1 : acceptable tolerance for being considered as a certain attribution
#' (if several frequencies match the criteria, the closest will be taken) #' (if several frequencies match the criteria, the closest will be taken)
#' @param tol2 : acceptable tolerance for being considered as a likely or plausible #' @param tol2 : acceptable tolerance for being considered as a likely or plausible
#' @seealso toneCombinations
#' @export attributeTones #' @export attributeTones
#' #'
#' @examples #' @examples
...@@ -112,9 +114,9 @@ generate_name <- function(invec,char="s", labels = NULL){ ...@@ -112,9 +114,9 @@ generate_name <- function(invec,char="s", labels = NULL){
#' plot(outfreqs, outamps, type='h') #' plot(outfreqs, outamps, type='h')
#' text(outfreqs, outamps+0.1, attributions) #' text(outfreqs, outamps+0.1, attributions)
#' #'
attributeTones <- function(infreq , omegas, fractions=1, tol1 = 1.e-6, tol2 = 1.e-4) { attributeTones <- function(infreq , omegas, fractions=1, tol1 = 1.e-6, tol2 = 1.e-4, keepPositives=TRUE) {
attributions <- rep("", length(infreq)) attributions <- rep("", length(infreq))
combis <- toneCombinations(omegas, fractions=fractions) combis <- toneCombinations(omegas, fractions=fractions, keepPositives)
for (i in seq(infreq)){ for (i in seq(infreq)){
deltas <- abs(infreq[i] - combis) deltas <- abs(infreq[i] - combis)
bestSuspect <- which.min(abs(infreq[i] - combis)) bestSuspect <- which.min(abs(infreq[i] - combis))
......
...@@ -4,7 +4,14 @@ ...@@ -4,7 +4,14 @@
\alias{attributeTones} \alias{attributeTones}
\title{Attribution of combination of tones} \title{Attribution of combination of tones}
\usage{ \usage{
attributeTones(infreq, omegas, fractions = 1, tol1 = 1e-06, tol2 = 1e-04) attributeTones(
infreq,
omegas,
fractions = 1,
tol1 = 1e-06,
tol2 = 1e-04,
keepPositives = TRUE
)
} }
\arguments{ \arguments{
\item{infreq}{: input frequencies} \item{infreq}{: input frequencies}
...@@ -17,6 +24,8 @@ attributeTones(infreq, omegas, fractions = 1, tol1 = 1e-06, tol2 = 1e-04) ...@@ -17,6 +24,8 @@ attributeTones(infreq, omegas, fractions = 1, tol1 = 1e-06, tol2 = 1e-04)
(if several frequencies match the criteria, the closest will be taken)} (if several frequencies match the criteria, the closest will be taken)}
\item{tol2}{: acceptable tolerance for being considered as a likely or plausible} \item{tol2}{: acceptable tolerance for being considered as a likely or plausible}
\item{keepPositives}{: argument passed to `toneCombinations`}
} }
\description{ \description{
Based on a vector of frequencies (`infreq`), and a vector of referenc Based on a vector of frequencies (`infreq`), and a vector of referenc
...@@ -37,3 +46,6 @@ plot(outfreqs, outamps, type='h') ...@@ -37,3 +46,6 @@ plot(outfreqs, outamps, type='h')
text(outfreqs, outamps+0.1, attributions) text(outfreqs, outamps+0.1, attributions)
} }
\seealso{
toneCombinations
}
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter