findpeaks — EQcorrscan 0.0.8 documentation

# findpeaks

Function to find peaks in data above a certain threshold as part of the EQcorr package written by Calum Chamberlain of Victoria University of Wellington in early 2015.

Copyright 2015 Calum Chamberlain

This file is part of EQcorrscan.

> EQcorrscan is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

> EQcorrscan is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

> You should have received a copy of the GNU General Public License along with EQcorrscan. If not, see <http://www.gnu.org/licenses/>.

`findpeaks.` `find_peaks2`(arr, thresh, trig_int, debug=0, maxwidth=10, starttime=<mock.Mock object at 0x4091810>, samp_rate=1.0)

  Function to determine peaks in an array of data using scipy find_peaks_cwt, works fast in certain cases, but for match_filter cccsum peak finding, find_peaks2_short works better. Test it out and see which works best for your application.

  Parameters: | arr (ndarray) – 1-D numpy array is required thresh (float) – The threshold below which will be considered noise and peaks will not be found in. trig_int (int) – The minimum difference in samples between triggers, if multiple peaks within this window this code will find the highest. debug (int) – Optional, debug level 0-5 maxwidth (int) – Maximum peak width to look for in samples
  Returns: | peaks, locs: Lists of peak values and locations.

`findpeaks.` `find_peaks2_short`(arr, thresh, trig_int, debug=0, starttime=<mock.Mock object at 0x4091810>, samp_rate=1.0)

  Function to determine peaks in an array of data above a certain threshold. Uses a mask to remove data below threshold and finds peaks in what is left.

  Parameters: | arr (ndarray) – 1-D numpy array is required thresh (float) – The threshold below which will be considered noise and peaks will not be found in. trig_int (int) – The minimum difference in samples between triggers, if multiple peaks within this window this code will find the highest. debug (int) – Optional, debug level 0-5
  Returns: | peaks, locs: Lists of peak values and locations.

`findpeaks.` `find_peaks_dep`(arr, thresh, trig_int, debug=0, starttime=<mock.Mock object at 0x4091810>, samp_rate=1.0)

  Function to determine peaks in an array of data above a certain threshold.

  Depreciated peak-finding routine, very slow, but accurate. If all else fails this one should work.

  Parameters: | arr (ndarray) – 1-D numpy array is required thresh (float) – The threshold below which will be considered noise and peaks will not be found in. trig_int (int) – The minimum difference in samples between triggers, if multiple peaks within this window this code will find the highest.
  Returns: | peaks, locs: Lists of peak values and locations.

`findpeaks.` `is_prime`(number)
  Function to test primality of a number. Function lifted from online resource:
    http://www.codeproject.com/Articles/691200/Primality-test-algorithms-Prime-test-The-fastest-w
  This function is distributed under a seperate licence:
    This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Parameters: | number (int) – Integer to test for primality
  Returns: | bool