BPMF.clib

BPMF.clib.find_similar_sources(moveouts, source_longitude, source_latitude, cell_longitude, cell_latitude, threshold, num_threads=None, num_stations_for_diff=None, method='closest')[source]

Find sources with similar moveouts so that users can discard some of them during the computation of the network response and thus speedup the process.

Parameters:
  • moveouts (numpy.ndarray) – The (n_sources, n_stations) moveout 2-D array, in seconds. Note: It makes more sense to give the relative travel times (w.r.t. earliest arrival) rather than the absolute travel times.

  • source_longitude (array_like) – The (n_sources,) list or 1-D array of source longitudes.

  • source_latitude (array_like) – The (n_sources,) list or 1-D array of source latitudes.

  • cell_longitude (array_like) – The (n_cells_longitude,) list or 1-D array of the vortex longitudes defining the geographic cells used to sub-divide the problem.

  • cell_latitude (array_like) – The (n_cells_latitude,) list or 1-D array of the vortex latitudes defining the geographic cells used to sub-divide the problem.

  • threshold (float) – The station average time difference tolerance to consider two sources as being redundant.

  • num_threads (int or None, optional) – The number of threads over which the computation is parallelized. If None or -1, spaws one thread per available CPU. Defaults to None.

  • num_stations_for_diff (int or None, optional) – The number of stations over which the sum of the squared differences is computed. See method for more info. If None, uses all of the stations. Defaults to None.

  • method (str, optional) –

    Either of ‘closest’ or ‘smallest’. - ‘closest’: Find the num_stations_for_diff closest stations to every source

    in the grid and restrict the sum to those.

    • ’smallest’: Compute the differences at every station but use only the num_stations_for_diff smallest differences in the sum.

Returns:

redundant_sources – Boolean numpy array with True elements for sources that share similar moveouts with other sources.

Return type:

(n_sources,) boolean numpy.ndarray

BPMF.clib.kurtosis(signal, W)[source]
BPMF.clib.select_cc_indexes(ccs, threshold, search_win)[source]

Select new event detection’s correlation indexes.

Parameters:
  • ccs ((n_corr,) numpy.ndarray) – Time series of correlation coefficients.

  • (n_corr (threshold) – Time series or scalar detection threshold.

  • scalar () numpy.ndarray or float) – Time series or scalar detection threshold.

  • search_win (int scalar) – Size of the time window, in number of consecutive correlations, defining grouped detections.

Returns:

selection – Vector of n_corr booleans that are true if the corresponding CC index is a new event detection.

Return type:

(n_corr,) bool numpy.ndarray

BPMF.clib.time_dependent_threshold(time_series, sliding_window_samp, num_dev, overlap=0.66, threshold_type='rms', white_noise=None, num_threads=None)[source]

Time dependent detection threshold.

Parameters:
  • time_series ((n_correlations) array_like) – The array of correlation coefficients calculated by FMF (float 32).

  • sliding_window_samp (scalar integer) – The size of the sliding window, in samples, used to calculate the time dependent central tendency and deviation of the time series.

  • overlap (scalar float, default to 0.75)

  • threshold_type (string, default to 'rms') – Either rms or mad, depending on which measure of deviation you want to use.

Returns:

threshold – Returns the time dependent threshold, with same size

Return type:

(n_correlations) array_like