Skip to content

Commit

Permalink
Prepare CRAN submission:
Browse files Browse the repository at this point in the history
- update version number
- Add S3 exports
- Remove C++11 from makevars
  • Loading branch information
constantino-garcia committed Apr 1, 2024
1 parent 41713b6 commit aa2ab28
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 23 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ README.md
^cran-comments.md
^doc$
^Meta$
.github
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: nonlinearTseries
Type: Package
Title: Nonlinear Time Series Analysis
Version: 0.2.13
Date: 2022-3-28
Version: 0.3.0
Date: 2024-4-1
Maintainer: Constantino A. Garcia <constantino.garciama@ceu.es>
Authors@R: c(person("Constantino A.", "Garcia",
email = "constantino.garciama@ceu.es",
Expand Down Expand Up @@ -40,5 +40,5 @@ Suggests:
rmarkdown,
testthat
VignetteBuilder: knitr
RoxygenNote: 7.2.3
RoxygenNote: 7.3.0
Encoding: UTF-8
11 changes: 11 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ S3method(corrMatrix,corrDim)
S3method(divTime,maxLyapunov)
S3method(divergence,maxLyapunov)
S3method(embeddingDims,corrDim)
S3method(embeddingDims,default)
S3method(embeddingDims,infDim)
S3method(embeddingDims,maxLyapunov)
S3method(embeddingDims,sampleEntropy)
Expand All @@ -18,7 +19,10 @@ S3method(estimate,maxLyapunov)
S3method(estimate,sampleEntropy)
S3method(fixedMass,infDim)
S3method(fluctuationFunction,dfa)
S3method(freq,spectrogram)
S3method(getAlpha,spectralIndex)
S3method(getContourLines,spaceTimePlot)
S3method(getHurst,spectralIndex)
S3method(logRadius,infDim)
S3method(nlOrder,corrDim)
S3method(nlOrder,sampleEntropy)
Expand All @@ -30,13 +34,20 @@ S3method(plot,mutualInf)
S3method(plot,rqa)
S3method(plot,sampleEntropy)
S3method(plot,spaceTimePlot)
S3method(plot,spectralIndex)
S3method(plot,spectrogram)
S3method(plot,surrogateTest)
S3method(plotLocalScalingExp,corrDim)
S3method(plotLocalScalingExp,infDim)
S3method(print,corrDim)
S3method(radius,corrDim)
S3method(radius,default)
S3method(radius,sampleEntropy)
S3method(sampleEntropyFunction,sampleEntropy)
S3method(spectrogram,default)
S3method(spectrogram,ts)
S3method(spectrogram,zoo)
S3method(time,spectrogram)
S3method(windowSizes,dfa)
export(FFTsurrogate)
export(buildTakens)
Expand Down
2 changes: 2 additions & 0 deletions R/generics.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ embeddingDims = function(x){
UseMethod("embeddingDims")
}

#' @export
embeddingDims.default = function(x){
x$embedding.dims
}
Expand All @@ -50,6 +51,7 @@ radius = function(x){
UseMethod("radius")
}

#' @export
radius.default = function(x){
x$radius
}
Expand Down
8 changes: 3 additions & 5 deletions R/spectralIndex.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ spectralIndexObject = function(fit, spec) {
spectral_index_fit
}

# @export
#' @export
plot.spectralIndex = function(x, type = "l", log = "xy",
ylab = "spectrum", xlab = "normalized frequency",
...) {
Expand All @@ -59,13 +59,12 @@ plot.spectralIndex = function(x, type = "l", log = "xy",
}


# @export
getHurst = function(x) {
UseMethod("getHurst")
}


# @export
#' @export
getHurst.spectralIndex = function(x) {
beta = x$spectral_index_fit[[1]]
Hs = c(H_fgn = NA, H_fbm = NA)
Expand All @@ -78,12 +77,11 @@ getHurst.spectralIndex = function(x) {
Hs
}

# @export
getAlpha = function(x) {
UseMethod("getAlpha")
}

# @export
#' @export
getAlpha.spectralIndex = function(x) {
(x$spectral_index_fit[[1]] + 1) / 2
}
Expand Down
21 changes: 8 additions & 13 deletions R/spectral_functions.R
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
# @export
hamming = function(n, alpha = 0.54, beta = 0.46){
alpha - beta * cospi (2 * (0:(n - 1)) / (n - 1))
}

# @export
hanning = function(n) {
0.5 * (1 - cospi( 2* (0:(n - 1)) / (n - 1)))
}

# @export
blackman = function(n, alpha = 0.16) {
a0 = (1 - alpha) / 2
a1 = 1 / 2
Expand All @@ -19,12 +16,11 @@ blackman = function(n, alpha = 0.16) {


#' @import zoo
# @export
spectrogram = function(x, ...){
spectrogram = function(x, width, by, pad = 0){
UseMethod("spectrogram")
}

# @export
#' @export
spectrogram.default = function(x, width, by, pad = 0) {
if (width < 2) {
stop("width must be >= 2")
Expand All @@ -47,21 +43,21 @@ spectrogram.default = function(x, width, by, pad = 0) {
spec
}

# @export
#' @export
spectrogram.ts = function(x, width, by, pad = 0) {
spec = spectrogram(as.numeric(x), width = width, by = by, pad = pad)
attr(spec,"freq") = attr(spec,"freq") * frequency(x)
attr(spec, "time") = attr(spec, "time") / frequency(x)
spec
}

# @export
#' @export
spectrogram.zoo = function(x, width, by, pad = 0) {
spectrogram.ts(as.ts(x), width = width, by = by, pad = pad)
}


# @export
#' @export
plot.spectrogram = function(x, color.palette = terrain.colors,
xlab = "Time", ylab = "Frequency(Hz)",
main = "Spectrogram",
Expand All @@ -77,17 +73,16 @@ plot.spectrogram = function(x, color.palette = terrain.colors,
zlim = zlim, ...)
}

# @export
time.spectrogram = function(x) {
#' @export
time.spectrogram = function(x, ...) {
attr(x, "time")
}

# @export
freq = function(x){
UseMethod("freq")
}

# @export
#' @export
freq.spectrogram = function(x){
attr(x, "freq")
}
1 change: 0 additions & 1 deletion src/Makevars
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
CXX_STD=CXX11
PKG_CPPFLAGS=-I. -IANN -DRANN
PKG_LIBS = $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)
1 change: 0 additions & 1 deletion src/Makevars.win
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
CXX_STD=CXX11
PKG_LIBS=-lws2_32 $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)
PKG_CPPFLAGS=-I. -IANN -O3 -DWIN32 -DDLL_EXPORTS -DANN_NO_RANDOM -DRANN

0 comments on commit aa2ab28

Please sign in to comment.