Posts

Showing posts from 2019

How to get a Maxima and Minima of a data

Image
How to get a Maxima and Minima of a data Many times while analysing a data, we need to get the local maxima and minima of a data. There are many algorithms to do the task. Here, I am sharing a python script to get the maxima and minima of a data file. In python, there is an inbuilt function from the scipy library to find the maxima. Following is the function: peaks_positive, _ = scipy.signal.find_peaks(y, height = 2.5, threshold = None, distance=5) In the above function,  height = User-defined number. This is the minimum height of the data to get the peaks. threshold = The vertical distance to its neighbouring samples. This number defines the minimum vertical distance between two nearby peaks.  distance = The horizontal distance to its neighbouring samples. This number defines the minimum horizontal distance between two nearby peaks. If two peaks are to close to another the lower one is removed. It is to be noted that this is not the value of the data poin