vdetect function

Valley detection and centroidization