The waveform suite is a collection of MATLAB classes that work together to speed up and simplify the import and manipulation of time-series data. Originally conceived to manipulate seismic data, it may be applied to any regularly sampled time-series data that is associated with a location.
DOWNLOAD LATEST WAVEFORM SUITE
HERE (.zip)
Version: r258
Date: 1/03/2011
This update includes performance improvements and a variety of bug fixes. A new version of the waveform structure has been created, as well, but this should be invisible to existing programs.
README Notes
ZIP file contents:
- @datasource/ source directory for the datasource class
- @filterobject/ source directory for the filterobject class
- @scnlobject/ source directory for the scnlobject class
- @spectralobject/ source directory for the spectralobject class
- @waveform/ source directory for the waveform class
- uispecgram.fig UI component of the spectrogram generation program
- uispecgram.m example of an interactive spectrogram generation program
Installation
Unzip the files either into the MATLAB directory from which you work, or into another directory.
The parent directory (the one that contains all the @whatever directories) must be on the MATLAB path.
To enable log spectral plotting, please download uimagesc, by Frederic Moisy, available at: http://www.mathworks.com/matlabcentral/fileexchange/11368
Then, extract it to a location along the MATLAB path.
Additional help, along with examples can be found online at
- http://kiska.giseis.alaska.edu/Input/celso/matlabweb/waveform_suite/waveform_suite_example_index.html : several examples of the waveform suite in use
- http://kiska.giseis.alaska.edu/Input/celso/matlabweb/waveform_suite/waveform.html : the main waveform information page. Check the links on the left for information about the other features of waveform.
- http://kiska.giseis.alaska.edu/Input/celso/matlabweb/waveform_suite/download.html : (this page)
Notes about this release
r258
This release includes fixes to dates, history, extract, and an error generated when creating a specgram from a single waveform
Notice the large release number change? Much of that stems from waveform sharing revision codes with the GISMO suite, which includes additional files not found here.
r234
This release consists of a series of small fixes, plus one pretty cool addition.
First the addition:
Waveform now has a legend routine. If you plot multiple wavforms w, then legend(w) will automatically create a legend based upon the uniqueness of STATION and CHANNEL. For example, if all waveforms have different stations, but are the same channel, it will create a legend from the STATION. If stations and channels are all the same, it will label with the start time. You may specify fields with the syntax legend(w, 'myfield' [,...]), where myfield is any information you might retrieve via waveform/get.
| example: | ||
| old way: | legend(strcat(get(w,'station'),':',get(w,'channel')]); | % everything specified in gross detail |
| new way: | legend(w); | % if station & channel are non-unique |
| or: | legend(w,'station','channel'); | % also specified, but more readable |
The new old way will still work, and is how you might want to handle the more complex legend issues
Also:
- fixed error where string dates (in non-vector cells) are not understood by datenum within the main
waveformfunction. - added a method to
waveform/resamplecalled'builtin'that, oddly enough, invokes MATLAB's resample method. -
Fixed
datasource/getfilenameissue. -
Fixed a problem with
waveform/private/load_seisan(cell vs string)
r228
This release fixed a small problem with the waveform statistics. waveform/mean, waveform/median, waveform/std, and waveform/var had been written to use nanmean, nanmedian, etc. However, when I did this, I didn't realize that they were within the statistics toolbox. I have since modified them to work without the toolbox.
The spectrogram plotting functions have been expanded and updated. Now, both specgram and specgram2 will work for multiple waveforms. New options allow the user to control font-size, and excercise greater control over the colorbar. The uispecgram program has been updated to include the ability to generate log spectra, though the log-plotting ability still needs to be fine tuned.
r211
This is a maintenance release that fixes a problem with loading waveforms and acknowledges that the underlying waveform structure has changed.
- Fixed a bug in r207 (introduced ~r190) where attempting to read in a recently saved waveform (structure v1.1) will cause an error. This was caused by the removal of the station and channel fields (which had been depricated since the introduction of scnlobjects). The new waveform structure is referred to internally as v1.2.
- Moved HISTORY out of miscelleneous fields and into its own proper field within the waveform structure. This should save some speed overhead.
-
Fixed
sign(waveform), which was transposing the data column.
r206
Notice that the version # has changed to a release number. This has been prompted by changes with how the source code is version-controlled, and is a little less arbitrary than the 1.xx versions created before.
Improved:
- speed & memory efficiency: the workings of several functions have been streamlined to reduce the amount of data juggling that occurs behind the scenes.
- error handling: Several error messages have been improved, providing better explanations and/or suggestions on how to prevent the errors. Additional tests have been added to some functions further validating the data in order to prevent surprise (or less intelligible) errors.
- NaN support: r191 Basic statistical functions (std, var, median, etc.) were rewritten to take advantage of MATLAB's existing NaN support (eg, nanstd, nanvar, nanmedian). Where NaN values cannot be handled eloquently, the error messages and warnings have been improved to provide better information about what is occurring
- history: r200 Displaying a waveform now shows the number of items in the history, along with the latest modification date. Previously, it merely showed as an
Nx2 cell - help text: the help text has been improved for several functions
Added:
- cumtrapz integration: added ability to specify integration method for waveform/integrate. Previously, only cumsum integration was allowed, but now 'trapz' can be specified, which will use matlab's
cumtrapzfunction. - log specgram plots: r192 added the ability to stretch the y-axis logarithmically for spectrograms. This has been added to spectralobject/specgram and spectralobject/specgram2, and depends upon the function
uimagesc, created by Frederic Moisy, and available at the matlabcentral file exchange: File 11368
usage:specgram.m(spectralobject,waveform,'yscale','log')
Special Thanks to Jason Amundson for this one!
Upgraded:
- Mathematical operators: r189 When an NxM waveform is added, subtracted, multiplied, or divided (
./,.*,-,+) by an NxM numeric.
Where N is numeric and W is a waveform of the same size (both may be N-dimensional), then W .* N will multiply them element-wise. likewise, W + N will add them element-wise.
ie., for addition, if W is a 1x2 waveform, and N is a 1x2 double, then
W .* N = [W(1).* N(1) W(2) .*N(2)]
The same will hold true for the other basic operators
Removed:
- user manual has been removed from the suite. It had grown outdated, and by now is more misleading than useful. For details about how to use the functions, consult the inline help. Additional resources are the waveform suite website and the GISMO user group.
- global variables: r200 the number of global variables used withinn waveform has been reduced. In doing so, functions waveform/private/mep2dep and waveform/private/dep2mep have been reinstated. (These functions have yoyo'd between .m files and global inline functions ever since the inception of waveform.) Other than freeing up global namespace, this should be invisible to the user.
waveform/lookupunits.mhas been removed from the waveform suite. Its use is antelope specific, and really doesn't belong with the distribution. Instead its name has been changed and is now located in the GISMO suite downloadcontributed_antelope/add_waveform_fields/db_lookupunits.mr205spectralobject/spwelch.mhas been deprecated. Its functionality merely duplicated pwelch, and (perhaps) should not ever have been included in releases of the waveform suite.
Previous Versions
v 1.12
includes major changes to how waveform handles SAC files. Several bugs regarding the loading and saving of SAC files were brought to my attention. In response, all the sac-related files within the @waveform/private directory have been modified. These modification should be mostly transparent to overlying programs with the exception of User Fields.
When waveform opens a sac file, it read the header into user-defined fields. Much information from these fields were incorporated into the waveform, such as period, start time, units, etc. The user fields were then left in the waveform, but were vestigial. When a waveform writes out to a sac file, it recalculates much of this information because all of it was subject to change by the user. Now, most of these "vestigial" fields have been removed from the waveform. Fields that are no longer in the user-defined field section include: B, E, DEPMIN, DEPMAX, DEMEN, NPTS, KSTNM, KCMPNM, KNETWK, DELTA, NVHDR, IDEP, and LEVEN. All of the values contained in these fields are accessible through pre-existing means.
Starting with the file marked as v 1.10, i have implemented a fundamental change in the way waveform works. The source of the data, which used to be deeply entwined with the waveform class has been pulled out and split into its own class, datasource. This means that the waveform constructor call no longer requires a different series of arguments depending on the source. Now, the overlying program does not need to know whether data is imported via SAC, winston, antelope, etc. Additionally, this change has allowed the easy importation of user-defined file types and the ability to intelligently navigate directory structures. It is still backwards compatible, but warnings will be generated that aid the user in updating code to the new paradigm.
Support for the importation of SEISAN files was added, too. However, the inherent directory structure used with SEISAN precludes the datasource's ability to navigate and find the appropriate files. They can still be imported, but the file names will have to be individually declared.
scnlobjects were introduced as a way to make waveform more seed compliant, and to provide a robust way of handling the locales associated with each waveform. Other than the initial creation of scnlobjects necessary for the creation or importation of waveforms, this change is relatively transparent. That is to say, you can still access stations and channels through waveform's set/get routines without having to deal with the scnlobject contained within each waveform.
Acknowledgements
In one form or another, the waveform suite has been around for roughly 5 years. I'd like to thank those that have helped me improve it throughout that time. I especially would like to recognize Jackie-Caplan Auerbach (for introducing me to MATLAB and inspiring this suite in the first place), Jason Amundson (a great debugger and source of addtional functionality), Micheal Thorne (who's SAC routines I thoroughly cannibalized), Glenn Thompson and Silvio DeAngelis (as testers and for SEISAN help), my advisor Steve McNutt (who let me get away with working on this stuff when, perhaps I should have been concentrating on the wiggles themselves), and Michael West (For plenty of discreet encouragement and great conversations on waveform philosophy... and author of the correlation toolbox, which is based upon the waveform object).
I'm sure I'm leaving out important people; and I reserve the right to add them as they pop to mind.
