Using the “Matrix Laboratory”
to Process Seismological Datasets
Andy Frassetto, Bob Woodward
Instrumentation Services, IRIS
USArray Data Processing and Analysis Short Course
August 4-8, 2014
Northwestern University
Evanston, Illinois
Courtesy Maggie Benoit (Friend of
2 IRIS, NSF Program Officer)
The “Bad” News…
• Matlab is a commercial product:
– Considerable startup cost for license/toolboxes
– Yearly maintenance fees
• Matlab can be clunky
– Slow to open, difficult to 3use with strings
The “Good” News…
• Matlab is a commercial product:
– Major discounts for students, universities often
purchase group licenses, etc.
– Extensive resources, support from the source
– Widespread, multi-disciplinary base of users
– Established, prominent, well-supported in its
usage within the seismological community
The Basics
Data acquisition
Data file format
Reading data
Data preprocessing
– Speed, speed, speed
• The importance of sanity checks
– Use the plotting tools!
• Results
– Use the plotting tools!
Data Files
• Data file formats
Byte order
– SAC files are traditionally used
– Changing trends:
• Chad’s talk tomorrow covers reading data directly via irisFetch.m
• With time and effort you can read any ASCII / binary file format
• Data reading
– Use wildcarding of file names to subset the # of files that needs
to be read?
– Typically make a pass to read headers
– Allocate memory for data
– Read data into one matrix
Prepping the Data
• Organize data in matrix
– Seismograms down columns
• Fastest for working with single seismograms
• Facilitates using MATLAB functions
MATLAB epochal
time different
from UNIX
• Use epochal time for all time-related arithmetic
• Decimate as you go
– To minimize total memory required
• Time series toolbox contains common filtering and
tapering functions
• Consider using the MATLAB “save” command to save a
pre-processed (e.g., collated, decimated, etc.) copy of
the data
– Can save significant time when doing large numbers of runs to
explore other parameters or to debug
• Typically, this is all about speed
– See “resources” section at end of slides
• Rich built-in function environment
– Build your own functions for code re-use
• Use development tools, e.g. checkcode
• Use the simple plot commands to sanity check your
This is one of the key benefits of developing in MATLAB
Debugging code
Debugging algorithm
Label those
Especially useful:
• “hist” to make a histogram of just about anything
• “plot” – time series and other continuous functions
• “scatter” – discrete x – y data points8
MATLAB Resources
• MATLAB Central
– Functions and help threads for all types of calculations, great for
custom needs
• The GISMO Waveform Suite – Celso Reyes
– Seismic analysis and display
• SEIZMO – Garrett Euler
• M_Map – R. Pawlowicz
– Mapping tools
MATLAB Resources
• Libmseed – IRIS DMC (C. Trabant)
– Comprehensive library of miniSEED manipulation functions
– C code, with a MATLAB interface module
• matTaup – a MATLAB version of the TauP toolkit
• Ttbox – travel time toolbox – M. Knapmeyer
• Function library – Frederik Simons
• Accelerating MATLAB
– Loren Shure’s blog on accelerating MATLAB
– Summary / tutorial on accelerating MATLAB
Or maybe don’t use MATLAB at all…enter octave, an open
source alternative,

similar documents