ENH: added parameter to use periodic x-coordinates

I don't like this code repetition... You could integrate all this first branch into the code below, have a common code base for handling the array checks, branch only to do the modulo, sorting, appending and prepending if `period` is not `None`, and finish with a single call to `compiled_interp`. I think it would be cleaner.