I am currently working on a problem that requires me to extract all maxima and find the frequency of time it spends in that maxima before finding a new one. There is a rare