Skip to content
Extraits de code Groupes Projets

Comparer les révisions

Les modifications sont affichées comme si la révision source était fusionnée avec la révision cible. En savoir plus sur la comparaison des révisions.

Source

Sélectionner le projet cible
No results found

Cible

Sélectionner le projet cible
  • mcrucifix/tseries
1 résultat
Afficher les modifications
Validations sur la source (3)
......@@ -2,8 +2,8 @@ Package: gtseries
Encoding: UTF-8
Type: Package
Title: Time Series Analysis for Paleoclimate and Cyclostratigraphy Purposes
Version: 1.05
Date: 2023-12-15
Version: 1.3
Date: 2025-02-19
Author: Michel Crucifix [aut, cre] (<https://orcid.org/0000-0002-3437-4911>)
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.
......
......@@ -64,8 +64,8 @@ develop.discreteSpectrum <- function(M, start = NULL, end = NULL, deltat = NULL
if (!is.null(maxfreq)) nfreq <- min(nfreq, maxfreq)
if (timesIsATseries){
reconstructed <- lapply(seq(nfreq), function(i) ts( M$Amp[i] * dfunction(M$Freq[i] * times + M$Phase[i]), start=start, deltat=deltat) )}
else {
reconstructed <- lapply(seq(nfreq), function(i) ts( M$Amp[i] * dfunction(M$Freq[i] * times + M$Phase[i]), start=start, deltat=deltat) )
} else {
reconstructed <- sapply(seq(nfreq), function(i) M$Amp[i] * dfunction(M$Freq[i] * times + M$Phase[i]) )
}
......@@ -78,11 +78,12 @@ if ( sum ) {
else
reconstructed <- apply(reconstructed, 1 , sum) + trend * times + shift
} 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)
}
#' Discrete spectrum class
#' @rdname discreteSpectrum
#' @export
as.data.frame.discreteSpectrum <- function(x) {data.frame(Freq=x$Freq, Amp=x$Amp, Phases=x$Phases)}
......@@ -126,7 +127,8 @@ lines.discreteSpectrum <- function (M,...){
#' @export
print.discreteSpectrum <- function (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))
}
......
......@@ -9,9 +9,11 @@
start = NULL,
end = NULL,
deltat = NULL,
times,
times = NULL,
dfunction = cos,
sum = TRUE
maxfreq = NULL,
sum = TRUE,
trendshift = TRUE
)
}
\arguments{
......@@ -23,6 +25,8 @@
\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{start:}{if supplied, overrides time and will generate a time series with start and deltat, which must then
......
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/develop.R
\name{as.data.frame.discreteSpectrum}
\alias{as.data.frame.discreteSpectrum}
\alias{plot.discreteSpectrum}
\alias{lines.discreteSpectrum}
\alias{print.discreteSpectrum}
\title{Discrete spectrum class}
\usage{
\method{as.data.frame}{discreteSpectrum}(x)
\method{plot}{discreteSpectrum}(M, periods = FALSE, labels = NULL, ...)
\method{lines}{discreteSpectrum}(M, ...)
\method{print}{discreteSpectrum}(M, ...)
}
\arguments{
\item{periods}{if TRUE will add a lower axis with period labels}
\item{labels}{to be set above the frequency peaks. Can be the output of `attributeTone`}
\item{a}{`discreteSpectrum` object, typically the output of a `mfft` call.}
}
\description{
Discrete spectrum class
}