Department of Computer Science, University of California, Santa Barbara, CA, USA

Department of Statistics and Applied Probability, University of California, Santa Barbara, CA, and Google Inc, Mountain View, CA, USA

Abstract

Background

Wavelets have proven to be a powerful technique for the analysis of periodic data, such as those that arise in the analysis of circadian oscillators. While many implementations of both continuous and discrete wavelet transforms are available, we are aware of no software that has been designed with the nontechnical end-user in mind. By developing a toolkit that makes these analyses accessible to end users without significant programming experience, we hope to promote the more widespread use of wavelet analysis.

Findings

We have developed the WAVOS toolkit for wavelet analysis and visualization of oscillatory systems. WAVOS features both the continuous (Morlet) and discrete (Daubechies) wavelet transforms, with a simple, user-friendly graphical user interface within MATLAB. The interface allows for data to be imported from a number of standard file formats, visualized, processed and analyzed, and exported without use of the command line. Our work has been motivated by the challenges of circadian data, thus default settings appropriate to the analysis of such data have been pre-selected in order to minimize the need for fine-tuning. The toolkit is flexible enough to deal with a wide range of oscillatory signals, however, and may be used in more general contexts.

Conclusions

We have presented WAVOS: a comprehensive wavelet-based MATLAB toolkit that allows for easy visualization, exploration, and analysis of oscillatory data. WAVOS includes both the Morlet continuous wavelet transform and the Daubechies discrete wavelet transform. We have illustrated the use of WAVOS, and demonstrated its utility for the analysis of circadian data on both bioluminesence and wheel-running data. WAVOS is freely available at

Background

Many real-world sources of data display suggestively periodic behavior, but with time-varying period, amplitude, or mean. This variation can lead to inaccurate results when the data is analyzed with standard Fourier techniques, as Fourier analysis assumes stationarity of the signal and its basis functions are unbounded in time

Wavelet analysis has proven to be invaluable in many problem domains, including ecological cycles

The wavelet transform, in both continuous (Morlet) and discrete (Daubechies) versions, offers a set of tools for the analysis of nonstationary oscillators that can avoid many of the issues associated with techniques that assume stationarity. The Morlet continuous wavelet transform can nonparametricallydenoise, detrend, and analyze the local frequency content of a signal in a single operation

We have designed WAVOS to be a comprehensive, user-friendly toolbox for wavelet analysis and visualization of oscillatory signals that makes beginning-to-end wavelet processing and analysis accessible to users with a minimum of expertise in mathematics or computing. We present several analyses via a graphical user interface as illustrated in Figures

CWTgui main interface

**CWTgui main interface**. The main user interface of CWTgui, containing controls to load the data, select analysis parameters, and select the output type and location. CWTgui performs batch analysis of a dataset using the Morlet CWT and returns the results as either a MATLAB environment variable, or saved to a file.

CWTvis main interface

**CWTvis main interface**. The main user interface of CWTvis, containing controls to load the data, select analysis parameters, and explore various plotting and output options. CWTvis allows the user to visualize the output of wavelet operations on individual data traces before beginning a batch analysis using CWTgui.

DWTgui main interface

**DWTgui main interface**. The main user interface of DWTgui.

Implementation

WAVOS is implemented in MATLAB to allow for easy modification. The convolutions required for both the discrete and continuous wavelet transforms are performed in the Fourier domain. Several options are provided for managing the implicit periodization and corresponding boundary effects that this produces in the CWT, including zero-padding, edge-reweighting, and truncation of affected CWT coefficients (as in

For the discrete wavelet transform, the standard decimated transform may cause localization issues for particularly sharp transients, depending upon the place at which the signal is split during decimation. The transient may be completely contained in a particular coefficient of the transform, or it may be split between two adjacent coefficients. This has the undesirable effect of potentially allowing two different rotations of identical data to produce two different sets of DWT coefficients

The default parameters in the GUI are geared towards analysis of circadian signals. In particular, the minimum and maximum periods default to 6 and 48, respectively, with a default sampling rate of 1. These presets assume hourly samples of data with periods of interest in the above range. Both the sampling rate and the periods of interest may be adjusted independently of each other. The tool will not attempt to analyse periodicities that exceed the minimum or maximum possible due to numberof samples and sampling rate, and will emit a warning message with the actual bounds used if such an analysis is attempted. For DWT denoising, a default p-value of 0.05 is used, as this is a generally accepted standard for statistical significance. Users may also select different levels of the decomposition by hand, in order to focus on periodicities of the data that interest them.

Due to the native MATLAB implementation, long time series (on the order of 10,000 or more observations) may result in analyses requiring several minutes per time series to complete. This may be mitigated by reducing the range of periods to be analyzed in the CWT, or down-sampling the series to a shorter one with a smaller number of samples per unit time. Data sets containing a large number of time series with a large number of samples may exhaust MATLAB's working memory, causing an error; this will depend strongly on the computer being used. Due to MATLAB's representation of data in matrix form, all time series in a single data set to be processed as a batch must contain an equal number of observations. Time series with differing numbers of observations may be processed and analyzed separately.

Usage

The CWT and DWT have different features that incline them toward different uses. The Morlet CWT is most useful for investigating local properties of a signal: its detailed decomposition of time and frequency allows for very close tracking of several statistics of interest, however it cannot efficiently reconstruct a signal from individual components. The DWT fills a complementary role; while its time-frequency decomposition is very coarse, it is capable of reconstruction of a signal and also permits statistical testing. This allows the DWT to be used for many familiar signal-processing tasks, such as denoising and detrending, that are difficult to accomplish with the CWT.

The Morlet CWT may be viewed as a modification of the windowed Fourier transform (WFT) that scales the size of the window to a constant number of wavelengths for any analysis frequency

Synthetic signal A

**Synthetic signal A**. Synthetic signal A; decreasing period from 24 to 18 hours, stable baseline, decaying amplitude. Shifting periods are not effectively detectable by the Fourier transform, and will lead to poor estimates of the period. In contrast, analysis by the CWTyields local estimates of the period.

CWTheatmap of synthetic signal A

**CWTheatmap of synthetic signal A**. The first step of analysis of synthetic signal A (Figure 4) with the CWT: generating the CWT heatmap. The upper panel shows the complete CWT heatmap, the lower panel shows the CWT heatmap with all edge-influenced coefficients removed. The ridge is overlaid in green.

Period estimates for synthetic signal A

**Period estimates for synthetic signal A**. Estimated period of synthetic signal A (Figure 4), showing three different edge correction options. These estimates are derived from the ridge of the heatmap as shown in Figure 5. The true period is overlaid in green. This data may be plotted via CWTvis and exported to either an external file or a MATLAB variable with CWTgui.

Feature extraction for synthetic signal A

**Feature extraction for synthetic signal A**. Estimated peak, troughs, and instantaneous amplitude of synthetic signal A (Figure 4) estimated via the CWT; this plot may be visualized in CWTvis and exported to either an external file or a MATLAB variable with CWTgui.

The CWT is excellent for examining local features of a signal. On the other hand, it is not well-suited for signal processing tasks such as decomposing the signal into different wavelengths, discarding or shrinking some coefficients related to particularwavelengths, and reconstructing the signal. Fortunately, the Discrete Wavelet Transform is well-suited for these tasks. Figure

Denoising/detrending of synthetic signal A

**Denoising/detrending of synthetic signal A**. Denoising/detrending of the synthetic signal A (Figure 4) using the DWT. The upper panel displays the output of the DWT processing of signal A on the basis of p-value, retaining only those coefficients with a p-value of less than 0.05. The lower panel displays the output of the DWT processing of signal A by hard-thresholding period boundaries. Note that p-value based processing typically retains a non-zero mean as well as moving baselines, since these tend to be statistically significant.

Synthetic signal B

**Synthetic signal B**. Synthetic signal B; stable period with censored middle. The gap causes Fourier methods substantial difficulty.

CWTheatmap of synthetic signal B

**CWTheatmap of synthetic signal B**. The first step of analysis of synthetic signal B (Figure 9) with the CWT: generating the CWT heatmap. The upper panel shows complete CWT heatmap. The lower panel shows the CWT heatmap with all edge-influenced coefficients removed. The ridge is overlaid in green. Note that a small distortion is created by the missing data, however the CWT is capable of interpolating over this range.

Period estimates for synthetic signal B

**Period estimates for synthetic signal B**. Estimated period of synthetic signal B (Figure 9), showing three different edge correction options. These estimates are derived from the ridge of the heatmap as shown in Figure 10. The true period is overlaid in green. This data may be plotted via CWTvis and exported to either an external file or a MATLAB variable with CWTgui. As in Figure 10, the period estimate is successfully interpolated across the missing data, albeit with some distortion.

Feature extraction for synthetic signal B

**Feature extraction for synthetic signal B**. Estimated peak, troughs, and instantaneous amplitude of synthetic signal B (Figure 9) estimated via the CWT; this plot may be visualized in CWTvis and exported to either an external file or a MATLAB variable with CWTgui. The amplitude estimate suffers somewhat from the missing data, however the peak-trough estimates are successfullyinterpolated.

Denoising/detrending of synthetic signal B

**Denoising/detrending of synthetic signal B**. Denoising/detrending of the synthetic signal B (figure 9) using the DWT. The upper panel displays the output of the DWT processing of signal B on the basis of p-value, only retaining those coefficients with a p-value of less than 0.05. The lower panel displays the output of the DWT processing of signal A by hard-thresholding period boundaries. Note that p-value based processing typically retains a non-zero mean as well as moving baselines, since these do tend to be statistically significant. Hard-thresholding to remove baselines can lead to some distortionof missing data as seen in the lower panel.

Using the Morlet CWT in WAVOS has enabled us to analyze the distributional properties of the period of rat SCN cells based on PER2::LUC bioluminescence data

As another example, we have also used WAVOS to analyze wheel-running data for wild-type mice in a 12:12 light:dark cycle (unpublished data, courtesy of the Herzog lab). The data contains wheel revolutions per minute sampled every 15 minutes for 10 days. Figure

DWT analysis of wheel-running data

**DWT analysis of wheel-running data**. The DWT decomposition plot of 10 days of wheel-running data from a wild-type mouse in a 12:12 light schedule (generously provided by the Herzog lab).

CWTheatmap of wheel-running data

**CWTheatmap of wheel-running data**. The CWT heatmap of the data of Figure 14. Note that the period is relatively stable over the course of the data and that a single ridge is clearly visible, as well as some brief ultradian periodicities.

Peak and trough markers for wheel-running data inferred by CWT analysis

**Peak and trough markers for wheel-running data inferred by CWT analysis**. The ridge and phase information as displayed in Figure 15 were used to infer peak and trough phase markers for the signal, here overlaid upon the original data. Note that despite the distinctly non-sinusoidal pattern of behavior, the CWT is capableof automatically inferring peak activity and trough activity from the provided data.

WAVOS has many features to facilitate analysis with the DWT and CWT, including: both command-line and graphical user interfaces; automatic processing of multiple time series simultaneously; interfaces to multiple standard file formats (including .csv,.xls, .txt, and .mat); automated detection and extraction of multiple statistics of interest (period, phase, amplitude, peak-to-trough measurements, and Rayleigh synchronization measurements); visualization tools for both exploration and analysis; utilities for smoothing, detrending, and statistical significance testing using the DWT; and multiple ridge selection algorithms, including local maximum and simulated annealing (the "crazy climber" method of

Future development of WAVOS will concentrate on feature extraction from circadian signals, in particular allowing end-users to select user-defined phase markers for further analysis.

Availability and requirements

• **Project name: **WAVOS - Wavelet Analysis and Visualization of Oscillatory Signals

• **Project home page: **

• **Operating Systems: **Cross-platform with MATLAB 2007a or later

• **Programming language: **MATLAB

• **Other requirements: **MATLAB 2007a or later

• **License: **Modified BSD

Competing interests

The authors declare that they have no competing interests.

Authors' contributions

RH wrote the initial version of WAVOS under the supervision of GB. Subsequent versions were prepared under the supervision of LRP. GB wrote the edge reweighting code to address implicit periodization edge effects in the CWT. All authors contributed equally to the authorship of the manuscript. All authors read and approved the final manuscript.

Acknowledgements

We wish to thank the Herzog lab at Washington University in St. Louis for their generous help, the locomotor data presented above, and feedback in evaluating early versions of WAVOS.

This work was funded by: ICB grants through the Army Research Office (DAAD 19-03-D-0004) and NIH grants GM078993 and GM096873-01.