I am trying to extract modes from a multi-modal density function and not just peaks. For example, in the two density functions below (images), I would like to extract the curves contained in the black circles and ellipses. We consider that we don't know the a priori number of modes and we can't visualize the curve of the density function since I deal with hundreds of them.
I have not found concrete solutions on the internet. I will be grateful for any help.