This page contains the documentation on each of the modules / classes / functions that make up the waveloc package. The modules are ordered by subject type. This is documentation is automatically generated from the doc-strings in the code itself. It is meant as an aide to developpers or advanced users who need access to the intrigacies of the code. It is not a tutorial (one will be coming soon).
Waveloc is piloted entirely through a set of options / parameters that are set in a WavelocOptions object. All options will (soon!) be explained on the tutorial pages.
The WavelocOptions class contains a single attribute opdict containing all the options and parameters to control the behaviour of waveloc. It also contains many methods to verify the consistency of the options before launching the various steps of the waveloc procedure.
Sets up a standard version of opdict. Used notably in the example cases.
Verify presence of all options necessary for SDS_processing.
Verifies that the base_path is set. If the ‘base_path’ option is not directly set in the opdict, its value is read from the environment variable $WAVELOC_PATH.
Verify presence of all options necessary for double difference location.
Verify presence of all options necessary for plotting waveloc results.
Waveloc needs travel-times to migrate the kurtosis waveforms. These can in principle be obtained in many different ways. For simple Earth models, a convenient way to obtain travel-time grids is to take advantage of the NonLinLoc implementation of the eikonal solver of Podvin & Lecomte (1991).
The NllGridLib module contains functions to read the output of NonLinLoc (NLL) in order to use the travel-times within waveloc. Contributed by Alessia Maggi
Projects latitude and longitude coordinates into an x-y coordinate system. Takes the projection from the NLL header info as read by read_hdr_file. The inverse projection is provided by rect2latlon.
Parameters: |
|
---|---|
Raises UserWarning: | |
if unsupported projection type is encountered. |
|
Return type: | tuple of floats |
Returns: | x and y coordinates in km wrt the origin of the projection |
Quick and dirty routine to read a NLL hypocenter file.
Parameters: | filename (string) – File to read |
---|---|
Return type: | tuple of floats |
Returns: | (otime, hypo_x, sigma_x, hypo_y, sigma_y, hypo_z, sigma_z) |
Quick and dirty routine to read P-wave picks from NLL hypocenter file.
Parameters: | filename (string) – File to read |
---|---|
Return type: | dictionary |
Returns: | A dictionary where the keys are the station names and the values are the P-arrival times as UTCDateTime objects. |
Reads a NLL .hdr file.
Parameters: | filename (string) – File to read |
---|---|
Returns: | Dictionary containing the information in the file. If filename is a grid geometry header, the second line will be the projection info. If filename is a travel-time grid header, there will also be a line with the station information. The dictionary keys for the geometry are ‘nx’, ‘ny’, ‘nz’, ‘x_orig’, ‘y_orig’, ‘z_orig’; those for the projection are ‘proj_name’, ‘orig_lat’, ‘orig_lon’, ‘map_rot’; those for the station information are ‘station’, ‘sta_x’, ‘sta_y’, ‘sta_z’. |
Reads a file formatted according the the NLL station format.
Parameters: | filename (string) – File to be read |
---|---|
Returns: | Dictionary of stations. Each station is itself a dictionary containing the following information: ‘station’ = station name; ‘loc_type’ = [‘XYZ’ | ‘LATLON’]; if ‘loc_type’ = ‘XYZ’, then the coordinates of the station are given by ‘x’ and ‘y’, otherwise they are ‘lat’, ‘lon’; the depth and elevation of the station are given respectively by ‘depth’ and ‘elevation’. |
Raises UserWarning: | |
if unknown ‘loc_type’ encoutered. |
Projects x and y coordinates into an latitude-longitude coordinate system. Takes the projection from the NLL header info as read by read_hdr_file. The inverse projection is provided by latlon2rect.
Parameters: |
|
---|---|
Raises UserWarning: | |
if unsupported projection type is encountered. |
|
Return type: | tuple of floats |
Returns: | latitude and longitude (latitude positive North, longitude positive East) |
Waveloc manipulates many large arrays, some of which are written / read from disk. On some machines, these arrays are larger than the available RAM. In order to avoid the drammatic slow-downs when swapping to disc occurs in these cases, we use hdf (hierarchical data formats) that provide memory-like access to files on disc.
All large arrays that are infrequently accessed (e.g. travel-time arrays) are written and used in this manner. When there is sufficient RAM available, large arrays that are frequently accessed (search-point travel-times, 4D-migration grids) are kept in memory.
Class derived from H5SingleGrid that upon initialization reads a NLL pair of files (.hdr and .buf) and writes an equivalent hdf5 file.
Parameters: |
|
---|
Class that wraps several methods for regular grids in HDF5 format.
Attributes
An HDF5 dataset.
Attributes of an HDF5 dataset.
Methods
Intrepolates to a new grid.
Parameters: |
|
---|
Performs n-linear interpolation on the regular grid.
Parameters: |
|
---|---|
Return type: | float |
Returns: | value at point |
The waveform manipulation routines in waveloc are heavily based on obspy. As waveloc development started before obspy was fully functionnal, some external functions are used where obspy equivalents were not available. Updating all the waveform manipulation routines to use the latest obspy features will be completed at some time.
The OP_waveforms module provides the Waveform class through which most time-series manipulation is carried out, as well as several useful functions.
Note
Requires scikits.samplerate for full functionality (on linux systems install with easy_install scikits.samplerate after having installed the libsamplerate0 libraries using e.g. apt-get install libsamplerate0). scikits.samplerate is used to provide high-fidelity resampling when standard decimation is not possible (e.g. to pass from 125Hz sampling to 100Hz sampling).
Wrapper class for obspy streams. Adds many convenience functions, and functionality specific to WaveLoc processing.
Attributes
An obspy.core.Stream object. Can be accessed directly. Initialises to None. If you set this attribute directly, you should also set trace to stream.traces[0]
An obspy.Trace object. Can be accessed directly. Initialises to None. If you set this directly, make sure it points to stream.traces[0]
Text string indicating processing type. Can be accessed directly. Initialises to None.
Methods
Apply a band-pass filter to the data. If data are segmented into multiple traces, apply the same filter to all traces. Calls obspy.signal.filter() to do the filtering.
Parameters: |
|
---|---|
Raises UserWarning: | |
if no data in stream. |
Channel name from self.trace (read-only).
Channel name from self.trace (read-only).
Computes a signature for a waveform, made up by the maximum of the trace and its sum.
Return type: | tuple of floats |
---|---|
Returns: | maximum, datasum |
Applies obspy decimation, after applying an anti-aliasing, non-causal filter of 0.4*(new sample rate).
Parameters: | factor (integer) – Decimation factor. |
---|
Makes a quick and dirty plot of the waveform. If filename is given (and is different from “”) then the plot of the waveform is written to file, otherwise it is shown on the screen.
Parameters: |
|
---|
Returns signal-to-noise ratio, where signal = max(abs(signal between left_time and right_time)) and noise = median(abs(signal between left_time- and otime)).
Parameters: |
|
---|
Runs envelope processing on a waveform. Replaces self.trace and sets self.proc to “Envelope’.
Replace local maxima by a series of dirac and convolve them with a gaussian distribution. Overwrites the waveform. Sets self.proc to ‘Gaussian’
Parameters: |
|
---|
Processing waveform using kurtosis (from statlib package). Calls filters.sw_kurtosis1(), and overwrites the waveform. Sets self.prof to ‘Kurtosis’
Parameters: |
|
---|
Runs classic short to long term average ratio processing on waveform. Replaces self.trace and sets self.proc to StaLta.
Parameters: |
|
---|
Read waveform data from an SDS structured archive. Simple overlaps and adjacent traces are merged if possile.
Parameters: |
|
---|---|
Raises UserWarning: | |
If there are no data between starttime and endtime |
Read waveform data from file. Multiple traces are merged if they overlap exactly or are adjacent.
Parameters: |
|
---|---|
Raises UserWarning: | |
If there are no data between starttime and endtime |
Applies audio-quality resampling in place. Requires installation of scikits.samplerate.
Parameters: |
|
---|
Removes the mean of the stream (iterates over all traces).
Raises UserWarning: | |
---|---|
if no data in stream. |
Start time of self.trace (read-only).
Station name from self.trace (read-only).
A numpy.array containing times in seconds from self.trace.stats.starttime for data points in self.trace (read-only).
Takes positive derivative of a stream (used to calculate the positive kurtosis gradient).
Parameters: |
|
---|
gradient :param post_taper: If True then apply a taper after taking positive gradient.
Raises UserWarning: | |
---|---|
if no data in stream. |
Applies a cosine taper the stream (iterates over all traces).
Raises UserWarning: | |
---|---|
if no data in stream. |
Values of self.trace.data (read-only).
Write waveform to file.
Parameters: |
|
---|
Parameters: |
|
---|
Given a time-step, a mean and sigma, returns an array with a Gaussian signal from -4*sigma to +4*sigma around the mean.
Parameters: |
|
---|---|
Return type: | numpy array |
Returns: | array with Gaussian signal |
Reads data that have the same station names as those used as keys to a given time dictionary
Parameters: |
|
---|---|
Raises UserWarning: | |
if sampling is different between the files |
Takes first time derivative of a stream (iterates over all available traces) and keep only positive values (set negative values to zero).
Parameters: | st (An obspy.stream object) – Input stream, processed in place |
---|
Functions for timeseries filtering.
Created by Alessia Maggi and Alberto Michelini.
Determines the short to long time average ratio of a timeseries. using Allen (1978) caracteristic function (see report)
Parameters: |
|
---|---|
Returns: | processed signal |
Determines the envelope of a signal using the Hilbert transform. Uses scipy.signal.hilbert() to do the Hilbert transform.
Parameters: |
|
---|---|
Returns: | envelope as numpy array |
TODO What does this function do? Alberto??
Parameters: |
|
---|---|
Raises ValueError: | |
Determines the gradient of a timeseries.
Parameters: |
|
---|---|
LENwin: | time window (in secs) over which the gradient is determined |
Determines the kurtosis of a timeseries.
Parameters: |
|
---|---|
LENwin: | time window (in secs) over which the kurtosis is determined |
Determines the kurtosis of a timeseries as described by kuperkoch et al. 2010: calculate the kurtosis recursively. Results are not satisfying, but one may want to improve this... it might save some time!
Parameters: |
|
---|---|
LENwin: | time window (in secs) over which the kurtosis is determined |
Computes the zi state from the filter parameters. See [Gust96].
Based on: [Gust96] Fredrik Gustafsson, Determining the initial states in forward-backward filtering, IEEE Transactions on Signal Processing, pp. 988–992, April 1996, Volume 44, Issue 4
Parameters: |
|
---|---|
Returns: | zi state as numpy array |
Recursive dx2 (from Chassande-Mottin, 2002)
Parameters: |
|
---|---|
Returns: | processed signal as numpy array |
Recursive Kurtosis calculated using Chassande-Mottin (2002). Beware, this function is unstable for strongly non-stationary signals.
Parameters: |
|
---|---|
Returns: | processed signal as numpy array |
Recursive pseudo-kurtosis calculation as used by Langet et al. (2014)
Parameters: |
|
---|---|
Returns: | procesed signal as numpy array |
Determines the absolute value of the skewness of a timeseries.
Parameters: |
|
---|
Smooth the data using a window with requested size.
This method is based on the convolution of a scaled window with the signal. The signal is prepared by introducing reflected copies of the signal (with the window size) in both ends so that transient parts are minimized in the begining and end part of the output signal.
Parameters: |
|
---|---|
Returns: | the smoothed signal |
Raises ValueError: | |
example:
t=linspace(-2,2,0.1) x=sin(t)+randn(len(t))*0.1 y=smooth(x)
Determines the short to long time average ratio of a timeseries.
Parameters: |
|
---|---|
Returns: | processed signal |
Returns kurtosis calculated over data set x using sliding windows of length n points. Length of returned array is len(x)-n+1.
Parameters: |
|
---|---|
Returns: | procesed signal as numpy array |
Returns kurtosis calculated over data set x using sliding windows of length n points. Length of returned array is len(x)-n+1. This version uses filter.window() to slice the data array and is faster than sw_kurtosis1.
Parameters: |
|
---|---|
Returns: | procesed signal as numpy array |
Determines the variance of a timeseries.
Parameters: |
|
---|---|
LENwin: | time window (in secs) over which the variance is determined |
Returns: | processed signal as numpy array |
Double-band filter-bank. [a,d] = DBFB(x,h,g) computes the approximation coefficients vector a and detail coefficients vector d, obtained by passing signal x though a two-band analysis filter-bank.
Parameters: |
|
---|---|
Return type: | numpy array |
Returns: | a, d |
Computes the fast kurtogram Kwav of signal x up to level ‘nlevel’ Maximum number of decomposition levels is log2(length(x)), but it is recommended to stay by a factor 1/8 below this. Also returns the vector of k-levels Level_w, the frequency vector freq_w, the complex envelope of the signal c and the extreme frequencies of the “best” bandpass f_lower and f_upper.
J. Antoni : 02/2005 Translation to Python: T. Lecocq 02/2012
Parameters: |
|
---|---|
Returns: | Kwav, Level_w, freq_w, c, f_lower, f_upper * Kwav: kurtogram * Level_w: vector of levels * freq_w: frequency vector * c: complex envelope of the signal filtered in the frequency band that maximizes the kurtogram * f_lower: lower frequency of the band pass * f_upper: upper frequency of the band pass |
TODO flesh out this doc-string
J. Antoni : 12/2004 Translation to Python: T. Lecocq 02/2012
Parameters: |
|
---|---|
Type: | Fs: integer |
Returns: | c, s, threshold, Bw, fc |
Calculates the kurtosis K (2-D matrix) of the complete quinte wavelet packet transform w of signal x, up to nlevel, using the lowpass and highpass filters h and g, respectively. The WP coefficients are sorted according to the frequency decomposition. This version handles both real and analytical filters, but does not yield WP coefficients suitable for signal synthesis.
J. Antoni : 12/2004 Translation to Python: T. Lecocq 02/2012
Parameters: |
|
---|---|
Returns: | kurtosis |
Calculates the kurtosis K of the complete quinte wavelet packet transform w of signal x, up to nlevel, using the lowpass and highpass filters h and g, respectively. The WP coefficients are sorted according to the frequency decomposition. This version handles both real and analytical filters, but does not yield WP coefficients suitable for signal synthesis.
J. Antoni : 12/2004 Translation to Python: T. Lecocq 02/2012
Parameters: |
|
---|
Performs one analysis level into the analysis tree TODO : flesh out this doc-string
Parameters: |
|
---|
Is a recursive funtion. Computes and returns the 2-D vector K, which contains the kurtosis value of the signal as well as the 2 kurtosis values corresponding to the signal filtered into 2 different band-passes. Also returns and computes the 2-D vector KQ which contains the 3 kurtosis values corresponding to the signal filtered into 3 different band-passes.
Parameters: |
|
---|---|
Returns: | K, KQ |
Triple-band filter-bank. [a1,a2,a3] = TBFB(x,h1,h2,h3)
Parameters: |
|
---|---|
Return type: | numpy array |
Returns: | a1, a2, a3 |
Computes the coefficients of the binary expansion of i: i = a(1)*2^(k-1) + a(2)*2^(k-2) + ... + a(k)
Parameters: |
|
---|---|
Returns: | coefficients a |
Run the kurtogram analysis using the parameters contained in the WavelocOptions.opdict.
Parameters: | opdict – Dictionary containing the waveloc parameters and options. |
---|
Implements the kurtogram routine of Antoni (2005).
Gets bandwidth bw and frequency parameters knowing the level and the frequency indexes.
Parameters: |
|
---|---|
Returns: | bw, fc, fi, l1 * bw: bandwidth * fc: central frequency * fi: index of the frequency sequence within the level l1 * l1: level |
Calculates the Fourier transform of the squared envelope
Parameters: | c – signal |
---|---|
Returns S: | FT of squared envelope |
Gets maximum of a nD grid and its unraveled index
Parameters: | grid – an nD-grid |
---|---|
Returns: |
Calculates h-parameters used in Antoni (2005)
Parameters: |
|
---|---|
Return type: | numpy array |
Returns: | h-parameters: h, g, h1, h2, h3 |
Calculates kurtosis of a signal according to the option chosen
Parameters: |
|
---|---|
Return type: | float |
Returns: | Kurtosis |
Finds for each Waveloc event and for each station the best filtering parameters for kurtosis computation. Writes them into the dictionary info.
Parameters: |
|
---|---|
Return type: | dictionary |
Returns: | info |
Calculates next power of 2.
Parameters: | n (integer) – a number |
---|---|
Return type: | integer |
Returns: | The next power of 2 |
Plots the kurtogram.
Parameters: |
|
---|
Plots envelope (with or without its spectrum)
Parameters: |
|
---|
Plots both signal and kurtosis for comparison. TODO : flesh out this doc-string.
Parameters: |
|
---|
Inverse of the Rayleigh cumulative distribution function (cdf). X = RAYLINV(P,B) returns the Rayleigh cumulative distribution function with parameter B at the probabilities in P.
Parameters: |
|
---|
Reads the binary file with kurtogram frequencies. Plots the histograms of lower and upper frequencies for each station. Aims at determining the best filtering parameters.
Parameters: | filename (string) – File to read |
---|
Returns the part of signal corresponding to a given event.
Parameters: |
|
---|---|
Return type: | numpy array |
Returns: | val |
Replaces the initial kurtosis by a new one (from the signal filtered in the preferred band pass). Writes it in the dictionary info.
Parameters: |
|
---|---|
Return type: | dictionary |
Returns: | info |
Creates an SDS directory structure from a flat directory of data files. The SDS structure will contain symlinks to the original data, to avoid copying data. If existing links exist, they will be overwritten.
Parameters: |
|
---|
The module SDS_processing contains functions to apply Waveloc specific processing on data contained in an SDS file structure.
Does all the processing for an SDS archive. All options are given within a WavlocOptions object. Steps are:
Parameters: | opdict (dictionary) – Dictionary of options. Refers the the opdict attribute of WavelocOptions objects. |
---|
Reads a channel file containing network-code, station-name, component-name triplets. Can be used to provide fine control of data to be processed.
Parameters: | fname (string) – File to be read |
---|---|
Returns: | List of tuples. Each tuple contains network-name, station-name, channel-name as strings. |
Do continuous migration loop. TODO : flesh out this doc-string.
Do setup and launch migration.
Parameters: | opdict – WavelocOptions.opdict |
---|
Computes expected value and variance of a 1D grid along its (only) axis.
Parameters: |
|
---|---|
Return type: | float |
Returns: |
|
Computes expected coordinates of a 3D grid
Parameters: |
|
---|---|
Return type: | numpy array |
Returns: |
|
Computes expected coordinates of a 4D grid
Parameters: |
|
---|---|
Return type: | numpy array |
Returns: |
|
Computes norm of a 1D grid
Parameters: |
|
---|---|
Return type: | float |
Returns: | grid norm |
Computes norm of a 3D grid
Parameters: |
|
---|---|
Return type: | float |
Returns: | grid norm |
Computes norm of a 4D grid
Parameters: |
|
---|---|
Return type: | float |
Returns: | grid norm |
Parameters: | opdict – Dictionary of waveloc options / parameters. |
---|
Analyses the filtered data and the kurtosis time-series to determine the number of stations whose traces have sufficiently high signal-to-noise ratio (SNR) to be useful for the location. Both time-series need to satisfy the conditions for a station to be counted as contributing to the location.
Parameters: |
|
---|---|
Return type: | integer |
Returns: | Numer of stations that have contributed to the location. |
Plot the location (in time) of the triggers. TODO : Flesh out this doc-string
Parameters: |
|
---|
Read header information from a location file into a WavelocOptions.opdict.
Parameters: |
|
---|---|
Returns: | opdict |
Read locations from file.
Parameters: | filename – File to read. |
---|---|
Returns: | List of locations (each location is a dictionary) |
Inner loop of the location process.
Parameters: |
|
---|---|
Returns: | List of locations. Each location is a dictionary containing all the relevant information. |
Write the information regarding how the locations were generated to an already opened location file. This information becomes a location “header”.
Parameters: |
|
---|
Do the magnitude computation, using options in WavelocOptions.opdict.
Parameters: | opdict – Dictionary containing waveloc options and parameters. |
---|
Plot the results of a wavloc run (migration and location). All options and parameters are taken from an opdict.
Parameters: |
|
---|
Creates plot for synthetic test. TODO : flesh out this doc-string
Parameters: |
|
---|
Plots location grid. TODO : Flesh out this doc-string.
Parameters: |
|
---|
Creates plot for located waveforms. Assumes data and grad are ready for plotting. TODO : Flesh out this doc-string.
Parameters: |
|
---|
This part of the waveloc code was contributed by Nadège Langet during her PhD thesis.
Provides classes and functions for cross-correlation.
Class that reads, writes and stores the binary files containing the correlation matrix.
Computes the time lag entirely in the spectral domain, using the slope of the phase spectrum where the amplitude is strong.
Parameters: |
|
---|---|
Return type: | float |
Returns: | time-lag |
Returns maximum of cross-correlation and time-lag given frequency domain cross- and auto- correlation vectors.
Parameters: |
|
---|---|
Return type: | float |
Returns: | value_t, tau_t, respectively the cross-correlation maximum value and time-lag |
Performs correlation on two signals.
Parameters: |
|
---|---|
Return type: | float |
Returns: | The returned values depend on the a input parameter:
|
Determines the minimum and maximum indices of the most significative part of a signal. (Here, determines the part of the amplitude spectrum which is useful)
Parameters: |
|
---|---|
Return type: | int |
Returns: | mini, maxi |
Displays amplitude and phase of the frequency domain cross-correlation.
Parameters: |
|
---|
Runs correlation using options contained in a WavelocOptions.opdict dictionary.
Explores and cross-correlates all possible event pairs of the Waveloc location file at all stations. Writes the correlation coefficients and time delays in 2-D numpy arrays for each station and saves the final dictionaries into 2 binary files.
The correlation first takes place in the time domain. If the correlation value is over a given threshold, the correlation is also performed in the frequency domain so that a subsample precision can be obtained on the time delay.
Computes cross-correlation and auto-correlation vectors of two signals in the frequency domain.
Parameters: |
|
---|---|
Return type: | numpy arrays |
Returns: | Cxy, Cxx, Cyy, f |
Plots the waveforms. On the first plot, both waveforms are superimposed. On the second plot, they are plotted separately.
Parameters: |
|
---|
Convenience function to read a seismogram and return its data, time-step, station name and start-time
Parameters: | filename (string) – File to read |
---|---|
Returns: | val, dt, name, tdeb
|
Provides classes and functions for clustering of earthquakes based on the depth-first algorithm.
Implementation of the depth first search (DFS) algorithm. This is a recursive algorithm. See detailed description in do_clustering function.
Parameters: |
|
---|
Class of Graph objects. Contains 4 attributes:
** Attributes **
Indicates if an event already belongs to a cluster (1) or not (0).
Indicates the cluster number of all events. 0 means the event does not belong to any cluster.
Lists the indexes of the neighbour events for each event. GRAPH.neighbours is then a list of lists.
Appends value to cluster_index attribute
Parameters: | value (integer) – Value to append. |
---|
Computes the number of stations where the correlation value is greater than the threshold for every event pair
Parameters: |
|
---|---|
Return type: | numpy matrix containing integers |
Returns: | matrix of number of stations |
First step: all events are examined one by one. For each of them, the indexes of the events where there is a sufficient number of stations (i.e. the number exceeds or equals nbmin) are kept in GRAPH.neighbours. All events are flagged to 0 and belong to cluster 0 by default. The indexes of the events for which neighbours were found are written in the list summits.
From this list (summits), we extract the event which has the greatest number of neighbours. The clustering process will start with that event.
Then the DFS algorithm is applied: when an event is examined, it is flagged to 1 and its cluster number is also updated (GRAPH.cluster_index). The DFS algorithm is recursive and explores each possible path until it ends: it means that when the research starts with a given event, it will search for the the first neighbour, and then the first neighbour of this first neighbour and so on... When all the first neighbours are found, the research can concentrates on second neighbours, and so on until all the neighbours are found.
Once the DFS algorithm has found all events linked to summit_first, we write the corresponding indexes into the dictionary CLUSTER (where the keys are the cluster indexes) and look for events with neighbours which are still not flagged to 1. The process keeps going until the whole events with neighbours belong to a cluster.
The function finally returns the dictionary CLUSTER.
Parameters: |
|
---|
is greater than a given threshold for all possible event pairs :param nbmin: minimum number of stations where the cross-correlation value should be greater than a given threshold to form a cluster
Return type: | dictionary |
---|---|
Returns: | indexes of events forming each cluster |
Does clustering by applying the depth first search algorithm and saves the result (= a dictionary containing the event indexes forming each cluster) in a binary file. Needs to define the correlation value threshold and the minimum number of stations where this threshold should be reached to form a cluster (should be done in the options dictionary)
Parameters: | opdict – Dictionary of waveloc options |
---|
Displays two figures. On the first plot, all events are represented. Those belonging to a cluster are color-coded and labelled with the cluster index. On the second plot, all events are also represented, but those belonging to a cluster are colored in black. The links between events of a same cluster are also plotted and color-coded in function of the number of stations where the correlation value exceeds the threshold. Uses mlab from mayavi
Parameters: |
|
---|
:param nbsta:2-D matrix containing the number of stations where the cross-correlation value is greater than a given threshold for all possible event pairs :param CLUSTER: dictionary containing the indexes of the events for each cluster :param nbmin: minimum number of stations where the cross-correlation value should be greater than a given threshold to form a cluster :param threshold: correlation value threshold set to form a cluster
Plots the waveforms of all possible event pairs within a cluster. On the same figure, displays the superimposed waveforms of the event pair for all stations. Also displays the correlation value.
Parameters: |
|
---|
Finds the indexes corresponding to t_before and t_after
Parameters: |
|
---|---|
Return type: | integer |
Returns: | indexes corresponding to t_before and t_after |
Routines to do double-difference relative location of events.
Applies centroid constraint: sum(delta m)=0.
Parameters: |
|
---|---|
Returns: | Updated versions of G, d, W |
Extract the coordinates of the events of a given cluster
Parameters: |
|
---|---|
Return type: | list |
Returns: | xini, yini, zini, zini_ph, to_ini |
Do double difference location (inner routine) and return new coordinates.
Parameters: |
|
---|---|
Return type: | list |
Returns: | x, y, z, to |
Do double difference (outer routine). Takes options from a WavelocOptions.opdict dictionary.
Parameters: | opdict – Dictionary of parameters and options |
---|
Fills in matrix G (partial derivatives) data-vector d (double differences) and matrix W (weights)
Parameters: |
|
---|
Inverts G, d, W using LSQR to obtain parameter vector m
Parameters: |
|
---|---|
Returns: | Parameter vector m |
Computes partial derivatives
Parameters: |
|
---|---|
Return type: | list |
Returns: | dpx, dpy, dpz |
Plot old and new locations (uses mayavi)
Parameters: |
|
---|
Compute theoretical traveltimes and arrival times for a point to all stations using pre-calculated time-grids
Parameters: |
|
---|---|
Return type: | dictionary |
Returns: | t_th, arr_times |