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

clean doc

parent 03558654
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -2,8 +2,8 @@ Package: gtseries ...@@ -2,8 +2,8 @@ Package: gtseries
Encoding: UTF-8 Encoding: UTF-8
Type: Package Type: Package
Title: Time Series Analysis for Paleoclimate and Cyclostratigraphy Purposes Title: Time Series Analysis for Paleoclimate and Cyclostratigraphy Purposes
Version: 1.05 Version: 1.3
Date: 2023-12-15 Date: 2025-02-19
Author: Michel Crucifix [aut, cre] (<https://orcid.org/0000-0002-3437-4911>) Author: Michel Crucifix [aut, cre] (<https://orcid.org/0000-0002-3437-4911>)
Maintainer: Michel Crucifix <michel.crucifix@uclouvain.be> Maintainer: Michel Crucifix <michel.crucifix@uclouvain.be>
Description: Collection of time series analysis tools, focused on spectral decomposition and reconstruction, with an original focus on astronomical theory of paleoclimates and cyclostratigraphy. Description: Collection of time series analysis tools, focused on spectral decomposition and reconstruction, with an original focus on astronomical theory of paleoclimates and cyclostratigraphy.
......
...@@ -64,8 +64,8 @@ develop.discreteSpectrum <- function(M, start = NULL, end = NULL, deltat = NULL ...@@ -64,8 +64,8 @@ develop.discreteSpectrum <- function(M, start = NULL, end = NULL, deltat = NULL
if (!is.null(maxfreq)) nfreq <- min(nfreq, maxfreq) if (!is.null(maxfreq)) nfreq <- min(nfreq, maxfreq)
if (timesIsATseries){ if (timesIsATseries){
reconstructed <- lapply(seq(nfreq), function(i) ts( M$Amp[i] * dfunction(M$Freq[i] * times + M$Phase[i]), start=start, deltat=deltat) )} reconstructed <- lapply(seq(nfreq), function(i) ts( M$Amp[i] * dfunction(M$Freq[i] * times + M$Phase[i]), start=start, deltat=deltat) )
else { } else {
reconstructed <- sapply(seq(nfreq), function(i) M$Amp[i] * dfunction(M$Freq[i] * times + M$Phase[i]) ) reconstructed <- sapply(seq(nfreq), function(i) M$Amp[i] * dfunction(M$Freq[i] * times + M$Phase[i]) )
} }
...@@ -78,11 +78,12 @@ if ( sum ) { ...@@ -78,11 +78,12 @@ if ( sum ) {
else else
reconstructed <- apply(reconstructed, 1 , sum) + trend * times + shift reconstructed <- apply(reconstructed, 1 , sum) + trend * times + shift
} else if (timesIsATseries) { } else if (timesIsATseries) {
reconstructed <- apply(reconstructed, 2, function(x) ts(x,start=start, deltat=deltat)) reconstructed <- lapply(reconstructed, function(x) ts(x,start=start, deltat=deltat))
} }
return(reconstructed) return(reconstructed)
} }
#' Discrete spectrum class
#' @rdname discreteSpectrum #' @rdname discreteSpectrum
#' @export #' @export
as.data.frame.discreteSpectrum <- function(x) {data.frame(Freq=x$Freq, Amp=x$Amp, Phases=x$Phases)} as.data.frame.discreteSpectrum <- function(x) {data.frame(Freq=x$Freq, Amp=x$Amp, Phases=x$Phases)}
...@@ -125,8 +126,9 @@ lines.discreteSpectrum <- function (M,...){ ...@@ -125,8 +126,9 @@ lines.discreteSpectrum <- function (M,...){
#' @rdname discreteSpectrum #' @rdname discreteSpectrum
#' @export #' @export
print.discreteSpectrum <- function (M,...){ print.discreteSpectrum <- function (M,...){
N <- nrows(as.data.frame(M)) N <- nrow(as.data.frame(M))
print.data.frame(cbind(as.data.frame(M[:,min(10,N)]), Period=2*pi/M$Freq)) to_print <- seq(min(10,N))
print.data.frame(cbind(as.data.frame(M)[to_print, ], Period=2*pi/M$Freq[to_print]))
if (N > 10) print(sprintf("... + %d other rows \n", N-10)) if (N > 10) print(sprintf("... + %d other rows \n", N-10))
} }
......
...@@ -9,9 +9,11 @@ ...@@ -9,9 +9,11 @@
start = NULL, start = NULL,
end = NULL, end = NULL,
deltat = NULL, deltat = NULL,
times, times = NULL,
dfunction = cos, dfunction = cos,
sum = TRUE maxfreq = NULL,
sum = TRUE,
trendshift = TRUE
) )
} }
\arguments{ \arguments{
...@@ -23,6 +25,8 @@ ...@@ -23,6 +25,8 @@
\item{sum}{: TRUE if user wants to sum components %in% the reconstruction} \item{sum}{: TRUE if user wants to sum components %in% the reconstruction}
\item{trendshift}{: TRUE if user wants to account for trend and shift encoded in the discreteSpectrum object}
\item{times:}{if supplied, times of the decomposition} \item{times:}{if supplied, times of the decomposition}
\item{start:}{if supplied, overrides time and will generate a time series with start and deltat, which must then \item{start:}{if supplied, overrides time and will generate a time series with start and deltat, which must then
......
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