interp with duplicates

Hi,

This is more a coding/algorithm question than a straight matplotlib question.

I have x and y data based on a parameter k. x and y have noise, so that even though k increases monotonically neither x nor y are guaranteed to do so. x can have duplicates.

I need to find the area under the curve x,y (You may have guessed, x is false alarms, y is hit rate, and this is the ROC)

What I'm doing is rather cumbersome. I first sort x (shuffling y accordingly)
Then I crawl through x discarding the duplicates.

Only then does interp give me reasonable values which I then use for finding the area under the curve.

Is there a function in matplotlib that handles cases like this?

Thanks!
-K