Algorithms
Overview
This page is a quick reference to algorithms available in MsPASS. The page is organized as a set of tables with hyperlinks to the docstrings for each algorithm function.
Processing Functions
These algorithms have a function form to allow their use in parallel map operations. They are functions that have one or more seismic data objects as inputs and return the output of the algorithm. The output may or may not be the same type. Some are wrappers for obspy functions, some are written in C++ with python wrappers, and some are pure C++ functions with python bindings. Note the name field in the table below is a hyperlink to the docstring for that function.
Name 
Synopsis 
Inputs 
Outputs 

Crosscorrelate pair of signals 
TimeSeries 
TimeSeries 

obspy correlation of many with a template 
TimeSeriesEnsemble(arg)),TimeSeries(arg1) 
TimeSeriesEnsemble 

obspy single channel correlation against a template 
TimeSeries 
TimeSeries 

obspy detrend algorithm 
TimeSeries 
TimeSeries 

obspy timeinvariant filter function 
All 
Same as input 

obspy function to resample using interpolation 
TimeSeries 
TimeSeries 

Cut a smaller window from a larger segment 
All 
Same as input 

Combine a set of segments into one 
TimeSeriesEnsemble (member vector) 
TimeSeries 

scale data to specified level with a specified amplitude metric 
Any 
Same as input 

Compute one of several possible timedomain signaltonoise ratio metrics 
TimeSeries Seismogram 
float 

Computes a series of snrbased amplitude metrics and posts them to output Metadata 
TimeSeries or Seismogram 
Same as input (Metadata altered) 

Computes a series of snrbased amplitude metrics relative to an Extarrival time 
TimeSeries 
TimeSeries (Metadata altered) 


Computes a set of broadband snr estimates in the frequency domain 
TimeSeries 
[dict,ErrorLogger] 
Shifts time 0 to arrival time defined by a Metadata key 
Seismogram or SeismogramEnsemble 
Same as input 

Applies an automatic gain control operator with a specified duration 
Seismogram 
TimeSeries of gains, Seismogram input altered in place 

Repair overlapping data segments 
list of TimeSeries 
TimeSeries 

Sorts an ensemble into net:sta:chan:loc order 
TimeSeriesEnsemble 
TimeSeriesEnsemble 

Splice a list of TimeSeries objects into a continuous single TimeSeries 
list of TimeSeries 
TimeSeries 


Bundle a TimeSeriesEnsemble into a SeismogramEnsemble 
TimeSeriesEnsemble 
SeismogramEnsemble 
Bundle a list of TimeSeries into a Seismogram object 
list of TimeSeries 
Seismogram 

Extract one component from a Seismogram or SeismogramEnsemble 
Seismogram or SeismogramEnsemble 
TimeSeries or TimeSeriesEnsemble 

Change from UTC to relative time standard 
any 
same as input 

Change from relative to UTC time standard 
any 
same as input 

Generic coordinate rotation 
Seismogram or SeismogramEnsemble 
same as input 

Restore data to cardinal directions 
Seismogram or SeismogramEnsemble 
same as input 

Apply a general transformation matrix to 3C data 
Seismogram or SeismogramEnsemble 
same as input 

Apply a onesided, linear taper 
any 
same as input 

Apply a onesided, cosine taper 
any 
same as input 

Apply a taper defined by a vector of samples 
any 
same as input 
Nonstandard Processing Functions
The next table is similar to above, but the inputs or outputs are not seismic data objects. They are used internally by some functions and can have utility for writing custom functions that use them inside another algorithm.
Name 
Synopsis 
Inputs 
Outputs 


Compute statistical summary of snr in a passband returned by EstimateBandwidth 
BandwidthData object 
Metadata 
Estimate signal bandwidth estimate of power spectra of signal and noise 
PowerSpectra of signal and noise windows 
BandwidthData  input for BandwidthStatisics 

Calculate amplitude with the MAD metric 
TimeSeries or Seismogram 
double 

Calculate amplitude with the peak absolute value 
TimeSeries or Seismogram 
double 

Calculate amplitude at a specified percentage level 
TimeSeries or Seismogram 
double 

Calculate amplitude with the RMS metric 
TimeSeries or Seismogram 
double 
Processing Objects
This collection of things are “processing objects” meaning they implement processing using a C++ or python class that has a method that runs an algorithm on seismic data. All are effectively functions that take inputs and emit an output. The only difference is the syntax of a “method” compared to a simple function.
Class Name 
Synopsis 
Processing method 
Inputs 
Outputs 

Add a constant to a metadata value 
apply 
Any seismic data object 
Edited version of input 

Add two metadata values 
apply 
Any seismic data object 
Edited version of input 

Change key associated with a value 
apply 
Any seismic data object 
Edited version of input 

Divide a metadata value by a constant 
apply 
Any seismic data object 
Edited version of input 

Divide one metadata value by another 
apply 
Any seismic data object 
Edited version of input 

Apply integer divide operator to a metadata value 
apply 
Any seismic data object 
Edited version of input 

Apply integer divide operator to two metadata values 
apply 
Any seismic data object 
Edited version of input 

Change a key to value mod constant 
apply 
Any seismic data object 
Edited version of input 

Set a field as mod division of a pair of values 
apply 
Any seismic data object 
Edited version of input 

Change a key to value times constant 
apply 
Any seismic data object 
Edited version of input 

Set a field as produce of a pair of values 
apply 
Any seismic data object 
Edited version of input 

Set a field to a constant 
apply 
Any seismic data object 
Edited version of input 

Change a key to value minus a constant 
apply 
Any seismic data object 
Edited version of input 

Set a field as difference of a pair of values 
apply 
Any seismic data object 
Edited version of input 

Clear all defined values of a specified key 
apply 
Any seismic data object 
Edited version of input 

Apply a chain of metadata calculators 
apply 
Any seismic data object 
Edited version of input 

Apply a series of kill operators 
kill_if_true 
Any seismic data object 
Edited version of input 

Kill if a keyvalue pair is defined 
kill_if_true 
Any seismic data object 
Edited version of input 

Kill if a keyvalue pair is not defined 
kill_if_true 
Any seismic data object 
Edited version of input 


Kill a datum if a value is equal to constant 
kill_if_true 
Any seismic data object 
Edited version of input 

Kill a datum if a value is not equal to constant 
kill_if_true 
Any seismic data object 
Edited version of input 
Kill if a value is greater than or equal to a constant 
kill_if_true 
Any seismic data object 
Edited version of input 

Kill if a value is greater than a constant 
kill_if_true 
Any seismic data object 
Edited version of input 

Kill if a value is less than or equal to a constant 
kill_if_true 
Any seismic data object 
Edited version of input 

Kill if a value is less than a constant 
kill_if_true 
Any seismic data object 
Edited version of input 

Kill for value relative to an interval 
kill_if_true 
Any seismic data object 
Edited version of input 
Deconvolution algorithms
MsPASS has a specialized algorithms module on “deconvolution”. Users should recognize that currently the module has algorithms for “deconvolution” in form of estimation of so called “receiver functions”. Receiver functions are a special type of deconvolution useful only, at present anyway, for application to teleseismic body wave phase data.
A suite of “conventional” scalar methods are available through two different mechanisms:
The wrapper function
mspasspy.alorithms.RFdeconProcessor.RFdecon()
is a functional form that can be used directly in map operators.The RFdecon function instantiates an instance of the class
mspasspy.algorithms.RFdeconProcessor.RFdeconProcessor
in each call to the function. It is more efficient (i.e. faster) to instantiate a single instance of this class and run it’smspasspy.algorithms.RFdeconProcessor.RFdeconProcessor.apply()
method, especially for multitaper methods that require computing the Slepian tapers.
See the docstrings with links above for usage.
A different, unpublished (aka experimental) algorithm called
“Colored Noise Regularized Three Component Decon “ is
implemented in the C++ class
mspasspy.ccore.algorithms.deconvolution.CNR3CDecon
.
See the mspass deconvolution tutorial for guidance on using this
experimental algorithm.