-#from sowas
-adjust.noctave <- function(N,dt,s0,tw,noctave)
-{
- if (tw>0)
- {
- dumno <- as.integer((log(N*dt)-log(2*tw*s0))/log(2))
- if (dumno<noctave)
- {
- cat("# noctave adjusted to time smoothing window \n")
- noctave <- dumno
- }
- }
- noctave
-}
-
-#from sowas
-cwt.ts <- function(ts,s0,noctave=5,nvoice=10,w0=2*pi)
-{
- if (class(ts)!="ts")
- stop("# This function needs a time series object as input. You may construct this by using the function ts(data,start,deltat). Try '?ts' for help.\n")
-
- t=time(ts)
- dt=t[2]-t[1]
- s0unit=s0/dt*w0/(2*pi)
- s0log=as.integer((log2(s0unit)-1)*nvoice+1.5)
- if (s0log<1)
- {
- cat(paste("# s0unit = ",s0unit,"\n",sep=""))
- cat(paste("# s0log = ",s0log,"\n",sep=""))
- cat("# s0 too small for w0! \n")
- }
- totnoct=noctave+as.integer(s0log/nvoice)+1
-
- #cwt from package Rwave
- totts.cwt=cwt(ts,totnoct,nvoice,w0,plot=0)
- ts.cwt=totts.cwt[,s0log:(s0log+noctave*nvoice)]
-
- #Normalization
- sqs <- sqrt(2^(0:(noctave*nvoice)/nvoice)*s0)
- smat <- matrix(rep(sqs,length(t)),nrow=length(t),byrow=TRUE)
-
- ts.cwt*smat
-}
-
-#NOTE: vect2mat = as.matrix ?! (dans aux.R)
-vect2mat <- function(vect, delta, lscvect)
-{
- vect <- as.vector(vect)
-
-print(delta)
-print(lscvect)
-print(delta * lscvect)
-browser()
-
-
- matrix(vect[-(1:2)], delta, lscvect)
-}
-
-#fonction smCWT (dans aux.R)
-smCWT <- function(CWT, sw= 0, tw= 0, swabs= 0, nvoice= 12, noctave= 2, s0= 2, w0= 2*pi,
- lt= 24, dt= 0.5, scalevector )