# lasif.window_selection¶

Window selection algorithm.

This module aims to provide a window selection algorithm suitable for calculating phase misfits between two seismic waveforms.

The main function is the select_windows() function. The selection process is a multi-stage process. Initially all time steps are considered to be valid in the sense as being suitable for window selection. Then a number of selectors is applied, progressively excluding more and more time steps.

copyright: Lion Krischer (krischer@geophysik.uni-muenchen.de), 2013 GNU General Public License, Version 3 (http://www.gnu.org/copyleft/gpl.html)
lasif.window_selection.find_closest(ref_array, target)[source]

For every value in target, find the index of ref_array to which the value is closest.

Parameters: ref_array (numpy.ndarray) – The reference array. Must be sorted! target (numpy.ndarray) – The target array.
>>> ref_array = np.arange(0, 20.)
>>> target = np.array([-2, 100., 2., 2.4, 2.5, 2.6])
>>> find_closest(ref_array, target)
array([ 0, 19,  2,  2,  3,  3])

lasif.window_selection.find_local_extrema(data)[source]

Function finding local extrema. It can also deal with flat extrema, e.g. a flat top or bottom. In that case the first index of all flat values will be returned.

Returns a tuple of maxima and minima indices.

lasif.window_selection.flatnotmasked_contiguous(time_windows)[source]

Helper function enabling to loop over empty time windows.

lasif.window_selection.select_windows(data_trace, synthetic_trace, event_latitude, event_longitude, event_depth_in_km, station_latitude, station_longitude, minimum_period, maximum_period, min_cc=0.1, max_noise=0.1, max_noise_window=0.4, min_velocity=2.4, threshold_shift=0.3, threshold_correlation=0.75, min_length_period=1.5, min_peaks_troughs=2, max_energy_ratio=10.0, min_envelope_similarity=0.2, verbose=False, plot=False)[source]

Window selection algorithm for picking windows suitable for misfit calculation based on phase differences.

Returns a list of windows which might be empty due to various reasons.

This function is really long and a lot of things. For a more detailed description, please see the LASIF paper.

Parameters: data_trace (Trace) – The data trace. synthetic_trace (Trace) – The synthetic trace. event_latitude (float) – The event latitude. event_longitude (float) – The event longitude. event_depth_in_km (float) – The event depth in km. station_latitude (float) – The station latitude. station_longitude (float) – The station longitude. minimum_period (float) – The minimum period of the data in seconds. maximum_period (float) – The maximum period of the data in seconds. min_cc (float) – Minimum normalised correlation coefficient of the complete traces. max_noise (float) – Maximum relative noise level for the whole trace. Measured from maximum amplitudes before and after the first arrival. max_noise_window (float) – Maximum relative noise level for individual windows. min_velocity (float) – All arrivals later than those corresponding to the threshold velocity [km/s] will be excluded. threshold_shift (float) – Maximum allowable time shift within a window, as a fraction of the minimum period. threshold_correlation (float) – Minimum normalised correlation coeeficient within a window. min_length_period (float) – Minimum length of the time windows relative to the minimum period. min_peaks_troughs (float) – Minimum number of extrema in an individual time window (excluding the edges). max_energy_ratio (float) – Maximum energy ratio between data and synthetics within a time window. Don’t make this too small! min_envelope_similarity (float) – The minimum similarity of the envelopes of both data and synthetics. This essentially assures that the amplitudes of data and synthetics can not diverge too much within a window. It is a bit like the inverse of the ratio of both envelopes so a value of 0.2 makes sure neither amplitude can be more then 5 times larger than the other. verbose (bool) – No output by default. plot (bool) – Create a plot of the algortihm while it does its work.
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.35151001811027527, "perplexity": 4421.016184735383}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2018-09/segments/1518891813622.87/warc/CC-MAIN-20180221123439-20180221143439-00102.warc.gz"}