\HeaderA{accessC.wd}{Get smoothed data from wavelet object (wd)}{accessC.wd}
\keyword{manip}{accessC.wd}
\begin{Description}\relax
The smoothed and original data from a wavelet decomposition structure
(returned from \code{\LinkA{wd}{wd}}) are packed into a single vector in that
structure.  This function extracts the data corresponding to a
particular resolution level.
\end{Description}
\begin{Usage}
\begin{verbatim}
accessC.wd(wd, level = wd$nlevels, boundary=FALSE, aspect, ...)

\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{wd}] wavelet decomposition structure from which you wish to extract the
smoothed or original data if the structure is from a wavelet decomposition,
or the reconstructed data if the structure is from a wavelet reconstruction.

\item[\code{level}] the level that you wish to extract.  By default, this is the level with
most detail (in the case of structures from a decomposition this is the
original data, in the case of structures from a reconstruction this is the
top-level reconstruction).

\item[\code{boundary}] logical;
if \code{TRUE} then all of the boundary correction values
will be returned as well (note: the length of the returned vector
may not be a power of 2).\\
If \code{boundary} is false, then just the coefficients will be returned.

If the decomposition (or reconstruction)
was done with periodic boundary conditions, this option has no effect.
\item[\code{aspect}] 
\item[\code{...}] any other arguments
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
The \LinkA{wd}{wd} (\code{\LinkA{wr.wd}{wr.wd}}) function produces a wavelet decomposition (reconstruction)
structure.

For decomposition, the top level contains the original data, and
subsequent lower levels contain the successively smoothed data.
So if there are \eqn{2^m}{} original data points, there will be m+1 levels
indexed 0,1,\dots{},m. So

\code{accessC.wd(wdobj, level=m)}

pulls out the original data, as does

\code{accessC.wd(wdobj)}

To get hold of lower levels just specify the level that you're interested
in, e.g.

\code{accessC.wd(wdobj, level=2)}

gets hold of the second level.

For reconstruction, the top level contains the ultimate step in the
Mallat pyramid reconstruction algorithm, lower levels are intermediate
steps.

The need for this function is a consequence of the pyramidal structure
of Mallat's algorithm and the memory efficiency gain achieved by
storing the pyramid as a linear vector. AccessC obtains information about
where the smoothed data appears from the fl.dbase component of
an \LinkA{wd.object}{wd.object}, in particular the array \code{fl.dbase\$first.last.c} which
gives a complete specification of index numbers and offsets for
\code{wd.object\$C}.

Note that this function is method for the generic function \code{\LinkA{accessC}{accessC}}.
When the \code{\LinkA{wd.object}{wd.object}} is definitely a wd class object then you only need use the generic version of this function. 

Note that this function only gets information from \code{\LinkA{wd}{wd}} class
objects. To insert coefficients etc. into \code{\LinkA{wd}{wd}} structures you have to
use the \code{\LinkA{putC}{putC}} function (or more precisely, the \code{\LinkA{putC.wd}{putC.wd}} method).
\end{Details}
\begin{Value}
A vector of the extracted data.
\end{Value}
\begin{Section}{RELEASE}
Version 3.5.3 Copyright Guy Nason 1994
\end{Section}
\begin{References}\relax
Mallat, S. G. (1989) A theory for multiresolution signal decomposition: 
the wavelet representation. \emph{IEEE Transactions on Pattern Analysis
and Machine Intelligence. \bold{11}, 674--693.

Nason, G. P. and Silverman, B. W. (1994). The discrete wavelet transform in S. 
\emph{Journal of Computational and Graphical Statistics,} \bold{3}, 163--191. 
}
\section{RELEASE}{Version 3.5.3 Copyright Guy Nason 1994}
\seealso{ \code{\LinkA{wr}{wr}}, \code{\LinkA{wd}{wd}}, \code{\LinkA{accessD}{accessD}}, \code{\LinkA{accessD.wd}{accessD.wd}},
\code{\LinkA{filter.select}{filter.select}}, \code{\LinkA{threshold}{threshold}}, \code{\LinkA{putC.wd}{putC.wd}}, \code{\LinkA{putD.wd}{putD.wd}}.}
\end{References}
\begin{SeeAlso}\relax
\code{\LinkA{wr}{wr}}, \code{\LinkA{wd}{wd}}, \code{\LinkA{accessD}{accessD}}, \code{\LinkA{accessD.wd}{accessD.wd}},
\code{\LinkA{filter.select}{filter.select}}, \code{\LinkA{threshold}{threshold}}, \code{\LinkA{putC.wd}{putC.wd}}, \code{\LinkA{putD.wd}{putD.wd}}.
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
## Get the 3rd level of smoothed data from a decomposition
#accessC(wd(data), level=3)
#
# Plot the time series from a reconstruction
#ts.plot(accessC(reconstruction))
\end{ExampleCode}
\end{Examples}

