This fixes thee probllem brought up in the mailing list with the recent spectrum improvements

Tobias Megies brought up issue #2565 regarding my recent improvements in the spectral functions.  I found I had switched the order of window and detrend operations.  I have fixed the problem as well as implementing new tests to better check for this sort of problem in the future.

I also added one additional unrelated test.