Help with windowing corrections for spectrums

Hi, I am trying to make some improvements to the spectrum-related functions in mlab (and the corresponding plotting functions).

What I am trying to do is make the functions more general, so they work with complex spectrums, magnitude spectrums, and phase spectrums in addition to PSDs. The problem I think I am running into is in line 277 of mlab.py, where the correction for the window function is applied. This correction works for PSDs, but shouldn’t work for other sorts of spectrums, and I none of the digital signal processing books I have access to seem to deal with this issue.

The line in question is:

# Scale the spectrum by the norm of the window to compensate for

# windowing loss; see Bendat & Piersol Sec 11.5.2.

Pxy /= (np.abs(windowVals)**2).sum()

This book is "Bendat & Piersol – Random Data: Analysis and Measurement
Procedures, John Wiley & Sons (1986)".  However, I can't find this book, nor am I even sure it deals with this subject for anything other than PSDs.

Does anyone know the formula for calculating the window correction for complex spectrums and/or magnitude and phase spectrums?  (if I have the complex spectrums I can calculate magnitude and phase spectrums, and vice versus)  Or, alternatively, does anyone have access to this book, and can they check whether it has any of those functions? 

Thanks a lot!